From fde1bbc5713a5edcb5974926441f6bdf559e0a20 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Sun, 6 Mar 2022 14:07:03 +0200 Subject: [PATCH 1/2] Update bootstrap.cfg immediately after interactive prompts This improves the readablility of the scripts. It also helps avoid cases where a variable could be set twice in bootstrap.cfg, such as the DISK variable. --- sysa/run.sh | 10 +++++----- sysb/run.sh | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sysa/run.sh b/sysa/run.sh index 4338cd88..cd5a7a24 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -71,6 +71,8 @@ if [ -z "${CHROOT}" ]; then echo "or not. Is it? (yes/no answer)" ask_chroot echo + + echo "export CHROOT=${CHROOT}" >> "${SOURCES}/bootstrap.cfg" fi ask_timestamps() { @@ -91,15 +93,13 @@ if [ -z "${FORCE_TIMESTAMPS}" ]; then echo "fully reproducible disk image. (yes/no answer)" ask_timestamps echo + + echo "export FORCE_TIMESTAMPS=${FORCE_TIMESTAMPS}" >> "${SOURCES}/bootstrap.cfg" fi echo "Thank you! All done." -# Write to bootstrap.cfg -rm "${SOURCES}/bootstrap.cfg" -for var in CHROOT FORCE_TIMESTAMPS DISK ARCH UPDATE_CHECKSUMS; do - echo "export ${var}=${!var}" >> "${SOURCES}/bootstrap.cfg" -done +echo "export ARCH=${ARCH}" >> "${SOURCES}/bootstrap.cfg" mkdir -p "${DESTDIR}" "${REPO}" /dev diff --git a/sysb/run.sh b/sysb/run.sh index b5618840..ba38d4d2 100755 --- a/sysb/run.sh +++ b/sysb/run.sh @@ -53,14 +53,14 @@ ask_disk() { if [ -z "${DISK}" ] || ! [ -e "/dev/${DISK}" ]; then echo "You did not provide a valid disk in the configuration file." ask_disk + + echo "export DISK=${DISK}" >> /usr/src/bootstrap.cfg fi PREFIX=/usr SOURCES="${PREFIX}/src" SYSC=/sysc -echo "export DISK=${DISK}" >> /usr/src/bootstrap.cfg - # Otherwise, add stuff from sysa to sysb echo "Mounting sysc" mkdir /sysc From fcea28eb38adfcf2117d9b8bc9b9adb608799208 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Sun, 15 May 2022 11:49:50 +0300 Subject: [PATCH 2/2] Don't export variables from bootstrap.cfg These variables should only affect live-bootstrap's scripts, yet they currently "pollute" the build environment of most packages during the bootstrap unnecessarily. This change also makes bootstrap.cfg keep the same format between the different bootstrap stages, which simplifies the input to each step. --- sysa/run.sh | 6 +++--- sysb/run.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sysa/run.sh b/sysa/run.sh index cd5a7a24..d703091b 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -72,7 +72,7 @@ if [ -z "${CHROOT}" ]; then ask_chroot echo - echo "export CHROOT=${CHROOT}" >> "${SOURCES}/bootstrap.cfg" + echo "CHROOT=${CHROOT}" >> "${SOURCES}/bootstrap.cfg" fi ask_timestamps() { @@ -94,12 +94,12 @@ if [ -z "${FORCE_TIMESTAMPS}" ]; then ask_timestamps echo - echo "export FORCE_TIMESTAMPS=${FORCE_TIMESTAMPS}" >> "${SOURCES}/bootstrap.cfg" + echo "FORCE_TIMESTAMPS=${FORCE_TIMESTAMPS}" >> "${SOURCES}/bootstrap.cfg" fi echo "Thank you! All done." -echo "export ARCH=${ARCH}" >> "${SOURCES}/bootstrap.cfg" +echo "ARCH=${ARCH}" >> "${SOURCES}/bootstrap.cfg" mkdir -p "${DESTDIR}" "${REPO}" /dev diff --git a/sysb/run.sh b/sysb/run.sh index ba38d4d2..841b81c1 100755 --- a/sysb/run.sh +++ b/sysb/run.sh @@ -54,7 +54,7 @@ if [ -z "${DISK}" ] || ! [ -e "/dev/${DISK}" ]; then echo "You did not provide a valid disk in the configuration file." ask_disk - echo "export DISK=${DISK}" >> /usr/src/bootstrap.cfg + echo "DISK=${DISK}" >> /usr/src/bootstrap.cfg fi PREFIX=/usr