From 4bdf2a8df5198dbf0e5907f8f8fe2346ba491a9f Mon Sep 17 00:00:00 2001 From: Dave Kennedy Date: Wed, 17 Feb 2016 22:45:51 -0700 Subject: [PATCH] Added option to include lost+found directory --- mkstage4.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mkstage4.sh b/mkstage4.sh index 9443d66..df92b7f 100755 --- a/mkstage4.sh +++ b/mkstage4.sh @@ -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 ] [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 .\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"