From 085402eca390a2b7d172d1d3b78a60ddd190bc8c Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 6 Dec 2011 13:33:26 +0000 Subject: [PATCH] backup.sh: rename backup.list to tobackup.conf & move to /var/tuxbox/config/t (thx svenhoefer) git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1948 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1922213fc4552351161b445ce8297842859f502f Author: Jacek Jendrzej Date: 2011-12-06 (Tue, 06 Dec 2011) ------------------ This commit was generated by Migit --- data/Makefile.am | 2 +- data/scripts/Makefile.am | 3 +-- data/scripts/backup.list | 3 --- data/scripts/backup.sh | 30 ++++++++++++++++++++++-------- data/tobackup.conf | 6 ++++++ 5 files changed, 30 insertions(+), 14 deletions(-) delete mode 100644 data/scripts/backup.list create mode 100644 data/tobackup.conf 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