summaryrefslogtreecommitdiffstats
path: root/makeself/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'makeself/jobs')
-rwxr-xr-xmakeself/jobs/70-netdata-git.install.sh8
-rwxr-xr-xmakeself/jobs/99-makeself.install.sh95
2 files changed, 63 insertions, 40 deletions
diff --git a/makeself/jobs/70-netdata-git.install.sh b/makeself/jobs/70-netdata-git.install.sh
index 0486ce11..b8548149 100755
--- a/makeself/jobs/70-netdata-git.install.sh
+++ b/makeself/jobs/70-netdata-git.install.sh
@@ -11,6 +11,13 @@ else
export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1"
fi
+if [ ! -z "${NETDATA_INSTALL_PATH}" -a -d "${NETDATA_INSTALL_PATH}/etc" ]
+ then
+ # make sure we don't have an old etc path, so that the installer
+ # will install all files without examining changes
+ run mv "${NETDATA_INSTALL_PATH}/etc" "${NETDATA_INSTALL_PATH}/etc.new"
+fi
+
run ./netdata-installer.sh --install "${NETDATA_INSTALL_PARENT}" \
--dont-wait \
--dont-start-it \
@@ -20,4 +27,5 @@ if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]
then
run strip ${NETDATA_INSTALL_PATH}/bin/netdata
run strip ${NETDATA_INSTALL_PATH}/usr/libexec/netdata/plugins.d/apps.plugin
+ run strip ${NETDATA_INSTALL_PATH}/usr/libexec/netdata/plugins.d/cgroup-network
fi
diff --git a/makeself/jobs/99-makeself.install.sh b/makeself/jobs/99-makeself.install.sh
index 465a3195..698f2f92 100755
--- a/makeself/jobs/99-makeself.install.sh
+++ b/makeself/jobs/99-makeself.install.sh
@@ -2,14 +2,46 @@
. $(dirname "${0}")/../functions.sh "${@}" || exit 1
+run cd "${NETDATA_SOURCE_PATH}" || exit 1
+
+# -----------------------------------------------------------------------------
+# find the netdata version
+
+NOWNER="unknown"
+ORIGIN="$(git config --get remote.origin.url || echo "unknown")"
+if [[ "${ORIGIN}" =~ ^git@github.com:.*/netdata.*$ ]]
+ then
+ NOWNER="${ORIGIN/git@github.com:/}"
+ NOWNER="${NOWNER/\/netdata*/}"
+
+elif [[ "${ORIGIN}" =~ ^https://github.com/.*/netdata.*$ ]]
+ then
+ NOWNER="${ORIGIN/https:\/\/github.com\//}"
+ NOWNER="${NOWNER/\/netdata*/}"
+fi
+
+# make sure it does not have any slashes in it
+NOWNER="${NOWNER//\//_}"
+
+if [ "${NOWNER}" = "firehol" ]
+ then
+ NOWNER=
+else
+ NOWNER="-${NOWNER}"
+fi
+
+VERSION="$(git describe || echo "undefined")"
+[ -z "${VERSION}" ] && VERSION="undefined"
+
+FILE_VERSION="${VERSION}-$(uname -m)-$(date +"%Y%m%d-%H%M%S")${NOWNER}"
+
# -----------------------------------------------------------------------------
# copy the files needed by makeself installation
run mkdir -p "${NETDATA_INSTALL_PATH}/system"
-run cd "${NETDATA_SOURCE_PATH}" || exit 1
-cp \
+run cp \
makeself/post-installer.sh \
makeself/install-or-update.sh \
installer/functions.sh \
@@ -25,9 +57,9 @@ cp \
# -----------------------------------------------------------------------------
# create a wrapper to start our netdata with a modified path
-mkdir -p "${NETDATA_INSTALL_PATH}/bin/srv"
+run mkdir -p "${NETDATA_INSTALL_PATH}/bin/srv"
-mv "${NETDATA_INSTALL_PATH}/bin/netdata" \
+run mv "${NETDATA_INSTALL_PATH}/bin/netdata" \
"${NETDATA_INSTALL_PATH}/bin/srv/netdata" || exit 1
cat >"${NETDATA_INSTALL_PATH}/bin/netdata" <<EOF
@@ -35,28 +67,34 @@ cat >"${NETDATA_INSTALL_PATH}/bin/netdata" <<EOF
export PATH="${NETDATA_INSTALL_PATH}/bin:\${PATH}"
exec "${NETDATA_INSTALL_PATH}/bin/srv/netdata" "\${@}"
EOF
-chmod 755 "${NETDATA_INSTALL_PATH}/bin/netdata"
+run chmod 755 "${NETDATA_INSTALL_PATH}/bin/netdata"
# -----------------------------------------------------------------------------
# move etc to protect the destination when unpacked
-if [ -d "${NETDATA_INSTALL_PATH}/etc" ]
+if [ ! -z "${NETDATA_INSTALL_PATH}" -a -d "${NETDATA_INSTALL_PATH}/etc" ]
then
if [ -d "${NETDATA_INSTALL_PATH}/etc.new" ]
then
- rm -rf "${NETDATA_INSTALL_PATH}/etc.new" || exit 1
+ run rm -rf "${NETDATA_INSTALL_PATH}/etc.new" || exit 1
fi
- mv "${NETDATA_INSTALL_PATH}/etc" \
+ run mv "${NETDATA_INSTALL_PATH}/etc" \
"${NETDATA_INSTALL_PATH}/etc.new" || exit 1
+
+ if [ -f "${NETDATA_INSTALL_PATH}/etc.new/netdata/netdata.conf" ]
+ then
+ # delete the generated netdata.conf, so that the static installer will generate a new one
+ run rm "${NETDATA_INSTALL_PATH}/etc.new/netdata/netdata.conf"
+ fi
fi
# -----------------------------------------------------------------------------
# remove the links to allow untaring the archive
-rm "${NETDATA_INSTALL_PATH}/sbin" \
+run rm "${NETDATA_INSTALL_PATH}/sbin" \
"${NETDATA_INSTALL_PATH}/usr/bin" \
"${NETDATA_INSTALL_PATH}/usr/sbin" \
"${NETDATA_INSTALL_PATH}/usr/local"
@@ -65,14 +103,16 @@ rm "${NETDATA_INSTALL_PATH}/sbin" \
# -----------------------------------------------------------------------------
# create the makeself archive
-"${NETDATA_MAKESELF_PATH}/makeself.sh" \
+run sed "s|NETDATA_VERSION|${FILE_VERSION}|g" <"${NETDATA_MAKESELF_PATH}/makeself.lsm" >"${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp"
+
+run "${NETDATA_MAKESELF_PATH}/makeself.sh" \
--gzip \
--complevel 9 \
--notemp \
--needroot \
--target "${NETDATA_INSTALL_PATH}" \
--header "${NETDATA_MAKESELF_PATH}/makeself-header.sh" \
- --lsm "${NETDATA_MAKESELF_PATH}/makeself.lsm" \
+ --lsm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" \
--license "${NETDATA_MAKESELF_PATH}/makeself-license.txt" \
--help-header "${NETDATA_MAKESELF_PATH}/makeself-help-header.txt" \
"${NETDATA_INSTALL_PATH}" \
@@ -81,41 +121,16 @@ rm "${NETDATA_INSTALL_PATH}/sbin" \
./system/post-installer.sh \
${NULL}
+run rm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp"
# -----------------------------------------------------------------------------
# copy it to the netdata build dir
-NOWNER="unknown"
-ORIGIN="$(git config --get remote.origin.url || echo "unknown")"
-if [[ "${ORIGIN}" =~ ^git@github.com:.*/netdata.*$ ]]
- then
- NOWNER="${ORIGIN/git@github.com:/}"
- NOWNER="${NOWNER/\/netdata*/}"
-
-elif [[ "${ORIGIN}" =~ ^https://github.com/.*/netdata.*$ ]]
- then
- NOWNER="${ORIGIN/https:\/\/github.com\//}"
- NOWNER="${NOWNER/\/netdata*/}"
-fi
-
-# make sure it does not have any slashes in it
-NOWNER="${NOWNER//\//_}"
-
-if [ "${NOWNER}" = "firehol" ]
- then
- NOWNER=
-else
- NOWNER="-${NOWNER}"
-fi
-
-VERSION="$(git describe || echo "undefined")"
-[ -z "${VERSION}" ] && VERSION="undefined"
-
-FILE="netdata-${VERSION}-$(uname -m)-$(date +"%Y%m%d-%H%M%S")${NOWNER}.gz.run"
+FILE="netdata-${FILE_VERSION}.gz.run"
-cp "${NETDATA_INSTALL_PATH}.gz.run" "${FILE}"
+run cp "${NETDATA_INSTALL_PATH}.gz.run" "${FILE}"
echo >&2 "Self-extracting installer copied to '${FILE}'"
[ -f netdata-latest.gz.run ] && rm netdata-latest.gz.run
-ln -s "${FILE}" netdata-latest.gz.run
+run ln -s "${FILE}" netdata-latest.gz.run
echo >&2 "Self-extracting installer linked to 'netdata-latest.gz.run'"