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.
This commit is contained in:
Marcos Mello 2020-03-03 20:21:46 -03:00
parent 8be1b91977
commit ba6a52de0d
6 changed files with 17 additions and 50 deletions

View file

@ -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

13
airootfs/etc/issue Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --login-options '-p -f -- \\u' --noclear %I $TERM

View file

@ -1,3 +0,0 @@
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root -l /usr/bin/bashlogin --noclear %I 38400 linux

View file

@ -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

View file

@ -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'