bastille: Some commands should not support parallel mode

This commit is contained in:
tschettervictor
2025-04-06 16:57:20 -06:00
committed by GitHub
parent c0574c28d0
commit 78e7d881cf

View File

@@ -188,6 +188,7 @@ while [ "$#" -gt 0 ]; do
;; ;;
esac esac
done done
if [ "$#" -lt 1 ]; then if [ "$#" -lt 1 ]; then
usage usage
else else
@@ -195,51 +196,51 @@ else
shift shift
fi fi
# Handle special-case commands first. # Handle sub-commands.
case "${CMD}" in case "${CMD}" in
# Commands that don't allow parallel mode
bootstrap| \ bootstrap| \
clone| \ clone| \
cmd| \
config| \
console| \ console| \
convert| \ convert| \
cp| \ cp| \
create| \ create| \
destroy| \
edit| \ edit| \
etcupdate| \
export| \ export| \
htop| \ htop| \
jcp | \ jcp | \
import| \ import| \
limits| \
list| \ list| \
mount| \
network| \ network| \
pkg| \
rcp| \ rcp| \
rdr| \ rdr| \
rename| \ rename| \
setup| \
top| \
verify| \
zfs)
if [ "${PARALLEL_MODE}" -eq 1 ]; then
error_exit "Command does not support parallel mode: ${CMD}"
fi
;;
# Commands that allow parallel mode
cmd| \
config| \
destroy| \
etcupdate| \
limits| \
mount| \
pkg| \
restart| \ restart| \
service| \ service| \
setup| \
start| \ start| \
stop| \ stop| \
sysrc| \ sysrc| \
tags| \ tags| \
template| \ template| \
top| \
umount| \ umount| \
update| \ update| \
upgrade| \ upgrade)
verify| \
zfs)
;;
*)
usage
;;
esac
# Extract JAILS from command for parallel mode # Extract JAILS from command for parallel mode
OPTIONS="" OPTIONS=""
while [ "$#" -gt 0 ] && [ "${PARALLEL_MODE}" -eq 1 ]; do while [ "$#" -gt 0 ] && [ "${PARALLEL_MODE}" -eq 1 ]; do
@@ -259,6 +260,11 @@ while [ "$#" -gt 0 ] && [ "${PARALLEL_MODE}" -eq 1 ]; do
fi fi
esac esac
done done
;;
*)
usage
;;
esac
# shellcheck disable=SC2154 # shellcheck disable=SC2154
SCRIPTPATH="${bastille_sharedir}/${CMD}.sh" SCRIPTPATH="${bastille_sharedir}/${CMD}.sh"