new: implement --checkpoint for mp-check
This commit is contained in:
parent
8f1a7f5e27
commit
dd18ae23de
@ -70,6 +70,7 @@ help_cmd() {
|
|||||||
info "MatterLinux package check script (mtsc ${MTSC_VERSION})" # sourced from mtsc-common
|
info "MatterLinux package check script (mtsc ${MTSC_VERSION})" # sourced from mtsc-common
|
||||||
info "Usage: ${0} <options> [archive file/source dir]"
|
info "Usage: ${0} <options> [archive file/source dir]"
|
||||||
info "Options:"
|
info "Options:"
|
||||||
|
echo_color " $BOLD--checkpoint$RESET: specify a starting point for the check"
|
||||||
echo_color " $BOLD--fail-warn$RESET: fail on a warning"
|
echo_color " $BOLD--fail-warn$RESET: fail on a warning"
|
||||||
echo_color " $BOLD--no-warn$RESET: ignore warnings"
|
echo_color " $BOLD--no-warn$RESET: ignore warnings"
|
||||||
echo
|
echo
|
||||||
@ -316,6 +317,7 @@ check_source(){
|
|||||||
#################
|
#################
|
||||||
## main script ##
|
## main script ##
|
||||||
#################
|
#################
|
||||||
|
OPT_CHECKPOINT=""
|
||||||
OPT_FAIL_WARN=0
|
OPT_FAIL_WARN=0
|
||||||
OPT_NO_WARN=0
|
OPT_NO_WARN=0
|
||||||
OPT_TARGET=()
|
OPT_TARGET=()
|
||||||
@ -325,6 +327,8 @@ for arg in "$@"; do
|
|||||||
"--help")
|
"--help")
|
||||||
help_cmd
|
help_cmd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
"--checkpoint"*)
|
||||||
|
OPT_CHECKPOINT="$(echo "${arg}" | cut -d '=' -f2)" ;;
|
||||||
"--fail-warn")
|
"--fail-warn")
|
||||||
OPT_FAIL_WARN=1 ;;
|
OPT_FAIL_WARN=1 ;;
|
||||||
"--no-warn")
|
"--no-warn")
|
||||||
@ -348,8 +352,13 @@ if [ $OPT_FAIL_WARN -eq 1 ] && [ $OPT_NO_WARN -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Running mp-check with the options:"
|
info "Running mp-check with the options:"
|
||||||
print " $BOLD FAIL_WARN = $(itoyn $OPT_FAIL_WARN)"
|
if [ -z "${OPT_CHECKPOINT}" ]; then
|
||||||
print " $BOLD NO_WARN = $(itoyn $OPT_NO_WARN)"
|
print " $BOLD CHECKPOINT = NONE"
|
||||||
|
else
|
||||||
|
print " $BOLD CHECKPOINT = ${OPT_CHECKPOINT}"
|
||||||
|
fi
|
||||||
|
print " $BOLD FAIL_WARN = $(itoyn $OPT_FAIL_WARN)"
|
||||||
|
print " $BOLD NO_WARN = $(itoyn $OPT_NO_WARN)"
|
||||||
|
|
||||||
for target in "${OPT_TARGET[@]}"; do
|
for target in "${OPT_TARGET[@]}"; do
|
||||||
if [ ! -f "${target}" ] && [ ! -d "${target}" ]; then
|
if [ ! -f "${target}" ] && [ ! -d "${target}" ]; then
|
||||||
@ -359,12 +368,19 @@ for target in "${OPT_TARGET[@]}"; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
tc="${#OPT_TARGET[@]}"
|
tc="${#OPT_TARGET[@]}"
|
||||||
|
got_checkpoint=0
|
||||||
ti=0
|
ti=0
|
||||||
|
|
||||||
for target in "${OPT_TARGET[@]}"; do
|
for target in "${OPT_TARGET[@]}"; do
|
||||||
unset_indent
|
unset_indent
|
||||||
ti=$((ti + 1))
|
ti=$((ti + 1))
|
||||||
|
|
||||||
|
if [ -z "${OPT_CHECKPOINT}" ] || [ "${target}" == "${OPT_CHECKPOINT}" ]; then
|
||||||
|
got_checkpoint=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ $got_checkpoint -eq 0 ] && continue
|
||||||
|
|
||||||
if [ -f "${target}" ]; then
|
if [ -f "${target}" ]; then
|
||||||
info "(${ti}/${tc}) Checking the archive: ${target}"
|
info "(${ti}/${tc}) Checking the archive: ${target}"
|
||||||
set_indent
|
set_indent
|
||||||
|
Loading…
Reference in New Issue
Block a user