summaryrefslogtreecommitdiffstats
path: root/makeself/jobs/99-makeself.install.sh
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2017-12-19 23:39:21 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2017-12-19 23:39:21 +0000
commit61aedf201c2c4bf0e5aa4db32e74f4d860b88593 (patch)
treebcf4f9a0cd8bc2daf38b2ff9f29bfcc1e5ed8968 /makeself/jobs/99-makeself.install.sh
parentNew upstream version 1.8.0+dfsg (diff)
downloadnetdata-61aedf201c2c4bf0e5aa4db32e74f4d860b88593.tar.xz
netdata-61aedf201c2c4bf0e5aa4db32e74f4d860b88593.zip
New upstream version 1.9.0+dfsgupstream/1.9.0+dfsg
Diffstat (limited to 'makeself/jobs/99-makeself.install.sh')
-rwxr-xr-xmakeself/jobs/99-makeself.install.sh95
1 files changed, 55 insertions, 40 deletions
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'"