From: Plom Heller Date: Wed, 9 Sep 2026 05:27:59 +0000 (+0200) Subject: Run start_root_t490s.sh on first login. X-Git-Url: https://plomlompom.com/repos/foo.html?a=commitdiff_plain;h=fc30775acc19b553050396261faadcdf918721ab;p=confplom Run start_root_t490s.sh on first login. --- diff --git a/setup_scripts/_lib.sh b/setup_scripts/_lib.sh index fc4e768..b1695a4 100644 --- a/setup_scripts/_lib.sh +++ b/setup_scripts/_lib.sh @@ -5,6 +5,7 @@ cd "$(dirname "${SCRIPT_NAME}")" # constants unlikely to change DIRNAME_DEV=dev DIRNAME_SSH=.ssh +FNAME_FIRST_BOOT_PENDING=.first-boot-pending FNAME_INITRD=initrd.img FNAME_PROFILE=.profile FNAME_VMLINUZ=vmlinuz @@ -28,13 +29,15 @@ USERNAME=plom # constants derived from changeables PATH_BOOT_DEVICE="${PATH_DEV}/${NAME_BOOT_DEVICE}" +PATH_FIRST_BOOT_PENDING="/root/${FNAME_FIRST_BOOT_PENDING}" PATH_MY_SSH="${HOME}/${DIRNAME_SSH}" PATH_PARTITION_EFI="${PATH_BOOT_DEVICE}p${IDX_PARTITION_EFI}" PATH_PARTITION_LUKSVG="${PATH_BOOT_DEVICE}p${IDX_PARTITION_LUKSVG}" PATH_PARTITION_RESCUE="${PATH_BOOT_DEVICE}p${IDX_PARTITION_RESCUE}" PATH_PROFILE="${HOME}/${FNAME_PROFILE}" PATH_REPO=$(cd .. && pwd) -NAME_REPO_DIR=$(basename "${PATH_REPO}") +PATH_SCRIPTS="${PATH_REPO}/setup_scripts" +DIRNAME_REPO=$(basename "${PATH_REPO}") PATH_TEMPLATES="${PATH_REPO}/templates" # path constructors diff --git a/setup_scripts/install_debian.sh b/setup_scripts/install_debian.sh index 32796d9..c653a59 100755 --- a/setup_scripts/install_debian.sh +++ b/setup_scripts/install_debian.sh @@ -20,13 +20,16 @@ NAME_ROOT="${NAME_BOOT}" # constants derived from changeables PATH_EFI_NAME_BOOT="${PATH_EFI}/${NAME_BOOT}" +PATH_FIRST_BOOT_SCRIPT="/${NAME_DATA}/${PATH_SCRIPTS}//start_root_t490s.sh" PATH_MNT_APT_SOURCES="${PATH_MNT_ROOT}/etc/apt/sources.list" PATH_MNT_CRYPTTAB="${PATH_MNT_ROOT}${PATH_CRYPTTAB}" +PATH_MNT_FIRST_BOOT_PENDING="${PATH_MNT_ROOT}${PATH_FIRST_BOOT_PENDING}" 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_MNT_PROFILE="${PATH_MNT_ROOT}/root/${FNAME_PROFILE}" PATH_VG=$(path_vg "${NAME_LUKSVG}") # shellcheck disable=SC2034 # (used only inside templates/fstab, rendered via render_template) @@ -80,6 +83,12 @@ 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}" +msg 'Installing first-boot hook into root %s …' "${FNAME_PROFILE}" +touch "${PATH_MNT_FIRST_BOOT_PENDING}" +printf '[ -e "%s" ] && sh "%s"\n' \ + "${PATH_FIRST_BOOT_PENDING}" "${PATH_FIRST_BOOT_SCRIPT}" \ + >> "${PATH_MNT_PROFILE}" + msg 'For firmware-iwlwifi, enabling non-free-firmware in target sources.list …' sed -i 's/ main$/ main non-free-firmware/' "${PATH_MNT_APT_SOURCES}" diff --git a/setup_scripts/install_server.sh b/setup_scripts/install_server.sh index ae42373..387744f 100755 --- a/setup_scripts/install_server.sh +++ b/setup_scripts/install_server.sh @@ -7,7 +7,7 @@ OPTS_SSH_NEW_HOST="-o StrictHostKeyChecking=accept-new" # constants derived from changeables PATH_REPO_PARENT=$(dirname "${PATH_REPO}") -PATH_SETUP_SCRIPT="./${NAME_REPO_DIR}/setup_scripts/start_root_server.sh" +PATH_SETUP_SCRIPT="./${PATH_SCRIPTS}/start_root_server.sh" # inputs to confirm usage $# "server" @@ -21,7 +21,7 @@ check_tools scp ssh ssh-keygen tar PATH_TEMP=$(mktemp --directory) PATH_REPO_TAR="${PATH_TEMP}/${FNAME_REPO_TAR}" msg 'Creating tar of repo in temporary directory %s …' "${PATH_TEMP}" -tar cf "${PATH_REPO_TAR}" -C "${PATH_REPO_PARENT}" "${NAME_REPO_DIR}" +tar cf "${PATH_REPO_TAR}" -C "${PATH_REPO_PARENT}" "${DIRNAME_REPO}" msg 'Uploading repo tar to server …' if [ -e "${PATH_MY_KNOWN_HOSTS}" ]; then diff --git a/setup_scripts/setup_git_mirror.sh b/setup_scripts/setup_git_mirror.sh index c4e529d..e531f1a 100755 --- a/setup_scripts/setup_git_mirror.sh +++ b/setup_scripts/setup_git_mirror.sh @@ -6,7 +6,7 @@ PATH_GIT_BASE=/srv/git # constants derived from changeables PATH_GIT_DAEMON_UNIT=/etc/systemd/system/git-daemon.service -PATH_GIT_MIRROR="${PATH_GIT_BASE}/${NAME_REPO_DIR}.git" +PATH_GIT_MIRROR="${PATH_GIT_BASE}/${DIRNAME_REPO}.git" PATH_TEMPLATE_GIT_DAEMON="${PATH_TEMPLATES}/git-daemon.service" [ -e "${PATH_GIT_MIRROR}" ]\ @@ -29,7 +29,7 @@ render_template "${PATH_TEMPLATE_GIT_DAEMON}" >| "${PATH_GIT_DAEMON_UNIT}" systemctl daemon-reload systemctl enable --now git-daemon -msg 'Anonymous clone URL: git:///%s.git' "${NAME_REPO_DIR}" +msg 'Anonymous clone URL: git:///%s.git' "${DIRNAME_REPO}" msg 'Push updates later with: git push ssh://%s@%s' \ "${USERNAME}" "${PATH_GIT_MIRROR}" msg 'Firewall note: git daemon listens on port 9418/tcp.' diff --git a/setup_scripts/start_root_t490s.sh b/setup_scripts/start_root_t490s.sh index 9b1a429..8a93697 100755 --- a/setup_scripts/start_root_t490s.sh +++ b/setup_scripts/start_root_t490s.sh @@ -19,7 +19,7 @@ TLP_THRESH_STOP=80 PATH_TO_COPY="${PATH_REPO}/to_copy" # shellcheck disable=SC2034 # (used only inside templates/update-efi-hook, rendered via render_template) -PATH_UPDATE_EFI_SCRIPT="${PATH_REPO}/setup_scripts/update_efi.sh" +PATH_UPDATE_EFI_SCRIPT="${PATH_SCRIPTS}/update_efi.sh" # before any apt-get call gets a chance to pull in a kernel update of its own … msg 'Installing initramfs hook to refresh EFI boot files on kernel updates …' @@ -51,3 +51,6 @@ cp "${PATH_TO_COPY}/${FNAME_UDEV_RULES_BACKLIGHT}" "${PATH_UDEV_RULES}/" udevadm control --reload-rules udevadm trigger --action=add --subsystem-match=backlight usermod -a -G video "${USERNAME}" + +msg 'Clearing first-boot pending marker …' +rm -f "${PATH_FIRST_BOOT_PENDING}"