Skip to content
Open
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
24 changes: 23 additions & 1 deletion src/distro_testing/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,32 @@ if [ "$SSH_WAIT_RC" -ne 0 ]; then
exit 1
fi

# Run distro-specific boot-state checks before post-boot hooks mutate the image
if [ -x /test/hooks/post-ssh.sh ]; then
echo ""
echo "--- Step 3b: Post-SSH checks ---"
set +e
if [ -n "$ARTIFACTS_DIR" ]; then
/test/hooks/post-ssh.sh localhost "$SSH_PORT" "$ARTIFACTS_DIR"
else
/test/hooks/post-ssh.sh localhost "$SSH_PORT"
fi
POST_SSH_RC=$?
set -e
if [ "$POST_SSH_RC" -ne 0 ]; then
echo "Post-SSH hook failed"
if [ -n "$ARTIFACTS_DIR" ]; then
cp "$LOG_FILE" "$ARTIFACTS_DIR/qemu-boot.log" 2>/dev/null || true
echo "$POST_SSH_RC" > "$ARTIFACTS_DIR/exit-code"
fi
exit "$POST_SSH_RC"
fi
fi

# Run distro-specific post-boot setup (e.g. install packages, restart services)
if [ -x /test/hooks/post-boot.sh ]; then
echo ""
echo "--- Step 3b: Post-boot setup ---"
echo "--- Step 3c: Post-boot setup ---"
/test/hooks/post-boot.sh localhost "$SSH_PORT" || echo "WARNING: post-boot hook failed"
fi

Expand Down
37 changes: 35 additions & 2 deletions src/modules/gui/filesystem/opt/scripts/update_lightdm_conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
#!/bin/bash
set -e

LIGHTDM_CONF=/etc/lightdm/lightdm.conf
TTY1_AUTOLOGIN_CONF=/etc/systemd/system/getty@tty1.service.d/autologin.conf

set_lightdm_option() {
local key="$1"
local value="$2"

if grep -Eq "^#?${key}=" "${LIGHTDM_CONF}"; then
sed -i -E "s|^#?${key}=.*|${key}=${value}|" "${LIGHTDM_CONF}"
else
printf '%s=%s\n' "${key}" "${value}" >> "${LIGHTDM_CONF}"
fi
}

if [ ! -f /etc/updated_lightdm_conf ]; then
sed -i 's/UID_1000_PLACEHOLDER/'$(id -nu 1000)'/g' /etc/lightdm/lightdm.conf
gui_user="$(id -nu 1000)"

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

# raspi-config do_autologin uses a bitmask: 1=TTY, 2=GUI, 3=both.
# 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}"
fi

set_lightdm_option user-session guisession
set_lightdm_option autologin-session guisession
set_lightdm_option autologin-user "${gui_user}"

systemctl daemon-reload || true
systemctl try-restart getty@tty1.service || true

touch /etc/updated_lightdm_conf
# sudo shutdown -r now
fi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[Unit]
Description=on first boot set up the user name auto login in lightdm.service
Before=lightdm.service
[Service]
ExecStart=/opt/custompios/scripts/update_lightdm_conf
Type=oneshot
Expand Down