diff options
author | jnqnfe <jnqnfe@gmail.com> | 2015-02-05 03:30:47 +0000 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2020-03-10 12:39:37 +0000 |
commit | 061d7cb3406c99a8bbb7b563625fe00357ba90aa (patch) | |
tree | 3ea895f03cb6323a2fc49404a5c7cbc6beeb6c62 | |
parent | b49abcc1a8002c52b45c3e3da6723097f99c26e6 (diff) | |
download | vyos-live-build-061d7cb3406c99a8bbb7b563625fe00357ba90aa.tar.gz vyos-live-build-061d7cb3406c99a8bbb7b563625fe00357ba90aa.zip |
tidy script init (2/4) - build stage scripts
Partial fix for #952919
Gbp-Dch: Short
-rwxr-xr-x | functions/exit.sh | 4 | ||||
-rwxr-xr-x | functions/init.sh | 9 | ||||
-rwxr-xr-x | scripts/build/binary | 14 | ||||
-rwxr-xr-x | scripts/build/bootstrap | 14 | ||||
-rwxr-xr-x | scripts/build/chroot | 14 | ||||
-rwxr-xr-x | scripts/build/installer | 14 | ||||
-rwxr-xr-x | scripts/build/source | 18 |
7 files changed, 37 insertions, 50 deletions
diff --git a/functions/exit.sh b/functions/exit.sh index 31d82a14d..0aa334a5c 100755 --- a/functions/exit.sh +++ b/functions/exit.sh @@ -56,8 +56,8 @@ Exit () return ${VALUE} } -Setup_cleanup () +Setup_clean_exit () { - Echo_message "Setting up cleanup function" + Echo_message "Setting up clean exit handler" trap 'Exit' EXIT HUP INT QUIT TERM } diff --git a/functions/init.sh b/functions/init.sh index eb73d02ae..753b9c6a3 100755 --- a/functions/init.sh +++ b/functions/init.sh @@ -13,6 +13,15 @@ Common_config_files () echo "config/all config/common config/bootstrap config/chroot config/binary config/source" } +Auto_build_config () +{ + # Automatically build config + if [ -x auto/config ] && [ ! -e .build/config ]; then + Echo_message "Automatically populating config tree." + lb config + fi +} + Init_config_data () { Arguments "${@}" diff --git a/scripts/build/binary b/scripts/build/binary index 24acb0500..19d1c47b3 100755 --- a/scripts/build/binary +++ b/scripts/build/binary @@ -13,23 +13,19 @@ set -e # Including common functions [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - # Setting static variables DESCRIPTION="Build binary images" HELP="" USAGE="${PROGRAM} [--force]" +# Automatically populating config tree +Auto_build_config + # Processing arguments and configuration files Init_config_data "${@}" -# Setup cleanup function -Setup_cleanup +# Setting up cleanup function +Setup_clean_exit # Preparing root filesystem lb binary_chroot ${@} diff --git a/scripts/build/bootstrap b/scripts/build/bootstrap index aa6ee51c4..c2614ebc0 100755 --- a/scripts/build/bootstrap +++ b/scripts/build/bootstrap @@ -13,23 +13,19 @@ set -e # Including common functions [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - # Setting static variables DESCRIPTION="Bootstrap a Debian system" HELP="" USAGE="${PROGRAM} [--force]" +# Automatically populating config tree +Auto_build_config + # Processing arguments and configuration files Init_config_data "${@}" -# Setup cleanup function -Setup_cleanup +# Setting up cleanup function +Setup_clean_exit # Bootstrapping system lb bootstrap_cache restore ${@} diff --git a/scripts/build/chroot b/scripts/build/chroot index decf9b68e..1c20714f0 100755 --- a/scripts/build/chroot +++ b/scripts/build/chroot @@ -13,23 +13,19 @@ set -e # Including common functions [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - # Setting static variables DESCRIPTION="Customize the Debian system" HELP="" USAGE="${PROGRAM} [--force]" +# Automatically populating config tree +Auto_build_config + # Processing arguments and configuration files Init_config_data "${@}" -# Setup cleanup function -Setup_cleanup +# Setting up cleanup function +Setup_clean_exit # Configuring chroot lb chroot_cache restore ${@} diff --git a/scripts/build/installer b/scripts/build/installer index 6ddd1db6d..108f6ff31 100755 --- a/scripts/build/installer +++ b/scripts/build/installer @@ -13,23 +13,19 @@ set -e # Including common functions [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - # Setting static variables DESCRIPTION="Preparing installer images" HELP="" USAGE="${PROGRAM} [--force]" +# Automatically populating config tree +Auto_build_config + # Processing arguments and configuration files Init_config_data "${@}" -# Setup cleanup function -Setup_cleanup +# Setting up cleanup function +Setup_clean_exit if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] then diff --git a/scripts/build/source b/scripts/build/source index ffcec7100..87b2d5367 100755 --- a/scripts/build/source +++ b/scripts/build/source @@ -13,18 +13,14 @@ set -e # Including common functions [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - # Setting static variables DESCRIPTION="Build source images" HELP="" USAGE="${PROGRAM} [--force]" +# Automatically populating config tree +Auto_build_config + # Processing arguments and configuration files Init_config_data "${@}" @@ -33,12 +29,10 @@ then exit 0 fi -#Require_stagefile - -# Setup cleanup function -Setup_cleanup +# Setting up cleanup function +Setup_clean_exit -# Enabling network in chroot +# Configuring chroot (enabling networking) lb chroot_hosts install ${@} lb chroot_resolv install ${@} lb chroot_hostname install ${@} |