home · contact · privacy
Use boot label as hostname. master
authorPlom Heller <plom@plomlompom.com>
Tue, 8 Sep 2026 20:33:59 +0000 (22:33 +0200)
committerPlom Heller <plom@plomlompom.com>
Tue, 8 Sep 2026 20:33:59 +0000 (22:33 +0200)
setup_scripts/install_debian.sh

index fa4d35343cacf19ca2757f70a08f181e040bff36..456142448bbef17d08b57f42315d301067ccb6d7 100755 (executable)
@@ -8,6 +8,8 @@ FNAME_VMLINUZ=vmlinuz
 PATH_CRYPTTAB=/etc/crypttab
 PATH_EFI=/boot/efi
 PATH_FSTAB=/etc/fstab
 PATH_CRYPTTAB=/etc/crypttab
 PATH_EFI=/boot/efi
 PATH_FSTAB=/etc/fstab
+PATH_HOSTNAME=/etc/hostname
+PATH_HOSTS=/etc/hosts
 PATH_INTERFACES=/etc/network/interfaces
 PATH_NM_CONNECTIONS=/etc/NetworkManager/system-connections
 
 PATH_INTERFACES=/etc/network/interfaces
 PATH_NM_CONNECTIONS=/etc/NetworkManager/system-connections
 
@@ -27,6 +29,8 @@ PATH_EFI_NAME_BOOT="${PATH_EFI}/${NAME_BOOT}"
 PATH_MNT_APT_SOURCES="${PATH_MNT_ROOT}/etc/apt/sources.list"
 PATH_MNT_CRYPTTAB="${PATH_MNT_ROOT}${PATH_CRYPTTAB}"
 PATH_MNT_FSTAB="${PATH_MNT_ROOT}${PATH_FSTAB}"
 PATH_MNT_APT_SOURCES="${PATH_MNT_ROOT}/etc/apt/sources.list"
 PATH_MNT_CRYPTTAB="${PATH_MNT_ROOT}${PATH_CRYPTTAB}"
 PATH_MNT_FSTAB="${PATH_MNT_ROOT}${PATH_FSTAB}"
+PATH_MNT_HOSTNAME="${PATH_MNT_ROOT}${PATH_HOSTNAME}"
+PATH_MNT_HOSTS="${PATH_MNT_ROOT}${PATH_HOSTS}"
 PATH_MNT_NM_CONN="${PATH_MNT_ROOT}${PATH_NM_CONNECTIONS}/${FNAME_NM_CONN}"
 PATH_MNT_NM_CONNECTIONS="${PATH_MNT_ROOT}${PATH_NM_CONNECTIONS}"
 PATH_VG=$(path_vg "${NAME_LUKSVG}")
 PATH_MNT_NM_CONN="${PATH_MNT_ROOT}${PATH_NM_CONNECTIONS}/${FNAME_NM_CONN}"
 PATH_MNT_NM_CONNECTIONS="${PATH_MNT_ROOT}${PATH_NM_CONNECTIONS}"
 PATH_VG=$(path_vg "${NAME_LUKSVG}")
@@ -78,6 +82,10 @@ printf '%s UUID=%s none luks\n' \
     "${NAME_LUKSVG}" "$(cryptsetup luksUUID "${PARTITION}")" \
     >| "${PATH_MNT_CRYPTTAB}"
 
     "${NAME_LUKSVG}" "$(cryptsetup luksUUID "${PARTITION}")" \
     >| "${PATH_MNT_CRYPTTAB}"
 
+msg 'Setting up hostname …'
+printf '%s\n' "${NAME_BOOT}" >| "${PATH_MNT_HOSTNAME}"
+printf '127.0.1.1\t%s\n' "${NAME_BOOT}" >> "${PATH_MNT_HOSTS}"
+
 # for firmware-iwlwifi below (as debootstrap only enables "main" by default)
 msg 'Enabling non-free-firmware component in target sources.list …'
 sed -i 's/ main$/ main non-free-firmware/' "${PATH_MNT_APT_SOURCES}"
 # for firmware-iwlwifi below (as debootstrap only enables "main" by default)
 msg 'Enabling non-free-firmware component in target sources.list …'
 sed -i 's/ main$/ main non-free-firmware/' "${PATH_MNT_APT_SOURCES}"