diff options
-rwxr-xr-x | functions/stagefile.sh | 27 | ||||
-rwxr-xr-x | scripts/build/chroot_apt | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_debianchroot | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_devpts | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_dpkg | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_hostname | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_hosts | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_proc | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_resolv | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_selinuxfs | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_sysfs | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_sysv-rc | 3 | ||||
-rwxr-xr-x | scripts/build/chroot_tmpfs | 3 |
13 files changed, 59 insertions, 4 deletions
diff --git a/functions/stagefile.sh b/functions/stagefile.sh index 3c3468851..3108a7058 100755 --- a/functions/stagefile.sh +++ b/functions/stagefile.sh @@ -27,10 +27,8 @@ Check_stagefile () NAME="$(basename ${FILE})" # Checking stage file - if [ -f "${FILE}" ] - then - if [ "${_FORCE}" != "true" ] - then + if [ -f "${FILE}" ]; then + if [ "${_FORCE}" != "true" ]; then # Skip execution Echo_warning "Skipping %s, already done" "${NAME}" exit 0 @@ -42,6 +40,27 @@ Check_stagefile () fi } +# Used by chroot preperation scripts in removal mode +Ensure_stagefile_exists () +{ + local FILE + local NAME + FILE=".build/${1:-$(Stagefile_name)}" + NAME="$(basename ${FILE})" + + # Checking stage file + if [ ! -f "${FILE}" ]; then + if [ "${_FORCE}" != "true" ]; then + # Skip execution + Echo_warning "Skipping removal of %s, it is not applied" "${NAME}" + exit 0 + else + # Force execution + Echo_message "Forcing %s" "${NAME}" + fi + fi +} + Create_stagefile () { local FILE diff --git a/scripts/build/chroot_apt b/scripts/build/chroot_apt index 6d974f1b5..ad5c54816 100755 --- a/scripts/build/chroot_apt +++ b/scripts/build/chroot_apt @@ -147,6 +147,9 @@ case "${1}" in remove) Echo_message "Deconfiguring file /etc/apt/apt.conf" + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_debianchroot b/scripts/build/chroot_debianchroot index e7f32b4f6..e534ac101 100755 --- a/scripts/build/chroot_debianchroot +++ b/scripts/build/chroot_debianchroot @@ -50,6 +50,9 @@ case "${1}" in remove) Echo_message "Deconfiguring file /etc/debian_chroot" + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_devpts b/scripts/build/chroot_devpts index 7d55ca9e7..4a5a13a94 100755 --- a/scripts/build/chroot_devpts +++ b/scripts/build/chroot_devpts @@ -47,6 +47,9 @@ case "${1}" in remove) Echo_message "Begin unmounting /dev/pts..." + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_dpkg b/scripts/build/chroot_dpkg index 598b50075..bb734adc5 100755 --- a/scripts/build/chroot_dpkg +++ b/scripts/build/chroot_dpkg @@ -60,6 +60,9 @@ EOF remove) Echo_message "Deconfiguring file /sbin/start-stop-daemon" + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_hostname b/scripts/build/chroot_hostname index a209bcfba..4509591f0 100755 --- a/scripts/build/chroot_hostname +++ b/scripts/build/chroot_hostname @@ -57,6 +57,9 @@ EOF remove) Echo_message "Deconfiguring file /etc/hostname" + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_hosts b/scripts/build/chroot_hosts index 27090f05f..a311a2eee 100755 --- a/scripts/build/chroot_hosts +++ b/scripts/build/chroot_hosts @@ -61,6 +61,9 @@ EOF remove) Echo_message "Deconfiguring file /etc/hosts" + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_proc b/scripts/build/chroot_proc index 3a9aba57f..012510dd8 100755 --- a/scripts/build/chroot_proc +++ b/scripts/build/chroot_proc @@ -47,6 +47,9 @@ case "${1}" in remove) Echo_message "Begin unmounting /proc..." + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_resolv b/scripts/build/chroot_resolv index 1918856cc..25da6d549 100755 --- a/scripts/build/chroot_resolv +++ b/scripts/build/chroot_resolv @@ -64,6 +64,9 @@ case "${1}" in remove) Echo_message "Deconfiguring file /etc/resolv.conf" + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_selinuxfs b/scripts/build/chroot_selinuxfs index 2916679d6..8c9944931 100755 --- a/scripts/build/chroot_selinuxfs +++ b/scripts/build/chroot_selinuxfs @@ -50,6 +50,9 @@ case "${1}" in remove) Echo_message "Begin unmounting /sys/fs/selinux..." + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_sysfs b/scripts/build/chroot_sysfs index 070dd6eda..e6e26a35e 100755 --- a/scripts/build/chroot_sysfs +++ b/scripts/build/chroot_sysfs @@ -47,6 +47,9 @@ case "${1}" in remove) Echo_message "Begin unmounting /sys..." + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_sysv-rc b/scripts/build/chroot_sysv-rc index bcf86a74d..971cd0937 100755 --- a/scripts/build/chroot_sysv-rc +++ b/scripts/build/chroot_sysv-rc @@ -56,6 +56,9 @@ EOF remove) Echo_message "Deconfiguring file /usr/sbin/policy-rc.d" + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile diff --git a/scripts/build/chroot_tmpfs b/scripts/build/chroot_tmpfs index ae1d0f82c..c5f69ed50 100755 --- a/scripts/build/chroot_tmpfs +++ b/scripts/build/chroot_tmpfs @@ -52,6 +52,9 @@ case "${1}" in remove) Echo_message "Deconfiguring tmpfs for /var/lib/dpkg" + # Checking stage file + Ensure_stagefile_exists + # Acquire lock file Acquire_lockfile |