Merge pull request #9600 from chewitt/local-login

buildsystem: support optional configuration of local console login
This commit is contained in:
CvH 2024-12-31 11:46:58 +01:00 committed by GitHub
commit 80497691ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 51 additions and 8 deletions

View File

@ -87,6 +87,8 @@
# debug tty path
DEBUG_TTY="/dev/tty3"
# local console login prompt (yes / no)
LOCAL_LOGIN="no"
### KODI SETTINGS ###
# Mediacenter to use (kodi / no)

View File

@ -134,14 +134,16 @@ post_makeinstall_target() {
safe_remove ${INSTALL}/usr/lib/udev/rules.d/71-seat.rules
safe_remove ${INSTALL}/usr/lib/udev/rules.d/73-seat-late.rules
# remove getty units, we dont want a console
safe_remove ${INSTALL}/usr/lib/systemd/system/autovt@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/console-getty.service
safe_remove ${INSTALL}/usr/lib/systemd/system/container-getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/getty.target
safe_remove ${INSTALL}/usr/lib/systemd/system/getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/serial-getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/*.target.wants/getty.target
if [ "${LOCAL_LOGIN}" = "no" ]; then
# remove getty units, we dont want a console
safe_remove ${INSTALL}/usr/lib/systemd/system/autovt@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/console-getty.service
safe_remove ${INSTALL}/usr/lib/systemd/system/container-getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/getty.target
safe_remove ${INSTALL}/usr/lib/systemd/system/getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/serial-getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/*.target.wants/getty.target
fi
# remove other notused or nonsense stuff (our /etc is ro)
safe_remove ${INSTALL}/usr/lib/systemd/systemd-update-done
@ -206,6 +208,10 @@ post_makeinstall_target() {
sed -e "s,^.*SystemMaxUse=.*$,SystemMaxUse=10M,g" -i ${INSTALL}/etc/systemd/journald.conf
# tune logind.conf
if [ "${LOCAL_LOGIN}" = "yes" ]; then
sed -e "s,^.*NAutoVTs=.*$,NAutoVTs=2,g" -i ${INSTALL}/etc/systemd/logind.conf
sed -e "s,^.*ReserveVT=.*$,ReserveVT=6,g" -i ${INSTALL}/etc/systemd/logind.conf
fi
sed -e "s,^.*HandleLidSwitch=.*$,HandleLidSwitch=ignore,g" -i ${INSTALL}/etc/systemd/logind.conf
if [ "${DISPLAYSERVER}" = "no" ]; then
sed -e "s,^.*HandlePowerKey=.*$,HandlePowerKey=poweroff,g" -i ${INSTALL}/etc/systemd/logind.conf
@ -308,4 +314,7 @@ post_install() {
enable_service systemd-timesyncd.service
enable_service systemd-timesyncd-setup.service
enable_service systemd-userdbd.socket
if [ "${LOCAL_LOGIN}" = "yes" ]; then
enable_service getty@tty0.service
fi
}

View File

@ -0,0 +1,28 @@
[Unit]
Description=Getty on %I
After=getty-pre.target
Before=getty.target
IgnoreOnIsolate=yes
ConditionPathExists=/dev/tty0
[Service]
ExecStart=-/sbin/agetty -o '-p -- \\u' --noissue --noclear --nohostname - $TERM
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
IgnoreSIGPIPE=no
SendSIGHUP=yes
ImportCredential=agetty.*
ImportCredential=login.*
UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
[Install]
WantedBy=getty.target
DefaultInstance=tty1

View File

@ -59,6 +59,10 @@ PKG_CONFIGURE_OPTS_TARGET="${UTILLINUX_CONFIG_DEFAULT} \
--enable-mount \
--enable-nologin"
if [ "${LOCAL_LOGIN}" = "yes" ]; then
PKG_CONFIGURE_OPTS_TARGET+=" --enable-agetty"
fi
if [ "${SWAP_SUPPORT}" = "yes" ]; then
PKG_CONFIGURE_OPTS_TARGET+=" --enable-swapon"
fi