Files
recycled-ni-neutrino/data/scripts/backup.sh.in
vanhofen 7f435a1032 data/scripts/backup: don't backup /var/log if it is not a directory
Origin commit data
------------------
Branch: ni/coolstream
Commit: c3abfa581f
Author: vanhofen <vanhofen@gmx.de>
Date: 2023-10-05 (Thu, 05 Oct 2023)

Origin message was:
------------------
- data/scripts/backup: don't backup /var/log if it is not a directory

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
2023-10-05 21:00:00 +02:00

100 lines
1.9 KiB
Bash

#!/bin/sh
. /etc/init.d/globals
HOST=$(hostname)
DATE=$(date +%Y%m%d_%H%M)
USRF="@CONFIGDIR@/tobackup.conf"
BAKF="$1/${2:-settings_${HOST}_${DATE}}.tar.gz"
TOBACKUP="\
@CONFIGDIR@/settingsupdate.conf \
\
@CONFIGDIR@/neutrino.conf \
@CONFIGDIR@/moviebrowser.conf \
@CONFIGDIR@/radio-favorites.xml \
@CONFIGDIR@/scan.conf \
@CONFIGDIR@/timerd.conf \
@CONFIGDIR@/weather-favorites.xml \
@CONFIGDIR@/yWeb.conf \
\
@CONFIGDIR@/doscam.* \
@CONFIGDIR@/oscam.* \
@CONFIGDIR@/ncam.* \
\
@CONFIGDIR@/FritzCallMonitor.addr \
@CONFIGDIR@/FritzCallMonitor.cfg \
@CONFIGDIR@/auto-record-cleaner.* \
@CONFIGDIR@/neutrino-mediathek.conf \
@CONFIGDIR@/oscammon.conf \
@CONFIGDIR@/plugins-hide.conf \
@CONFIGDIR@/pr-auto-timer.* \
@CONFIGDIR@/smarthomeinfo.conf \
@CONFIGDIR@/tuxcal/ \
@CONFIGDIR@/tuxcom/ \
@CONFIGDIR@/tuxmail/ \
@CONFIGDIR@/tuxtxt/tuxtxt2.conf \
@CONFIGDIR@/tuxwetter/tuxwetter.conf \
@CONFIGDIR@/tuxwetter/tuxwetter.mcfg \
\
@ZAPITDIR@/ \
\
@FLAGDIR@/ \
\
/var/bin/ \
/var/keys/ \
/var/root/ \
/var/xupnpd/ \
\
/etc/exports \
/etc/hostname \
/etc/hosts \
/etc/network/interfaces \
/etc/passwd \
/etc/profile.local \
/etc/rc.local \
/etc/resolv.conf \
/etc/samba/smb.conf \
/etc/wpa_supplicant.conf \
\
@DATADIR_VAR@/flex/flex_usr.conf \
\
@CONTROLDIR_VAR@/ \
@FONTDIR_VAR@/ \
@ICONSDIR_VAR@/ \
@LOCALEDIR_VAR@/ \
@LUAPLUGINDIR_VAR@/ \
@PLUGINDIR_VAR@/ \
@PUBLIC_HTTPDDIR@/ \
@THEMESDIR_VAR@/ \
@WEBRADIODIR_VAR@/ \
@WEBTVDIR_VAR@/ \
"
# add /var/log if it is a directory
if [ -d /var/log/ ]; then
TOBACKUP="$TOBACKUP /var/log/"
fi
# add tobackup.conf and its content
if [ -e "${USRF}" ]; then
TOBACKUP="$TOBACKUP ${USRF}"
while read i
do [ "${i:0:1}" = "#" ] || TOBACKUP="$TOBACKUP ${i%%#*}"
done < $USRF
fi
SHOWINFO "backup to ${BAKF} ..."
# check existence
RES=""
for i in $TOBACKUP
do [ -e "$i" ] && RES="$RES $i"
done
TOBACKUP=$(echo $RES)
tar -czf "${BAKF}" $TOBACKUP 2>&1 >/dev/null
SHOWINFO "done."