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
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
. 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
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