diff --git a/template.cfg b/template.cfg index 883a78d..67cb543 100644 --- a/template.cfg +++ b/template.cfg @@ -67,7 +67,7 @@ d-i netcfg/dhcpv6_timeout string 1 # values set here. However, setting the values still prevents the questions # from being shown, even if values come from dhcp. d-i netcfg/get_hostname string debian -d-i netcfg/get_domain string home.bjphoster.cloud +d-i netcfg/get_domain string DOMAIN_NAME # If you want to force a hostname, regardless of what either the DHCP # server returns or what the reverse DNS entry for the IP is, uncomment diff --git a/unattended.sh b/unattended.sh index d41c980..2971e15 100755 --- a/unattended.sh +++ b/unattended.sh @@ -1,11 +1,22 @@ #!/usr/bin/env bash -# Get password from user prompt and set it in preseed +DEFAULT_ROOT_PASSWORD='IamGr00t!' +DEFAULT_DOMAIN="home.bjphoster.cloud" + +# Get password from user prompt (empty input keeps the default) and set it in preseed if [ -z "$ROOT_PASSWORD" ]; then - read -sp "Enter the root password: " ROOT_PASSWORD + read -sp "Enter the root password [${DEFAULT_ROOT_PASSWORD}]: " ROOT_PASSWORD + echo fi +ROOT_PASSWORD="${ROOT_PASSWORD:-${DEFAULT_ROOT_PASSWORD}}" +# Get the domain from user prompt (empty input keeps the default) and set it in preseed +if [ -z "$DOMAIN_NAME" ]; then + read -p "Enter the domain [${DEFAULT_DOMAIN}]: " DOMAIN_NAME +fi +DOMAIN_NAME="${DOMAIN_NAME:-${DEFAULT_DOMAIN}}" cp -f template.cfg preseed.cfg sed -i "s/ROOT_PASSWORD/${ROOT_PASSWORD}/" preseed.cfg +sed -i "s/DOMAIN_NAME/${DOMAIN_NAME}/" preseed.cfg # Get the file name ISONAME=$(ls | grep "netinst.iso" | sort | tail -n1)