From f799a11348b04c0de9e01e8a1d141ff1df763e6a Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 4 Dec 2025 15:08:09 +0100 Subject: [PATCH] Refactor auto-login setup for various init systems Simplifies and improves auto-login configuration for systemd, openrc, and sysvinit. Removes unnecessary service reloads and restarts during installation, and directly modifies configuration files where appropriate. --- misc/install.func | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/misc/install.func b/misc/install.func index 12edea009..577cc6a76 100644 --- a/misc/install.func +++ b/misc/install.func @@ -854,39 +854,40 @@ customize() { case "$INIT_SYSTEM" in systemd) # Configure getty for auto-login - local GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" - mkdir -p "$(dirname "$GETTY_OVERRIDE")" - cat >"$GETTY_OVERRIDE" <"$GETTY_OVERRIDE" </dev/null || true + fi ;; openrc) - # Alpine/Gentoo: use inittab for auto-login - pkg_install util-linux 2>/dev/null || true - - # Create persistent autologin boot script - mkdir -p /etc/local.d - cat <<'EOFSCRIPT' >/etc/local.d/autologin.start -#!/bin/sh -sed -i 's|^tty1::respawn:.*|tty1::respawn:/sbin/agetty --autologin root --noclear tty1 38400 linux|' /etc/inittab -kill -HUP 1 -EOFSCRIPT - chmod +x /etc/local.d/autologin.start - rc-update add local 2>/dev/null || true - /etc/local.d/autologin.start 2>/dev/null || true + # Alpine/Gentoo: modify inittab for auto-login + if [[ -f /etc/inittab ]]; then + sed -i 's|^tty1::respawn:.*|tty1::respawn:/sbin/agetty --autologin root --noclear tty1 38400 linux|' /etc/inittab + fi touch /root/.hushlogin ;; sysvinit) - # Devuan/older systems + # Devuan/older systems - just modify inittab, no telinit needed during install if [[ -f /etc/inittab ]]; then sed -i 's|^1:2345:respawn:/sbin/getty.*|1:2345:respawn:/sbin/agetty --autologin root tty1 38400 linux|' /etc/inittab - telinit q 2>/dev/null || true fi ;; esac