mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-21 17:52:01 +01:00
bastille: Some commands should not support parallel mode
This commit is contained in:
@@ -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,71 +196,76 @@ 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| \
|
# Extract JAILS from command for parallel mode
|
||||||
zfs)
|
OPTIONS=""
|
||||||
|
while [ "$#" -gt 0 ] && [ "${PARALLEL_MODE}" -eq 1 ]; do
|
||||||
|
case "${1}" in
|
||||||
|
-*)
|
||||||
|
OPTIONS="${OPTIONS} ${1}"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if ! set_target "${1}" >/dev/null 2>&1; then
|
||||||
|
OPTIONS="${OPTIONS} ${1}"
|
||||||
|
shift 1
|
||||||
|
else
|
||||||
|
XARGS_JAILS="${JAILS}"
|
||||||
|
shift 1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
esac
|
||||||
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Extract JAILS from command for parallel mode
|
|
||||||
OPTIONS=""
|
|
||||||
while [ "$#" -gt 0 ] && [ "${PARALLEL_MODE}" -eq 1 ]; do
|
|
||||||
case "${1}" in
|
|
||||||
-*)
|
|
||||||
OPTIONS="${OPTIONS} ${1}"
|
|
||||||
shift 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if ! set_target "${1}" >/dev/null 2>&1; then
|
|
||||||
OPTIONS="${OPTIONS} ${1}"
|
|
||||||
shift 1
|
|
||||||
else
|
|
||||||
XARGS_JAILS="${JAILS}"
|
|
||||||
shift 1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
SCRIPTPATH="${bastille_sharedir}/${CMD}.sh"
|
SCRIPTPATH="${bastille_sharedir}/${CMD}.sh"
|
||||||
if [ -f "${SCRIPTPATH}" ]; then
|
if [ -f "${SCRIPTPATH}" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user