mirror of
https://github.com/hackacad/bastille.git
synced 2026-01-04 11:43:48 +01:00
console: use -s to force start instead of -f
This is because -f typically is used to force and option. Example being in destroy.sh I think it more consistent to use -s to auto start/stop a jail it the script requires it.
This commit is contained in:
@@ -36,7 +36,7 @@ usage() {
|
||||
cat << EOF
|
||||
Options:
|
||||
|
||||
-f | --force Start the jail if it is stopped.
|
||||
-s | --start Start the jail if it is stopped.
|
||||
-x | --debug Enable debug mode.
|
||||
|
||||
EOF
|
||||
@@ -44,14 +44,14 @@ EOF
|
||||
}
|
||||
|
||||
# Handle options.
|
||||
FORCE=0
|
||||
START=0
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "${1}" in
|
||||
-h|--help|help)
|
||||
usage
|
||||
;;
|
||||
-f|--force)
|
||||
FORCE=1
|
||||
-s|--start)
|
||||
START=1
|
||||
shift
|
||||
;;
|
||||
-x|--debug)
|
||||
@@ -59,8 +59,14 @@ while [ "$#" -gt 0 ]; do
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
error_notify "Unknown Option: \"${1}\""
|
||||
usage
|
||||
for _opt in $(echo ${1} | sed 's/-//g' | fold -w1); do
|
||||
case ${_opt} in
|
||||
x) enable_debug ;;
|
||||
s) START=1 ;;
|
||||
*) error_exit "Unknown Option: \"${1}\"" ;;
|
||||
esac
|
||||
done
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
break
|
||||
@@ -77,11 +83,11 @@ USER="${2}"
|
||||
|
||||
bastille_root_check
|
||||
set_target_single "${TARGET}"
|
||||
check_target_is_running "${TARGET}" || if [ "${FORCE}" -eq 1 ]; then
|
||||
check_target_is_running "${TARGET}" || if [ "${START}" -eq 1 ]; then
|
||||
bastille start "${TARGET}"
|
||||
else
|
||||
error_notify "Jail is not running."
|
||||
error_exit "Use [-f|--force] to force start the jail."
|
||||
error_exit "Use [-s|--start] to force start the jail."
|
||||
fi
|
||||
|
||||
validate_user() {
|
||||
|
||||
Reference in New Issue
Block a user