From 1d1c7212f13da3feeadf5801585cf2343c69e298 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 4 Apr 2025 20:22:33 +0200 Subject: [PATCH] Fix. --- bookworm/preseed.cfg | 5 +++-- testing/scripts/make_writable_installer.sh | 2 +- testing/scripts/update_preseed.sh | 22 ++++++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/bookworm/preseed.cfg b/bookworm/preseed.cfg index 8e3d89b..7553d7c 100644 --- a/bookworm/preseed.cfg +++ b/bookworm/preseed.cfg @@ -4,9 +4,9 @@ d-i anna/choose_modules multiselect d-i netcfg/link_wait_timeout string 3 d-i netcfg/choose_interface select auto -#d-i netcfg/wireless_essid string kadatheron +#d-i netcfg/wireless_essid string REPLACE_WITH_WIFI_ESSID #d-i netcfg/wireless_essid seen true -d-i netcfg/wireless_show_essids select kadatheron +d-i netcfg/wireless_show_essids select REPLACE_WITH_WIFI_ESSID #d-i netcfg/wireless_show_essids seen true #d-i netcfg/confirm_essid boolean true #d-i netcfg/confirm_essid seen true @@ -32,6 +32,7 @@ d-i partman-auto-crypto/erase_disks boolean false d-i base-installer/kernel/image string linux-image-amd64 d-i base-installer/initramfs-tools/driver-policy most +d-i base-installer/install-recommends boolean false #d-i pkgsel/run_tasksel boolean false diff --git a/testing/scripts/make_writable_installer.sh b/testing/scripts/make_writable_installer.sh index b5327e7..39e1396 100755 --- a/testing/scripts/make_writable_installer.sh +++ b/testing/scripts/make_writable_installer.sh @@ -7,7 +7,7 @@ cd $(dirname "$0") . lib/abort_if_command_unknown . lib/abort_if_not_user . lib/abort_if_offline -. lib/constants_installer +. lib/constants_installer # FILENAME_PRESEED_CFG, PATH_PRESEED_CFG . lib/expect_n_args . lib/get_mountable_device_path diff --git a/testing/scripts/update_preseed.sh b/testing/scripts/update_preseed.sh index ffd0938..6a195a6 100755 --- a/testing/scripts/update_preseed.sh +++ b/testing/scripts/update_preseed.sh @@ -2,18 +2,32 @@ set -e cd $(dirname "$0") . lib/abort_if_command_unknown -. lib/constants_installer +. lib/constants_installer # FILENAME_PRESEED_CFG, PATH_PRESEED_CFG . lib/expect_n_args . lib/get_mountable_device_path -expect_n_args 1 1 'DEVICE (e.g. "sdb")' $@ +expect_n_args 1 4 'DEVICE (e.g. "sdb1") [ROOT_PASSWORD] [WIFI_ESSID] [WIFI_PASSWORD]' $@ +DEVICE_NAME="$1" +ROOT_PASSWORD="$2" +WIFI_ESSID="$3" +WIFI_PASSWORD="$4" abort_if_command_unknown pmount -DEVICE_NAME="$1" PATH_DEVICE="$(get_mountable_device_path ${DEVICE_NAME})" PATH_MOUNTED="/media/$1" echo "Mounting ${PATH_DEVICE} …" pmount "${DEVICE_NAME}" trap "echo 'Unmounting '${PATH_DEVICE}; pumount ${DEVICE_NAME}" EXIT INT TERM echo "Copying ${PATH_PRESEED_CFG} …" -cp "${PATH_PRESEED_CFG}" "${PATH_MOUNTED}/" +PATH_MOUNTED_PRESEED_CFG="${PATH_MOUNTED}/${FILENAME_PRESEED_CFG}" +cp "${PATH_PRESEED_CFG}" "${PATH_MOUNTED_PRESEED_CFG}" +replace_if_provided() { + _VAR_NAME="$1" + val_of_var_of_name() { eval printf '"%s"' '"${'"$1"'}"'; } + if [ ! -z "$(val_of_var_of_name ${_VAR_NAME})" ]; then + sed -i "s/REPLACE_WITH_${_VAR_NAME}/$(val_of_var_of_name ${_VAR_NAME})/g" "${PATH_MOUNTED_PRESEED_CFG}" + fi +} +replace_if_provided ROOT_PASSWORD +replace_if_provided WIFI_ESSID +replace_if_provided WIFI_PASSWORD -- 2.30.2