Added option to include lost+found directory

This commit is contained in:
Dave Kennedy 2016-02-17 22:45:51 -07:00
parent 9b160a089e
commit 4bdf2a8df5

View file

@ -10,18 +10,20 @@ fi
#set flag variables to null
EXCLUDE_BOOT=0
EXCLUDE_CONNMAN=0
EXCLUDE_LOST=1
QUIET=0
USAGE="usage:\n\
`basename $0` [-q -c -b] [-s || -t <target-mountpoint>] <archive-filename> [custom-tar-options]\n\
-q: activates quiet mode (no confirmation).\n\
-c: excludes connman network lists.\n\
-b: excludes boot directory.\n\
-l: includes lost+found directory.\n\
-s: makes tarball of current system.\n\
-t: makes tarball of system located at the <target-mountpoint>.\n\
-h: displays help message."
# reads options:
while getopts ':t:sqcbh' flag; do
while getopts ':t:sqcblh' flag; do
case "${flag}" in
t)
TARGET="$OPTARG"
@ -38,6 +40,9 @@ while getopts ':t:sqcbh' flag; do
b)
EXCLUDE_BOOT=1
;;
l)
EXCLUDE_LOST=0
;;
h)
echo -e "$USAGE"
exit 0
@ -93,7 +98,6 @@ shift;OPTIONS="$@"
EXCLUDES="\
--exclude=.bash_history \
--exclude=dev/* \
--exclude=lost+found/* \
--exclude=media/* \
--exclude=mnt/*/* \
--exclude=proc/* \
@ -120,6 +124,11 @@ then
EXCLUDES+=" --exclude=boot/*"
fi
if [ ${EXCLUDE_LOST} -eq 1 ]
then
EXCLUDES+=" --exclude=lost+found"
fi
# Generic tar options:
TAR_OPTIONS="-cjpP --ignore-failed-read -f"