@cryptotaxi247 / netdata-1 / commits / efb00d6d2

netdata/installer: fix static64 installer always overwriting configuration (#6710)

* netdata/packaging: static installer - back up configuration directory, if it already exists * netdata/packaging: keep more versions of it, we will consider how to consolidate too old ones * netdata/packaging: At the post install activities, if .old directory was in place, reinstate it (WIP) * netdata/packaging: Attempt to trigger stock config refresh * netdata/packaging: the .new directory is just the latest one, no need to keep it when re-running * netdata/packaging: dont do -f, its -d to confirm existence of dir

Paul Emm. Katsoulakis committed Aug 29, 2019 at 23:24 UTC efb00d6d2fb0e3894f491aba2993f59c2c076555
2 files changed +12
packaging/makeself/install-or-update.sh
+9
@@ -10,6 +10,15 @@ umask 002
10 renice 19 $$ >/dev/null 2>/dev/null
11
12 # -----------------------------------------------------------------------------
13 +if [ -d /opt/netdata/etc/netdata.old ]; then
14 + progress "Found old etc/netdata directory, reinstating this"
15 + [ -d /opt/netdata/etc/netdata.new ] && rm -rf /opt/netdata/etc/netdata.new
16 + mv -f /opt/netdata/etc/netdata /opt/netdata/etc/netdata.new
17 + mv -f /opt/netdata/etc/netdata.old /opt/netdata/etc/netdata
18 +
19 + progress "Trigger stock config clean up"
20 + rm -f /opt/netdata/etc/netdata/.installer-cleanup-of-stock-configs-done
21 +fi
22
23 STARTIT=1
24
packaging/makeself/makeself-header.sh
+3
@@ -438,6 +438,9 @@ if test x"\$nox11" = xn; then
438 fi
439 fi
440
441 +[ -d "\$targetdir/etc/netdata.old" ] && echo "Moving existing old directory" && mv "\$targetdir/etc/netdata.old" "\$targetdir/etc/netdata.old.$$"
442 +[ -d \$targetdir/etc/netdata ] && echo "Backing up existing directory" && cp -r \$targetdir/etc/netdata "\$targetdir/etc/netdata.old"
443 +
444 if test x"\$targetdir" = x.; then
445 tmpdir="."
446 else