diff --git a/data/Makefile.am b/data/Makefile.am index 073eb4e4e..f5f5e5cf1 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -5,4 +5,4 @@ SUBDIRS += lcd endif configdir = $(CONFIGDIR) -config_DATA = cables.xml satellites.xml encoding.conf +config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf diff --git a/data/scripts/Makefile.am b/data/scripts/Makefile.am index bc25d0711..9b1482f2e 100644 --- a/data/scripts/Makefile.am +++ b/data/scripts/Makefile.am @@ -3,8 +3,7 @@ installdir = $(bindir) install_DATA = \ backup.sh \ restore.sh \ - install.sh \ - backup.list + install.sh install-data-hook: chmod 0755 $(DESTDIR)$(bindir)/backup.sh diff --git a/data/scripts/backup.list b/data/scripts/backup.list deleted file mode 100644 index b17e3fc10..000000000 --- a/data/scripts/backup.list +++ /dev/null @@ -1,3 +0,0 @@ -/bin/backup.sh -/bin/backup.list -/var/tuxbox/config/ diff --git a/data/scripts/backup.sh b/data/scripts/backup.sh index fabc992b0..5bc2ae37d 100755 --- a/data/scripts/backup.sh +++ b/data/scripts/backup.sh @@ -1,12 +1,26 @@ #!/bin/sh -DATE=`date +%Y-%m-%d-%H:%M:%S` -BACKUPLIST=/bin/backup.list + +DATE=$(date +%Y-%m-%d_%H-%M-%S) +USRF="/var/tuxbox/config/tobackup.conf" + +if [ -e "${USRF}" ]; then +# read user-files from $USRF + while read i + do [ "${i:0:1}" = "#" ] || TOBACKUP="$TOBACKUP ${i%%#*}" + done < $USRF + +else + TOBACKUP="/var/tuxbox/config/" +fi + +# check existence +RES="" +for i in $TOBACKUP + do [ -e "$i" ] && RES="$RES $i" + done + +TOBACKUP=$(echo $RES) echo Backup to $1/settings_$DATE.tar -cd / -if [ ! -e $BACKUPLIST ]; then - tar cf $1/settings_$DATE.tar /var/tuxbox/config/ -else - tar cf $1/settings_$DATE.tar -T $BACKUPLIST -fi +tar -cf $1/settings_$DATE.tar $TOBACKUP diff --git a/data/tobackup.conf b/data/tobackup.conf new file mode 100644 index 000000000..4b5522b45 --- /dev/null +++ b/data/tobackup.conf @@ -0,0 +1,6 @@ +# enter stuff you want to backup here. +# one file or directory per line +# +# /var/etc/rcS.local # an example for a single file +# /var/tuxbox/config/tuxtxt/ # an example for a complete directory +/var/tuxbox/config/ # old default