Add hostname & domain query

This commit is contained in:
LinuxSquare 2024-01-06 14:27:23 +01:00
parent 6844726dbd
commit 2258760eba

View file

@ -156,6 +156,7 @@ function introDialogue() {
OS: NoveriaOS
Version: $(date "+%Y%m")
IP: $(ifconfig eth0 | grep "inet addr" | awk '{$1=$1};1' | awk '{print $2}' | cut -d: -f2)
How do you want to continue?
"
@ -215,6 +216,13 @@ function prepareInstallation() {
INSTALLATION_ROOT_PW="${INSTALLATION_ROOT_PW}-$(randomPasswordGen 5)"
done
# hostname
INSTALLATION_HOSTNAME=$(dialog --clear --title "What's the hostname of this device?" --inputbox "Enter hostname" 10 70 3>&1 1>&2 2>&3 3>&-)
# domain
INSTALLATION_DOMAIN=$(dialog --clear --title "What's the domain of this device?" --inputbox "Enter domain (leave empty for localhost)" 10 70 3>&1 1>&2 2>&3 3>&-)
[[ -z "$INSTALLATION_DOMAIN" ]] && INSTALLATION_DOMAIN="localhost"
# show summary
summary
}
@ -224,7 +232,8 @@ function prepareInstallation() {
##
function summary() {
dialog --stdout --clear --title "Summary" --yes-label "Confirm" --no-label "Abort" --yesno "\n
Disk: $INSTALLATION_DISK
Hostname: ${INSTALLATION_HOSTNAME}.${INSTALLATION_DOMAIN}\n
Disk: $INSTALLATION_DISK
" 9 60
case $? in
@ -357,7 +366,7 @@ function installation() {
chroot "${INSTALLATION_MOUNTPOINT}" /bin/ash -c "hwclock --systohc" || installationFailed
installationSubtaskTitle "Setup hostname"
chroot "${INSTALLATION_MOUNTPOINT}" /bin/ash -c "echo 'nov-alp1.localhost' > /etc/hostname" || installationFailed
chroot "${INSTALLATION_MOUNTPOINT}" /bin/ash -c "echo '${INSTALLATION_HOSTNAME}.${INSTALLATION_DOMAIN}' > /etc/hostname" || installationFailed
chroot "${INSTALLATION_MOUNTPOINT}" /bin/ash -c "hostname -F /etc/hostname" || installationFailed
chroot "${INSTALLATION_MOUNTPOINT}" /bin/ash -c "rc-update add hostname" || installationFailed