diff options
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/exit.sh | 14 | ||||
-rwxr-xr-x | functions/init.sh | 2 | ||||
-rwxr-xr-x | functions/stagefile.sh | 13 |
3 files changed, 22 insertions, 7 deletions
diff --git a/functions/exit.sh b/functions/exit.sh index 32340a481..675afa2de 100755 --- a/functions/exit.sh +++ b/functions/exit.sh @@ -21,7 +21,7 @@ Exit () # Skip if we have not yet completed the initial bootstrapping (bootstrap_debootstrap) # (nothing to be done; avoids unhelpful messages) - if [ ! -e .build/bootstrap ]; then + if ! Stagefile_exists bootstrap; then return ${VALUE} fi @@ -43,10 +43,12 @@ Exit () done fi - rm -f .build/chroot_devpts - rm -f .build/chroot_proc - rm -f .build/chroot_selinuxfs - rm -f .build/chroot_sysfs + STAGEFILES_DIR="$(Stagefiles_dir)" + + rm -f "${STAGEFILES_DIR}"/chroot_devpts + rm -f "${STAGEFILES_DIR}"/chroot_proc + rm -f "${STAGEFILES_DIR}"/chroot_selinuxfs + rm -f "${STAGEFILES_DIR}"/chroot_sysfs Echo_message "Saving caches..." @@ -54,7 +56,7 @@ Exit () # but let's assume that if there's any binary stage file arround # we are in binary stage. - if ls .build/binary* > /dev/null 2>&1 + if ls "${STAGEFILES_DIR}"/binary* > /dev/null 2>&1 then Save_package_cache binary else diff --git a/functions/init.sh b/functions/init.sh index d39bf1b5a..708e3d275 100755 --- a/functions/init.sh +++ b/functions/init.sh @@ -12,7 +12,7 @@ Auto_build_config () { # Automatically build config - if [ -x auto/config ] && [ ! -e .build/config ]; then + if [ -x auto/config ] && ! Stagefile_exists config; then Echo_message "Automatically populating config tree." lb config fi diff --git a/functions/stagefile.sh b/functions/stagefile.sh index 384aaec2d..8d9281415 100755 --- a/functions/stagefile.sh +++ b/functions/stagefile.sh @@ -9,6 +9,11 @@ ## under certain conditions; see COPYING for details. +Stagefiles_dir () +{ + echo ".build" +} + # Get the default filename for a script's stagefile (the name of the script # file itself). A suffix can be appended via providing as a param. Stagefile_name () @@ -19,6 +24,14 @@ Stagefile_name () echo ${FILENAME}${SUFFIX:+.$SUFFIX} } +Stagefile_exists () +{ + if [ -f ".build/${1:-$(Stagefile_name)}" ]; then + return 0 + fi + return 1 +} + Check_stagefile () { local FILE |