summaryrefslogtreecommitdiffstats
path: root/makeself
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@tsaousis.gr>2018-09-27 20:37:52 +0300
committerGitHub <noreply@github.com>2018-09-27 20:37:52 +0300
commit73608f86b4c10f72fff991fbf9bfa1a802c2d95c (patch)
tree56001d6001f5e388ff2eea8cd41a35f9e7d1b598 /makeself
parenta440a24688f2258bba3ac2e7bbd57c112581893d (diff)
stock configs in /usr/lib/netdata (#4283)
* makefiles install configs in /usr/lib/netdata/conf.d; #4182 * stock health config in /usr/lib/netdata/conf.d/health.d * unit test path concatenation * simplified health file management * use stream.conf from stock config if it does not exist in /etc/netdata * indicate loading of user config in function call * load netdata.conf from stock dir if not found in /etc/netdata * added NETDATA_USER_CONFIG_DIR * provide defaults before loading config * charts.d uses stock files * fping now uses the stock config files * tc-qos-helper.sh now uses stock configs * cgroup-name.sh now uses stock configs too * simplified cgroup-name.sh for user and stock config * alarm-notify.sh uses stock configs too * simplified fping plugin configs loading * simplified tc-qos-helper.sh configs loading * added error handling to charts.d.plugin * apps.plugin used stock configs * generalized recursive double-directory configs loading * statsd uses stock configs * node.d.plugin uses stock configs * compile-time decision of netdata default paths for all files * makeself cleans up old stock config files from user configuration directories * fixed makeself typo * netdata-installer.sh removes stock files from user configuration directories * python.d.plugin user/stock configs update * cleanup stock config files from /etc/netdata, only once * python.d.plugin log loaded files * fix permissions of stock config files and provide an "orig" link for quick access * create help link on stock configs migration for static installations * create user config directories * example statsd synthetic charts now state they are examples * updated configs.signatures * spec file * fixes in spec file * fix typo * install netdata after cleaning up stock configs from /etc/netdata * python.d: add cpuidle stock conf
Diffstat (limited to 'makeself')
-rwxr-xr-xmakeself/install-or-update.sh97
-rwxr-xr-xmakeself/jobs/70-netdata-git.install.sh7
-rwxr-xr-xmakeself/jobs/99-makeself.install.sh21
3 files changed, 52 insertions, 73 deletions
diff --git a/makeself/install-or-update.sh b/makeself/install-or-update.sh
index 6ff03acc09..ce9ca62023 100755
--- a/makeself/install-or-update.sh
+++ b/makeself/install-or-update.sh
@@ -24,62 +24,49 @@ do
shift
done
+deleted_stock_configs=0
+if [ ! -f "etc/netdata/.installer-cleanup-of-stock-configs-done" ]
+then
-# -----------------------------------------------------------------------------
-progress "Checking new configuration files"
-
-declare -A configs_signatures=()
-. system/configs.signatures
-
-if [ ! -d etc/netdata ]
- then
- run mkdir -p etc/netdata
-fi
-
-md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null || command -v md5 2>/dev/null)"
-for x in $(find etc.new -type f)
-do
- # find it relative filename
- f="${x/etc.new\/netdata\//}"
- t="${x/etc.new\//etc\/}"
- d=$(dirname "${t}")
+ # -----------------------------------------------------------------------------
+ progress "Deleting stock configuration files from user configuration directory"
- #echo >&2 "x: ${x}"
- #echo >&2 "t: ${t}"
- #echo >&2 "d: ${d}"
+ declare -A configs_signatures=()
+ source "system/configs.signatures"
- if [ ! -d "${d}" ]
+ if [ ! -d etc/netdata ]
then
- run mkdir -p "${d}"
+ run mkdir -p etc/netdata
fi
- if [ ! -f "${t}" ]
- then
- run cp "${x}" "${t}"
- continue
- fi
+ md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null || command -v md5 2>/dev/null)"
+ for x in $(find etc -type f)
+ do
+ # find it relative filename
+ f="${x/etc\/netdata\//}"
- if [ ! -z "${md5sum}" ]
- then
- # find the checksum of the existing file
- md5="$(cat "${t}" | ${md5sum} | cut -d ' ' -f 1)"
- #echo >&2 "md5: ${md5}"
+ # find the stock filename
+ t="${f/.conf.old/.conf}"
+ t="${t/.conf.orig/.conf}"
- # check if it matches
- if [ "${configs_signatures[${md5}]}" = "${f}" ]
+ if [ ! -z "${md5sum}" ]
then
- run cp "${x}" "${t}"
+ # find the checksum of the existing file
+ md5="$( ${md5sum} <"${x}" | cut -d ' ' -f 1)"
+ #echo >&2 "md5: ${md5}"
+
+ # check if it matches
+ if [ "${configs_signatures[${md5}]}" = "${t}" ]
+ then
+ # it matches the default
+ run rm -f "${x}"
+ deleted_stock_configs=$(( deleted_stock_configs + 1 ))
+ fi
fi
- fi
-
- if ! [[ "${x}" =~ .*\.orig ]]
- then
- run mv "${x}" "${t}.orig"
- fi
-done
-
-run rm -rf etc.new
+ done
+ touch "etc/netdata/.installer-cleanup-of-stock-configs-done"
+fi
# -----------------------------------------------------------------------------
progress "Add user netdata to required user groups"
@@ -166,6 +153,26 @@ dir_should_be_link . var/lib/netdata netdata-dbs
dir_should_be_link . var/cache/netdata netdata-metrics
dir_should_be_link . var/log/netdata netdata-logs
+dir_should_be_link etc/netdata ../../usr/lib/netdata/conf.d orig
+
+if [ ${deleted_stock_configs} -gt 0 ]
+then
+ dir_should_be_link etc/netdata ../../usr/lib/netdata/conf.d "000.-.USE.THE.orig.LINK.TO.COPY.AND.EDIT.STOCK.CONFIG.FILES"
+fi
+
+
+# -----------------------------------------------------------------------------
+
+progress "create user config directories"
+
+for x in "python.d" "charts.d" "node.d" "health.d" "statsd.d"
+do
+ if [ ! -d "etc/netdata/${x}" ]
+ then
+ run mkdir -p "etc/netdata/${x}" || exit 1
+ fi
+done
+
# -----------------------------------------------------------------------------
progress "fix permissions"
diff --git a/makeself/jobs/70-netdata-git.install.sh b/makeself/jobs/70-netdata-git.install.sh
index ca1143045e..cb28dd080f 100755
--- a/makeself/jobs/70-netdata-git.install.sh
+++ b/makeself/jobs/70-netdata-git.install.sh
@@ -13,13 +13,6 @@ else
# export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness"
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 \
diff --git a/makeself/jobs/99-makeself.install.sh b/makeself/jobs/99-makeself.install.sh
index ba1c46fb5d..0b828257d5 100755
--- a/makeself/jobs/99-makeself.install.sh
+++ b/makeself/jobs/99-makeself.install.sh
@@ -73,27 +73,6 @@ run chmod 755 "${NETDATA_INSTALL_PATH}/bin/netdata"
# -----------------------------------------------------------------------------
-# move etc to protect the destination when unpacked
-
-if [ ! -z "${NETDATA_INSTALL_PATH}" -a -d "${NETDATA_INSTALL_PATH}/etc" ]
- then
- if [ -d "${NETDATA_INSTALL_PATH}/etc.new" ]
- then
- run rm -rf "${NETDATA_INSTALL_PATH}/etc.new" || exit 1
- fi
-
- 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
run rm "${NETDATA_INSTALL_PATH}/sbin" \