x11-autologin: detect default lightdm session

This commit is contained in:
Andrey Cherepanov 2019-05-27 18:34:37 +03:00 committed by Michael Shigorin
parent 7755845dcd
commit 5b7c189385

View File

@ -55,9 +55,11 @@ fi
LIGHTDM_CONF=/etc/lightdm/lightdm.conf
if [ -f "$LIGHTDM_CONF" ]; then
backup "$LIGHTDM_CONF"
default_session="$(ls -1 /usr/share/xsessions/*.desktop | sed -n 's/^.*\/\([^/]\+\)\.desktop$/\1/;1p')"
sed -i \
-e "s/^#\(autologin-user=\).*$/\1$USER/" \
-e "s/^#\(autologin-user-timeout=0\)/\1/" \
-e "s/^#(autologin-session=).*$/\1$default_session/" \
"$LIGHTDM_CONF"
backup "/etc/group"
add_nopasswdlogin_group lightdm ||: