summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-05-02 13:41:01 +0100
committerLyndon Brown <jnqnfe@gmail.com>2020-05-02 13:46:41 +0100
commitda1fab116139150db562eb2c104dea55b7535a33 (patch)
treed10223875315beb26115911072940998e0cc6562 /scripts
parent5f318c5a444ef05bdf79b1f7640294c7423fd10e (diff)
downloadvyos-live-build-da1fab116139150db562eb2c104dea55b7535a33.tar.gz
vyos-live-build-da1fab116139150db562eb2c104dea55b7535a33.zip
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
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/chroot_apt6
-rwxr-xr-xscripts/build/chroot_archives1
-rwxr-xr-xscripts/build/chroot_debianchroot6
-rwxr-xr-xscripts/build/chroot_devpts6
-rwxr-xr-xscripts/build/chroot_dpkg6
-rwxr-xr-xscripts/build/chroot_hostname6
-rwxr-xr-xscripts/build/chroot_hosts6
-rwxr-xr-xscripts/build/chroot_proc6
-rwxr-xr-xscripts/build/chroot_resolv6
-rwxr-xr-xscripts/build/chroot_selinuxfs6
-rwxr-xr-xscripts/build/chroot_sysfs6
-rwxr-xr-xscripts/build/chroot_sysv-rc6
-rwxr-xr-xscripts/build/chroot_tmpfs6
13 files changed, 61 insertions, 12 deletions
diff --git a/scripts/build/chroot_apt b/scripts/build/chroot_apt
index ad5c54816..b1fceffaa 100755
--- a/scripts/build/chroot_apt
+++ b/scripts/build/chroot_apt
@@ -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
diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives
index 7dc7b32fb..c6d4c1b84 100755
--- a/scripts/build/chroot_archives
+++ b/scripts/build/chroot_archives
@@ -441,6 +441,7 @@ case "${_ACTION}" in
;;
*)
+ Echo_error "Invalid action parameter: '${_ACTION}'"
Usage --fail
;;
esac
diff --git a/scripts/build/chroot_debianchroot b/scripts/build/chroot_debianchroot
index e534ac101..25fb725ad 100755
--- a/scripts/build/chroot_debianchroot
+++ b/scripts/build/chroot_debianchroot
@@ -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
diff --git a/scripts/build/chroot_devpts b/scripts/build/chroot_devpts
index 4a5a13a94..cc1e31321 100755
--- a/scripts/build/chroot_devpts
+++ b/scripts/build/chroot_devpts
@@ -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
diff --git a/scripts/build/chroot_dpkg b/scripts/build/chroot_dpkg
index bb734adc5..e9c4dd760 100755
--- a/scripts/build/chroot_dpkg
+++ b/scripts/build/chroot_dpkg
@@ -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
diff --git a/scripts/build/chroot_hostname b/scripts/build/chroot_hostname
index 4509591f0..eb2fd02e5 100755
--- a/scripts/build/chroot_hostname
+++ b/scripts/build/chroot_hostname
@@ -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
diff --git a/scripts/build/chroot_hosts b/scripts/build/chroot_hosts
index a311a2eee..ee0ca3452 100755
--- a/scripts/build/chroot_hosts
+++ b/scripts/build/chroot_hosts
@@ -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
diff --git a/scripts/build/chroot_proc b/scripts/build/chroot_proc
index 012510dd8..7f89fdd55 100755
--- a/scripts/build/chroot_proc
+++ b/scripts/build/chroot_proc
@@ -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
diff --git a/scripts/build/chroot_resolv b/scripts/build/chroot_resolv
index f908b7f6e..09fb6ee90 100755
--- a/scripts/build/chroot_resolv
+++ b/scripts/build/chroot_resolv
@@ -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
diff --git a/scripts/build/chroot_selinuxfs b/scripts/build/chroot_selinuxfs
index ac6b8b695..cb19b5846 100755
--- a/scripts/build/chroot_selinuxfs
+++ b/scripts/build/chroot_selinuxfs
@@ -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
diff --git a/scripts/build/chroot_sysfs b/scripts/build/chroot_sysfs
index e6e26a35e..7d0e38cf3 100755
--- a/scripts/build/chroot_sysfs
+++ b/scripts/build/chroot_sysfs
@@ -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
diff --git a/scripts/build/chroot_sysv-rc b/scripts/build/chroot_sysv-rc
index 971cd0937..a5b22f773 100755
--- a/scripts/build/chroot_sysv-rc
+++ b/scripts/build/chroot_sysv-rc
@@ -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
diff --git a/scripts/build/chroot_tmpfs b/scripts/build/chroot_tmpfs
index c5f69ed50..93fec81c3 100755
--- a/scripts/build/chroot_tmpfs
+++ b/scripts/build/chroot_tmpfs
@@ -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