Commit 38e149a7 authored by Michael Shigorin's avatar Michael Shigorin

x11-autologin: harden the previous commit

It could result in a broken config given broken chroot state; it's of no practical difference as both cases just won't work but we can at least provide meaningful diagnostics (and a bit of perfectionism, heh). Fixes: 2527fe94da2e810cf5d52cf548f84456fd5a6b4d
parent 5b7c1893
......@@ -56,10 +56,16 @@ 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')"
if [ -n "$default_session" ]; then
sed -i \
-e "s/^#(autologin-session=).*$/\1$default_session/" \
"$LIGHTDM_CONF"
else
echo "** WARNING: no sessions found in /usr/share/xsessions/" >&2
fi
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 ||:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment