Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/modules/gui/filesystem/opt/scripts/update_lightdm_conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,26 @@ set_lightdm_option() {
}

if [ ! -f /etc/updated_lightdm_conf ]; then
gui_user="$(id -nu 1000)"
# uid 1000 may not exist yet if userconf-pi has not processed userconf.txt
# yet (first boot ordering); fall back to the placeholder name.
gui_user="$(id -nu 1000 2>/dev/null || true)"
if [ -z "${gui_user}" ]; then
gui_user="pi"
fi

sed -i "s/UID_1000_PLACEHOLDER/${gui_user}/g" "${LIGHTDM_CONF}"

# raspi-config do_autologin uses a bitmask: 1=TTY, 2=GUI, 3=both.
# (Older raspi-config versions without the bitmask return non-zero here,
# and we apply the GUI autologin manually below.)
# FullPageOS needs GUI autologin without opening a local tty shell.
if ! SUDO_USER="${gui_user}" raspi-config nonint do_autologin 2; then
rm -f "${TTY1_AUTOLOGIN_CONF}"
rmdir --ignore-fail-on-non-empty "$(dirname "${TTY1_AUTOLOGIN_CONF}")" 2>/dev/null || true
set_lightdm_option autologin-user "${gui_user}"
# cancel-rename (userconf-pi) may have re-created the TTY autologin
# drop-in via do_boot_behaviour B3/B4 right before us (we are ordered
# After=userconfig.service), so always clean it up here.
rm -f "${TTY1_AUTOLOGIN_CONF}"
rmdir --ignore-fail-on-non-empty "$(dirname "${TTY1_AUTOLOGIN_CONF}")" 2>/dev/null || true
if SUDO_USER="${gui_user}" raspi-config nonint do_autologin 2 2>/dev/null; then
: # newer raspi-config: bitmask 2 = GUI-only autologin, TTY drop-in removed by raspi-config
fi

set_lightdm_option user-session guisession
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[Unit]
Description=on first boot set up the user name auto login in lightdm.service
Before=lightdm.service
# Run after the userconf-pi first-boot dialog: cancel-rename (inside
# userconfig.service) applies do_boot_behaviour B3/B4 which re-creates the
# getty@tty1 autologin drop-in and re-enables getty@tty1. If we run before
# it, our cleanup is silently undone (GUI distros end up with a TTY
# autologin shell - https://github.com/guysoft/FullPageOS/issues/639).
After=userconfig.service
[Service]
ExecStart=/opt/custompios/scripts/update_lightdm_conf
Type=oneshot
Expand Down