462462# # safely manage those
463463# # TODO: consider cases with leading spaces
464464# # TODO: ignore comments
465- if grep --quiet --recursive --ignore-case -- ' ^\[Seat:[^*]' /etc/lightdm; then
466- printf ' %s\n' " ERROR: Multi-seat lightdm configuration detected, cannot proceed!" >&2
467- exit 1
465+ if [ -d /etc/lightdm ]; then
466+ if grep --quiet --recursive --ignore-case -- ' ^\[Seat:[^*]' /etc/lightdm; then
467+ printf ' %s\n' " ERROR: Multi-seat lightdm configuration detected, cannot proceed!" >&2
468+ exit 1
469+ fi
468470fi
469471
470- readarray -t autologin_users_lightdm < <(
471- grep --recursive --ignore-case -- ' ^autologin-user=' /etc/lightdm \
472- | filter_out_sysmaint_maybe \
473- | awk -F' =' ' { print $NF }' || true
474- ) || true
472+ autologin_users_lightdm=()
473+ if [ -d /etc/lightdm ]; then
474+ readarray -t autologin_users_lightdm < <(
475+ grep --recursive --ignore-case -- ' ^autologin-user=' /etc/lightdm \
476+ | filter_out_sysmaint_maybe \
477+ | awk -F' =' ' { print $NF }' || true
478+ ) || true
479+ fi
475480true " INFO: Collected list of users with lightdm autologin enabled."
476481
477482readarray -t autologin_users_sddm < <(
@@ -487,11 +492,23 @@ readarray -t autologin_users_sddm < <(
487492) || true
488493true " INFO: Collected list of users with sddm autologin enabled."
489494
495+ readarray -t autologin_users_greetd < <(
496+ for file_name in /etc/greetd/config.toml.d/* ; do
497+ if ! [ -f " ${file_name} " ]; then
498+ continue
499+ fi
500+ get_config_section " ${file_name} " ' initial_session' \
501+ | grep -- ' ^user\s*=\s*"[^"]*"$' \
502+ | filter_out_sysmaint_maybe \
503+ | sed ' s/^.*"\([^"]*\)"$/\1/' || true
504+ done
505+ ) || true
506+
490507readarray -t autologin_users < <(
491- IFS= $' \n '
492- printf ' %s\n%s\n ' \
493- " ${autologin_users_lightdm[* ]} " \
494- " ${autologin_users_sddm[* ]} " \
508+ printf ' %s \n' \
509+ " ${autologin_users_lightdm[@]} " \
510+ " ${autologin_users_sddm[@ ]} " \
511+ " ${autologin_users_greetd[@ ]} " \
495512 | sed ' /^$/d' \
496513 | sort -u
497514)
0 commit comments