improve exit code use in bin scripts
The use of exit codes and exit code ranges has been made more consistent across most bin tools.
This commit is contained in:
1 parent
de0619a8b6
commit
09b8de5081
21 files changed
+1071
-1164
No files matched your search
+78
-80
@@ -49,7 +49,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
|
||||
|
||||
# set variables referenced in the usage message
|
||||
#
|
||||
export VERSION="1.0 2024-02-17"
|
||||
export VERSION="1.0.1 2024-02-23"
|
||||
NAME=$(basename "$0")
|
||||
export NAME
|
||||
export V_FLAG=0
|
||||
@@ -57,7 +57,7 @@ GIT_TOOL=$(type -P git)
|
||||
export GIT_TOOL
|
||||
if [[ -z "$GIT_TOOL" ]]; then
|
||||
echo "$0: FATAL: git tool is not installed or not in \$PATH" 1>&2
|
||||
exit 210
|
||||
exit 5
|
||||
fi
|
||||
"$GIT_TOOL" rev-parse --is-inside-work-tree >/dev/null 2>&1
|
||||
status="$?"
|
||||
@@ -71,7 +71,7 @@ GTAR_TOOL=$(type -P gtar)
|
||||
export GTAR_TOOL
|
||||
if [[ -z "$GIT_TOOL" ]]; then
|
||||
echo "$0: FATAL: gtar (gnu tar) tool is not installed or not in \$PATH" 1>&2
|
||||
exit 9
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# set usage message
|
||||
@@ -101,17 +101,15 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
|
||||
|
||||
Exit codes:
|
||||
0 all OK
|
||||
1 a file listed in .entry.json or .filelist is missing and -W was not used, or no files were found
|
||||
1 some internal tool exited non-zero
|
||||
2 -h and help string printed or -V and version string printed
|
||||
3 command line error
|
||||
4 bash version is < 4.2
|
||||
5 YYYY/dir is not a entry directory, or YYYY is not an IOCCC year
|
||||
6 bin/filelist.entry.json.awk is not a non-empty readable file
|
||||
7 error in trying to determine files used by the year
|
||||
8 missing critical top level file or missing .filelist file
|
||||
9 gnu tar is missing or execution failed
|
||||
>= 10 < 210 ((not used))
|
||||
>= 210 internal tool error
|
||||
5 some internal tool is not found or not an executable file
|
||||
6 problems found with or in the topdir or topdir/YYYY directory
|
||||
7 problems found with or in the entry topdir/YYYY/dir directory
|
||||
8 gnu tar is missing or execution failed or error in forming compressed tarball
|
||||
>= 10 internal error
|
||||
|
||||
$NAME version: $VERSION"
|
||||
|
||||
@@ -189,37 +187,28 @@ export REPO_NAME
|
||||
if [[ -z $TOPDIR ]]; then
|
||||
echo "$0: ERROR: cannot find top of git repo directory" 1>&2
|
||||
echo "$0: Notice: if needed: $GIT_TOOL clone $REPO_URL; cd $REPO_NAME" 1>&2
|
||||
exit 220
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -e $TOPDIR ]]; then
|
||||
echo "$0: ERROR: TOPDIR does not exist: $TOPDIR" 1>&2
|
||||
echo "$0: Notice: if needed: $GIT_TOOL clone $REPO_URL; cd $REPO_NAME" 1>&2
|
||||
exit 221
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -d $TOPDIR ]]; then
|
||||
echo "$0: ERROR: TOPDIR is not a directory: $TOPDIR" 1>&2
|
||||
echo "$0: Notice: if needed: $GIT_TOOL clone $REPO_URL; cd $REPO_NAME" 1>&2
|
||||
exit 222
|
||||
exit 6
|
||||
fi
|
||||
|
||||
# verify that we have an bin subdirectory
|
||||
#
|
||||
export BIN_PATH="$TOPDIR/bin"
|
||||
if [[ ! -d $BIN_PATH ]]; then
|
||||
echo "$0: ERROR: bin is not a directory under topdir: $BIN_PATH" 1>&2
|
||||
exit 223
|
||||
fi
|
||||
export BIN_DIR="bin"
|
||||
|
||||
# cd to topdir
|
||||
#
|
||||
if [[ ! -e $TOPDIR ]]; then
|
||||
echo "$0: ERROR: cannot cd to non-existent path: $TOPDIR" 1>&2
|
||||
exit 224
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -d $TOPDIR ]]; then
|
||||
echo "$0: ERROR: cannot cd to a non-directory: $TOPDIR" 1>&2
|
||||
exit 225
|
||||
exit 6
|
||||
fi
|
||||
export CD_FAILED
|
||||
if [[ $V_FLAG -ge 5 ]]; then
|
||||
@@ -228,12 +217,21 @@ fi
|
||||
cd "$TOPDIR" || CD_FAILED="true"
|
||||
if [[ -n $CD_FAILED ]]; then
|
||||
echo "$0: ERROR: cd $TOPDIR failed" 1>&2
|
||||
exit 226
|
||||
exit 6
|
||||
fi
|
||||
if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
|
||||
fi
|
||||
|
||||
# verify that we have an bin subdirectory
|
||||
#
|
||||
export BIN_PATH="$TOPDIR/bin"
|
||||
if [[ ! -d $BIN_PATH ]]; then
|
||||
echo "$0: ERROR: bin is not a directory under topdir: $BIN_PATH" 1>&2
|
||||
exit 6
|
||||
fi
|
||||
export BIN_DIR="bin"
|
||||
|
||||
# determine the name of our tarball
|
||||
#
|
||||
export TARBALL="$YYYY/$YYYY.tar.bz2"
|
||||
@@ -243,19 +241,19 @@ export TARBALL="$YYYY/$YYYY.tar.bz2"
|
||||
export FILELIST_ENTRY_JSON_AWK="$BIN_DIR/filelist.entry.json.awk"
|
||||
if [[ ! -e $FILELIST_ENTRY_JSON_AWK ]]; then
|
||||
echo "$0: ERROR: filelist.entry.json.awk does not exist: $FILELIST_ENTRY_JSON_AWK" 1>&2
|
||||
exit 6
|
||||
exit 5
|
||||
fi
|
||||
if [[ ! -f $FILELIST_ENTRY_JSON_AWK ]]; then
|
||||
echo "$0: ERROR: filelist.entry.json.awk is not a file: $FILELIST_ENTRY_JSON_AWK" 1>&2
|
||||
exit 6
|
||||
exit 5
|
||||
fi
|
||||
if [[ ! -r $FILELIST_ENTRY_JSON_AWK ]]; then
|
||||
echo "$0: ERROR: filelist.entry.json.awk is not a readable file: $FILELIST_ENTRY_JSON_AWK" 1>&2
|
||||
exit 6
|
||||
exit 5
|
||||
fi
|
||||
if [[ ! -s $FILELIST_ENTRY_JSON_AWK ]]; then
|
||||
echo "$0: ERROR: filelist.entry.json.awk is not a not a non-empty readable file: $FILELIST_ENTRY_JSON_AWK" 1>&2
|
||||
exit 6
|
||||
exit 5
|
||||
fi
|
||||
|
||||
# verify we have non-empty readable ioccc.css file
|
||||
@@ -263,19 +261,19 @@ fi
|
||||
export IOCCC_CSS="ioccc.css"
|
||||
if [[ ! -e $IOCCC_CSS ]]; then
|
||||
echo "$0: ERROR: ioccc.css does not exist: $IOCCC_CSS" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -f $IOCCC_CSS ]]; then
|
||||
echo "$0: ERROR: ioccc.css is not a file: $IOCCC_CSS" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -r $IOCCC_CSS ]]; then
|
||||
echo "$0: ERROR: ioccc.css is not a readable file: $IOCCC_CSS" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -s $IOCCC_CSS ]]; then
|
||||
echo "$0: ERROR: ioccc.css is not a not a non-empty readable file: $IOCCC_CSS" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
|
||||
# verify we have non-empty readable ioccc.css file
|
||||
@@ -283,19 +281,19 @@ fi
|
||||
export VAR_MK="var.mk"
|
||||
if [[ ! -e $VAR_MK ]]; then
|
||||
echo "$0: ERROR: var.mk does not exist: $VAR_MK" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -f $VAR_MK ]]; then
|
||||
echo "$0: ERROR: var.mk is not a file: $VAR_MK" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -r $VAR_MK ]]; then
|
||||
echo "$0: ERROR: var.mk is not a readable file: $VAR_MK" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -s $VAR_MK ]]; then
|
||||
echo "$0: ERROR: var.mk is not a not a non-empty readable file: $VAR_MK" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
|
||||
# verify we have non-empty readable year level .filelist file
|
||||
@@ -303,19 +301,19 @@ fi
|
||||
export FILELIST="$YYYY/.filelist"
|
||||
if [[ ! -e $FILELIST ]]; then
|
||||
echo "$0: ERROR: .filelist for $YYYY does not exist: $FILELIST" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -f $FILELIST ]]; then
|
||||
echo "$0: ERROR: .filelist for $YYYY is not a file: $FILELIST" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -r $FILELIST ]]; then
|
||||
echo "$0: ERROR: .filelist for $YYYY is not a readable file: $FILELIST" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -s $FILELIST ]]; then
|
||||
echo "$0: ERROR: .filelist for $YYYY is not a not a non-empty readable file: $FILELIST" 1>&2
|
||||
exit 8
|
||||
exit 6
|
||||
fi
|
||||
|
||||
# parameter debugging
|
||||
@@ -363,12 +361,12 @@ if [[ -z $NOOP ]]; then
|
||||
rm -f "$TMP_MANIFEST_LIST"
|
||||
if [[ -e $TMP_MANIFEST_LIST ]]; then
|
||||
echo "$0: ERROR: cannot remove temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2
|
||||
exit 227
|
||||
exit 10
|
||||
fi
|
||||
:> "$TMP_MANIFEST_LIST"
|
||||
if [[ ! -e $TMP_MANIFEST_LIST ]]; then
|
||||
echo "$0: ERROR: cannot create temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2
|
||||
exit 228
|
||||
exit 11
|
||||
fi
|
||||
elif [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: because of -n, temporary file manifest list is not used: $TMP_MANIFEST_LIST" 1>&2
|
||||
@@ -385,12 +383,12 @@ if [[ -z $NOOP ]]; then
|
||||
rm -f "$TMP_TAR_LIST"
|
||||
if [[ -e $TMP_TAR_LIST ]]; then
|
||||
echo "$0: ERROR: cannot remove temporary file tar list: $TMP_TAR_LIST" 1>&2
|
||||
exit 231
|
||||
exit 12
|
||||
fi
|
||||
:> "$TMP_TAR_LIST"
|
||||
if [[ ! -e $TMP_TAR_LIST ]]; then
|
||||
echo "$0: ERROR: cannot create temporary file tar list: $TMP_TAR_LIST" 1>&2
|
||||
exit 232
|
||||
exit 13
|
||||
fi
|
||||
elif [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: because of -n, temporary file tar list is not used: $TMP_TAR_LIST" 1>&2
|
||||
@@ -410,12 +408,12 @@ if [[ -z $NOOP ]]; then
|
||||
rm -f "$TMP_EXIT_CODE"
|
||||
if [[ -e $TMP_EXIT_CODE ]]; then
|
||||
echo "$0: ERROR: cannot remove temporary exit code: $TMP_EXIT_CODE" 1>&2
|
||||
exit 233
|
||||
exit 14
|
||||
fi
|
||||
echo "$EXIT_CODE" > "$TMP_EXIT_CODE"
|
||||
if [[ ! -e $TMP_EXIT_CODE ]]; then
|
||||
echo "$0: ERROR: cannot create temporary exit code: $TMP_EXIT_CODE" 1>&2
|
||||
exit 234
|
||||
exit 15
|
||||
fi
|
||||
elif [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: because of -n, temporary exit code is not used: $TMP_EXIT_CODE" 1>&2
|
||||
@@ -432,12 +430,12 @@ if [[ -z $NOOP ]]; then
|
||||
rm -f "$TMP_TARBALL"
|
||||
if [[ -e $TMP_TARBALL ]]; then
|
||||
echo "$0: ERROR: cannot remove temporary tarball: $TMP_TARBALL" 1>&2
|
||||
exit 231
|
||||
exit 16
|
||||
fi
|
||||
:> "$TMP_TARBALL"
|
||||
if [[ ! -e $TMP_TARBALL ]]; then
|
||||
echo "$0: ERROR: cannot create temporary tarball: $TMP_TARBALL" 1>&2
|
||||
exit 232
|
||||
exit 17
|
||||
fi
|
||||
elif [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: because of -n, temporary tarball is not used: $TMP_TARBALL" 1>&2
|
||||
@@ -461,15 +459,15 @@ if [[ -z $NOOP ]]; then
|
||||
#
|
||||
if [[ ! -e $YYYY ]]; then
|
||||
echo "$0: ERROR: YYYY does not exist: $YYYY" 1>&2
|
||||
exit 7
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -d $YYYY ]]; then
|
||||
echo "$0: ERROR: YYYY is not a directory: $YYYY" 1>&2
|
||||
exit 7
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -r $YYYY ]]; then
|
||||
echo "$0: ERROR: YYYY is not an readable directory: $YYYY" 1>&2
|
||||
exit 7
|
||||
exit 6
|
||||
fi
|
||||
|
||||
# verify that YYYY has a non-empty readable .year file
|
||||
@@ -477,19 +475,19 @@ if [[ -z $NOOP ]]; then
|
||||
export YEAR_FILE="$YYYY/.year"
|
||||
if [[ ! -e $YEAR_FILE ]]; then
|
||||
echo "$0: ERROR: YYYY/.year does not exist: $YEAR_FILE" 1>&2
|
||||
exit 7
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -f $YEAR_FILE ]]; then
|
||||
echo "$0: ERROR: YYYY/.year is not a regular file: $YEAR_FILE" 1>&2
|
||||
exit 7
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -r $YEAR_FILE ]]; then
|
||||
echo "$0: ERROR: YYYY/.year is not an readable file: $YEAR_FILE" 1>&2
|
||||
exit 7
|
||||
exit 6
|
||||
fi
|
||||
if [[ ! -s $YEAR_FILE ]]; then
|
||||
echo "$0: ERROR: YYYY/.year is not a non-empty readable file: $YEAR_FILE" 1>&2
|
||||
exit 7
|
||||
exit 6
|
||||
fi
|
||||
|
||||
# process each entry directory under YYYY
|
||||
@@ -507,33 +505,33 @@ if [[ -z $NOOP ]]; then
|
||||
#
|
||||
if [[ ! -d $YYYY_DIR ]]; then
|
||||
echo "$0: ERROR: YYYY_DIR is not a directory: $YYYY_DIR" 1>&2
|
||||
EXIT_CODE="7" # exit 7
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
if [[ ! -w $YYYY_DIR ]]; then
|
||||
echo "$0: ERROR: YYYY_DIR is not a writable directory: $YYYY_DIR" 1>&2
|
||||
EXIT_CODE="7" # exit 7
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
export YEAR_DIR=${YYYY_DIR%%/*}
|
||||
if [[ -z $YEAR_DIR ]]; then
|
||||
echo "$0: ERROR: YYYY_DIR not in YYYY/dir form: $YYYY_DIR" 1>&2
|
||||
EXIT_CODE="7" # exit 7
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
export ENTRY_DIR=${YYYY_DIR#*/}
|
||||
if [[ -z $ENTRY_DIR ]]; then
|
||||
echo "$0: ERROR: YYYY_DIR not in $YEAR_DIR/dir form: $YYYY_DIR" 1>&2
|
||||
EXIT_CODE="7" # exit 7
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
if [[ $ENTRY_DIR = */* ]]; then
|
||||
echo "$0: ERROR: YYYY_DIR: $YYYY_DIR dir contains a /: $ENTRY_DIR" 1>&2
|
||||
EXIT_CODE="7" # exit 7
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
@@ -542,19 +540,19 @@ if [[ -z $NOOP ]]; then
|
||||
#
|
||||
if [[ ! -e $YYYY_DIR ]]; then
|
||||
echo "$0: ERROR: YYYY_DIR does not exist: $YYYY_DIR" 1>&2
|
||||
EXIT_CODE="8" # exit 8
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
if [[ ! -d $YYYY_DIR ]]; then
|
||||
echo "$0: ERROR: YYYY_DIR is not a directory: $YYYY_DIR" 1>&2
|
||||
EXIT_CODE="8" # exit 8
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
if [[ ! -w $YYYY_DIR ]]; then
|
||||
echo "$0: ERROR: YYYY_DIR is not an writable directory: $YYYY_DIR" 1>&2
|
||||
EXIT_CODE="8" # exit 8
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
@@ -564,33 +562,33 @@ if [[ -z $NOOP ]]; then
|
||||
export DOT_PATH="$YYYY_DIR/.path"
|
||||
if [[ ! -s $DOT_PATH ]]; then
|
||||
echo "$0: ERROR: not a non-empty file: $DOT_PATH" 1>&2
|
||||
EXIT_CODE="8" # exit 8
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
DOT_PATH_CONTENT=$(< "$DOT_PATH")
|
||||
if [[ $YYYY_DIR != "$DOT_PATH_CONTENT" ]]; then
|
||||
echo "$0: ERROR: arg: $YYYY_DIR does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
|
||||
EXIT_CODE="8" # exit 8
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
export ENTRY_JSON="$YYYY_DIR/.entry.json"
|
||||
if [[ ! -e $ENTRY_JSON ]]; then
|
||||
echo "$0: ERROR: .entry.json does not exist: $ENTRY_JSON" 1>&2
|
||||
EXIT_CODE="8" # exit 8
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
if [[ ! -f $ENTRY_JSON ]]; then
|
||||
echo "$0: ERROR: .entry.json is not a file: $ENTRY_JSON" 1>&2
|
||||
EXIT_CODE="8" # exit 8
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
if [[ ! -r $ENTRY_JSON ]]; then
|
||||
echo "$0: ERROR: .entry.json is not a readable file: $ENTRY_JSON" 1>&2
|
||||
EXIT_CODE="8" # exit 8
|
||||
EXIT_CODE=7 # exit 7
|
||||
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
|
||||
continue
|
||||
fi
|
||||
@@ -601,7 +599,7 @@ if [[ -z $NOOP ]]; then
|
||||
status="$?"
|
||||
if [[ $status -ne 0 ]]; then
|
||||
echo "$0: ERROR: awk -f $FILELIST_ENTRY_JSON_AWK $ENTRY_JSON >> $TMP_MANIFEST_LIST failed, error: $status" 1>&2
|
||||
exit 7
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# remove entry's tarball from the IOCCC year's manifest
|
||||
@@ -611,7 +609,7 @@ if [[ -z $NOOP ]]; then
|
||||
status="$?"
|
||||
if [[ $status -ne 0 ]]; then
|
||||
echo "$0: ERROR: sed -i '' -e '/$ENTRY_ID.tar.bz2/d' $TMP_MANIFEST_LIST failed, error: $status" 1>&2
|
||||
exit 7
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -621,7 +619,7 @@ if [[ -z $NOOP ]]; then
|
||||
status="$?"
|
||||
if [[ $status -ne 0 ]]; then
|
||||
echo "$0: ERROR: sort -d -u $TMP_MANIFEST_LIST -o $TMP_MANIFEST_LIST failed, error: $status" 1>&2
|
||||
exit 7
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elif [[ $V_FLAG -ge 3 ]]; then
|
||||
@@ -665,7 +663,7 @@ fi
|
||||
EXIT_CODE=$(< "$TMP_EXIT_CODE")
|
||||
if [[ -z $EXIT_CODE ]]; then
|
||||
echo "$0: ERROR: temporary exit file is empty: $TMP_EXIT_CODE" 1>&2
|
||||
exit 233
|
||||
exit 18
|
||||
fi
|
||||
|
||||
# form the tarball
|
||||
@@ -694,7 +692,7 @@ if [[ -z $NOOP ]]; then
|
||||
"--owner=501 --group=20 --numeric-owner --totals" \
|
||||
"--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime" \
|
||||
"-jcvf $TMP_TARBALL < $TMP_TAR_LIST failed, error: $status" 1>&2
|
||||
EXIT_CODE=9 # exit 9
|
||||
EXIT_CODE=8 # exit 8
|
||||
fi
|
||||
|
||||
# case: form the tarball silently
|
||||
@@ -711,7 +709,7 @@ if [[ -z $NOOP ]]; then
|
||||
"--owner=501 --group=20 --numeric-owner" \
|
||||
"--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime" \
|
||||
"-jcf $TMP_TARBALL < $TMP_TAR_LIST failed, error: $status" 1>&2
|
||||
EXIT_CODE=9 # exit 9
|
||||
EXIT_CODE=8 # exit 8
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -719,7 +717,7 @@ if [[ -z $NOOP ]]; then
|
||||
#
|
||||
if [[ ! -s $TMP_TARBALL ]]; then
|
||||
echo "$0: ERROR: tarball is missing os empty: $TMP_TARBALL" 1>&2
|
||||
EXIT_CODE=9 # exit 9
|
||||
EXIT_CODE=8 # exit 8
|
||||
fi
|
||||
|
||||
# case: -n
|
||||
@@ -734,7 +732,7 @@ fi
|
||||
EXIT_CODE=$(< "$TMP_EXIT_CODE")
|
||||
if [[ -z $EXIT_CODE ]]; then
|
||||
echo "$0: ERROR: temporary exit file has no contents: $TMP_EXIT_CODE" 1>&2
|
||||
exit 234
|
||||
exit 19
|
||||
fi
|
||||
|
||||
# move the tarball in place only if different
|
||||
@@ -764,13 +762,13 @@ if [[ -z $NOOP ]]; then
|
||||
fi
|
||||
if [[ status -ne 0 ]]; then
|
||||
echo "$0: ERROR: mv -f -- $TMP_TARBALL $TARBALL filed, error code: $status" 1>&2
|
||||
EXIT_CODE=9 # exit 9
|
||||
EXIT_CODE=8 # exit 8
|
||||
elif [[ $V_FLAG -ge 1 ]]; then
|
||||
echo "$0: debug[1]: built replaced HTML file: $TARBALL" 1>&2
|
||||
fi
|
||||
if [[ ! -s $TARBALL ]]; then
|
||||
echo "$0: ERROR: not a non-empty index HTML file: $TARBALL" 1>&2
|
||||
EXIT_CODE=9 # exit 9
|
||||
EXIT_CODE=8 # exit 8
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user