- data/scripts: remove some hardcoded paths

Conflicts:
	data/config/settingsupdate.conf.in
	data/scripts/backup.sh
	data/scripts/backup_flash.sh.in
	data/scripts/restore_flash.sh.in

Signed-off-by: Thilo Graf <dbt@novatux.de>

Files adapted because conflicts and possible build errors.
This commit is contained in:
svenhoefer
2020-11-26 00:46:21 +01:00
committed by Thilo Graf
parent f57fac5a5a
commit 37fb4e4e4f
7 changed files with 103 additions and 11 deletions

View File

@@ -1,3 +1,9 @@
EXTRA_DIST = \
backup.sh backup.sh.in \
restore.sh restore.sh.in \
backup_flash.sh backup_flash.sh.in \
restore_flash.sh restore_flash.sh.in
installdir = $(bindir)
install_SCRIPTS = \

4
data/scripts/backup.sh → data/scripts/backup.sh.in Executable file → Normal file
View File

@@ -4,7 +4,7 @@
HOST=$(hostname)
DATE=$(date +%Y%m%d_%H%M)
USRF="/var/tuxbox/config/tobackup.conf"
USRF="@CONFIGDIR@/tobackup.conf"
BAKF="$1/${2:-settings_${HOST}_${DATE}}.tar.gz"
if [ -e "${USRF}" ]; then
@@ -15,7 +15,7 @@ if [ -e "${USRF}" ]; then
done < $USRF
else
TOBACKUP="/var/tuxbox/config/"
TOBACKUP="@CONFIGDIR@/"
fi
# check existence

View File

@@ -0,0 +1,35 @@
#!/bin/sh
. /etc/init.d/globals
RES=""
VAR="/var/"
USRF="@CONFIGDIR@/tobackup.conf"
BAKF="/var/backup_flash.tar.gz"
TOBACKUP=""
SHOWINFO "backup to ${BAKF} ..."
if [ -e "${USRF}" ]; then
TOBACKUP="$TOBACKUP ${USRF}"
while read i
do [ "${i:0:1}" = "#" ] || TOBACKUP="$TOBACKUP ${i%%#*}"
done < $USRF
fi
# check existence and skip files in /var
for i in $TOBACKUP; do
if [ -e "$i" -a ${i:0:${#VAR}} != ${VAR} ]; then
SHOWINFO "add $i"
RES="$RES $i"
else
SHOWINFO "skip $i"
fi
done
TOBACKUP=$(echo $RES)
tar -czf "${BAKF}" $TOBACKUP 2>&1 >/dev/null
SHOWINFO "done."

View File

@@ -0,0 +1,15 @@
#!/bin/sh
. /etc/init.d/globals
BAKF="/var/backup_flash.tar.gz"
if [ -e ${BAKF} ]; then
SHOWINFO "restore settings from ${BAKF} ..."
cd / && tar -xzf "${BAKF}"
sync
rm -rf "${BAKF}"
SHOWINFO "done."
else
SHOWINFO "${BAKF} not found. nothing to restore!"
fi