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
This commit is contained in:
vanhofen
2023-10-05 21:00:00 +02:00
parent ac3e287734
commit 7f435a1032
2 changed files with 10 additions and 4 deletions

View File

@@ -43,7 +43,6 @@ TOBACKUP="\
\ \
/var/bin/ \ /var/bin/ \
/var/keys/ \ /var/keys/ \
/var/log/ \
/var/root/ \ /var/root/ \
/var/xupnpd/ \ /var/xupnpd/ \
\ \
@@ -72,8 +71,12 @@ TOBACKUP="\
@WEBTVDIR_VAR@/ \ @WEBTVDIR_VAR@/ \
" "
SHOWINFO "backup to ${BAKF} ..." # 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 if [ -e "${USRF}" ]; then
TOBACKUP="$TOBACKUP ${USRF}" TOBACKUP="$TOBACKUP ${USRF}"
while read i while read i
@@ -81,6 +84,8 @@ if [ -e "${USRF}" ]; then
done < $USRF done < $USRF
fi fi
SHOWINFO "backup to ${BAKF} ..."
# check existence # check existence
RES="" RES=""
for i in $TOBACKUP for i in $TOBACKUP

View File

@@ -9,8 +9,7 @@ BAKF="/var/backup_flash.tar.gz"
TOBACKUP="" TOBACKUP=""
SHOWINFO "backup to ${BAKF} ..." # add tobackup.conf and its content
if [ -e "${USRF}" ]; then if [ -e "${USRF}" ]; then
TOBACKUP="$TOBACKUP ${USRF}" TOBACKUP="$TOBACKUP ${USRF}"
while read i while read i
@@ -18,6 +17,8 @@ if [ -e "${USRF}" ]; then
done < $USRF done < $USRF
fi fi
SHOWINFO "backup to ${BAKF} ..."
# check existence and skip files in /var # check existence and skip files in /var
for i in $TOBACKUP; do for i in $TOBACKUP; do
if [ -e "$i" -a ${i:0:${#VAR}} != ${VAR} ]; then if [ -e "$i" -a ${i:0:${#VAR}} != ${VAR} ]; then