output error for incorrect action in chroot prep scripts

...alongside printing usage (which is perhaps unnecessary), so that it is
actually clear to users that a problem occurred, and what.

and capture it before option processing of remaining args.

Gbp-Dch: Ignore
This commit is contained in:
Lyndon Brown 2020-05-02 13:41:01 +01:00
parent 5f318c5a44
commit da1fab1161
13 changed files with 61 additions and 12 deletions

View File

@ -18,6 +18,9 @@ set -e
DESCRIPTION="Manage /etc/apt/apt.conf"
USAGE="${PROGRAM} {install|install-binary|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
@ -26,7 +29,7 @@ Require_stagefiles config bootstrap
CONFD="chroot/etc/apt/apt.conf.d"
case "${1}" in
case "${_ACTION}" in
install|install-binary)
Echo_message "Configuring file /etc/apt/apt.conf"
@ -220,6 +223,7 @@ case "${1}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -441,6 +441,7 @@ case "${_ACTION}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Manage /etc/debian_chroot"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Configuring file /etc/debian_chroot"
@ -70,6 +73,7 @@ case "${1}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Mount /dev/pts"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Begin mounting /dev/pts..."
@ -66,6 +69,7 @@ case "${1}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Manage /sbin/dpkg"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Configuring file /sbin/start-stop-daemon"
@ -87,6 +90,7 @@ EOF
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Manage /bin/hostname"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
# Checking stage file
Check_stagefile
@ -80,6 +83,7 @@ EOF
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Manage /etc/hosts"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Configuring file /etc/hosts"
@ -86,6 +89,7 @@ EOF
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Mount /proc"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Begin mounting /proc..."
@ -70,6 +73,7 @@ case "${1}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Manage /etc/resolv.conf"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Configuring file /etc/resolv.conf"
@ -100,6 +103,7 @@ case "${1}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,6 +18,9 @@ set -e
DESCRIPTION="Mount /sys/fs/selinux"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
@ -31,7 +34,7 @@ then
exit 0
fi
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Begin mounting /sys/fs/selinux..."
@ -71,6 +74,7 @@ case "${1}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Mount /sys"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Begin mounting /sys..."
@ -64,6 +67,7 @@ case "${1}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,13 +18,16 @@ set -e
DESCRIPTION="Manage /usr/sbin/policy-rc.d"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Configuring file /usr/sbin/policy-rc.d"
@ -76,6 +79,7 @@ EOF
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac

View File

@ -18,6 +18,9 @@ set -e
DESCRIPTION="Use tmpfs to speedup the build"
USAGE="${PROGRAM} {install|remove} [--force]"
_ACTION="${1}"
shift
# Processing arguments and configuration files
Init_config_data "${@}"
@ -29,7 +32,7 @@ fi
# Requiring stage file
Require_stagefiles config bootstrap
case "${1}" in
case "${_ACTION}" in
install)
Echo_message "Configuring tmpfs for /var/lib/dpkg"
@ -69,6 +72,7 @@ case "${1}" in
;;
*)
Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac