From ba6a52de0da72c5a307e4e7978398520d80a49aa Mon Sep 17 00:00:00 2001 From: Marcos Mello Date: Tue, 3 Mar 2020 20:21:46 -0300 Subject: [PATCH] Autologin rework * Passes through PAM (pam_systemd module) via login(1). This sets up systemd --user instance, which will create and listen on dbus session socket. * login(1) is called (via agetty(8)) with -p option, keeping the environment pam_systemd configured for the user, most importantly DBUS_SESSION_BUS_ADDRESS. * Thus dbus-launch call in /etc/X11/xinit/xinitrc is unnecessary. * autologin.conf drop-in configured in the template unit (getty@.service) to make autologin work on all virtual consoles. --- airootfs/etc/X11/xinit/xinitrc | 1 - airootfs/etc/issue | 13 ++++++ .../system/getty@.service.d/autologin.conf | 3 ++ .../getty@tty1.service.d/autologin.conf | 3 -- airootfs/usr/bin/bashlogin | 45 ------------------- build.sh | 2 +- 6 files changed, 17 insertions(+), 50 deletions(-) create mode 100644 airootfs/etc/issue create mode 100644 airootfs/etc/systemd/system/getty@.service.d/autologin.conf delete mode 100644 airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf delete mode 100755 airootfs/usr/bin/bashlogin diff --git a/airootfs/etc/X11/xinit/xinitrc b/airootfs/etc/X11/xinit/xinitrc index aa2ef69..d790982 100755 --- a/airootfs/etc/X11/xinit/xinitrc +++ b/airootfs/etc/X11/xinit/xinitrc @@ -3,5 +3,4 @@ [ -x /usr/bin/xset ] && /usr/bin/xset s off >/dev/null 2>&1 & [ -x /usr/bin/xset ] && /usr/bin/xset r >/dev/null 2>&1 & -export $(dbus-launch) exec /usr/bin/startxfce4 diff --git a/airootfs/etc/issue b/airootfs/etc/issue new file mode 100644 index 0000000..cf7ce87 --- /dev/null +++ b/airootfs/etc/issue @@ -0,0 +1,13 @@ +\e[01;31m ======== \e[01;37mSystemRescueCd \m\e[01;31m ---- \e[01;37m%ISO_VERSION%\e[01;31m ======== \e[01;37m\l\e[00;37m/6\e[01;31m ======== + \e[00;31mhttp://www.system-rescue-cd.org/ + +\e[00;31m*\e[01;31m Console environment\e[00;37m : + Run \e[01;37msetkmap\e[00;37m to choose the keyboard layout + +\e[00;31m*\e[01;31m Graphical environment\e[00;37m : + Type \e[01;37mstartx\e[00;37m to run the graphical environment + X.Org comes with the XFCE environment and several graphical tools: + \e[00;31m-\e[00;37m Partition manager: .. \e[01;37mgparted\e[00;37m + \e[00;31m-\e[00;37m Web browser: ........ \e[01;37mfirefox\e[00;37m + \e[00;31m-\e[00;37m Text editor: ........ \e[01;37mfeatherpad\e[00;37m + diff --git a/airootfs/etc/systemd/system/getty@.service.d/autologin.conf b/airootfs/etc/systemd/system/getty@.service.d/autologin.conf new file mode 100644 index 0000000..8853573 --- /dev/null +++ b/airootfs/etc/systemd/system/getty@.service.d/autologin.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin root --login-options '-p -f -- \\u' --noclear %I $TERM diff --git a/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf b/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf deleted file mode 100644 index 80416ec..0000000 --- a/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf +++ /dev/null @@ -1,3 +0,0 @@ -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin root -l /usr/bin/bashlogin --noclear %I 38400 linux diff --git a/airootfs/usr/bin/bashlogin b/airootfs/usr/bin/bashlogin deleted file mode 100755 index 8abfdb6..0000000 --- a/airootfs/usr/bin/bashlogin +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -cd /root - -# Environment variables -export LANG=en_US.utf8 -export HOME=/root -export SHELL=/bin/bash -export PATH=/sbin:/bin:/usr/sbin:/usr/bin -export path="/sbin /bin /usr/sbin /usr/bin" -export USER=root - -# Colors -lc1='\e[01;31m' # light red -dc1='\e[00;31m' # dark red -lc2='\e[01;37m' # white -dc2='\e[00;37m' # gray - -# Fix broken console with utf8 in the alternative-kernels -echo -n -e '\033%G' -kbd_mode -u - -LINES=$(stty size|cut -d" " -f1) -fbecho() -{ - [ $LINES -ge 28 ] && echo -} - -fbecho -echo -e "${lc1} ======== ${lc2}SystemRescueCd %ISO_ARCH%${lc1} ----- ${lc2}%ISO_VERSION%${lc1} ======== ${lc2}$(basename $(tty))${dc2}/6 ${lc1}==" -echo -e " ${dc1}http://www.system-rescue-cd.org/" -echo -echo -e "${dc1}*${lc1} Console environment${dc2} : " -echo -e " Run ${lc2}setkmap${dc2} to choose the keyboard layout" -echo -echo -e "${dc1}*${lc1} Graphical environment${dc2} : " -echo -e " Type ${lc2}startx${dc2} to run the graphical environment" -echo -e " X.Org comes with the XFCE environment and several graphical tools:" -echo -e " ${dc1}-${dc2} Partition manager:..${lc2}gparted${dc2}" -echo -e " ${dc1}-${dc2} Web browser:........${lc2}firefox${dc2}" -echo -e " ${dc1}-${dc2} Text editor:........${lc2}featherpad${dc2}" -echo -fbecho - -# ============ SHELL PROMPT ============================ -exec $SHELL --login diff --git a/build.sh b/build.sh index 4b51d69..ca2d2f3 100755 --- a/build.sh +++ b/build.sh @@ -116,7 +116,7 @@ make_customize_airootfs() { s|%ISO_VERSION%|${iso_version}|g; s|%ISO_ARCH%|${arch}|g; s|%INSTALL_DIR%|${install_dir}|g" \ - ${script_path}/airootfs/usr/bin/bashlogin > ${work_dir}/${arch}/airootfs/usr/bin/bashlogin + ${script_path}/airootfs/etc/issue > ${work_dir}/${arch}/airootfs/etc/issue curl -o ${work_dir}/${arch}/airootfs/etc/pacman.d/mirrorlist 'https://www.archlinux.org/mirrorlist/?country=all&protocol=http&use_mirror_status=on'