File tree Expand file tree Collapse file tree
root_init/etc/systemd/system Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,10 +63,32 @@ if [ "$SSH_WAIT_RC" -ne 0 ]; then
6363 exit 1
6464fi
6565
66+ # Run distro-specific boot-state checks before post-boot hooks mutate the image
67+ if [ -x /test/hooks/post-ssh.sh ]; then
68+ echo " "
69+ echo " --- Step 3b: Post-SSH checks ---"
70+ set +e
71+ if [ -n " $ARTIFACTS_DIR " ]; then
72+ /test/hooks/post-ssh.sh localhost " $SSH_PORT " " $ARTIFACTS_DIR "
73+ else
74+ /test/hooks/post-ssh.sh localhost " $SSH_PORT "
75+ fi
76+ POST_SSH_RC=$?
77+ set -e
78+ if [ " $POST_SSH_RC " -ne 0 ]; then
79+ echo " Post-SSH hook failed"
80+ if [ -n " $ARTIFACTS_DIR " ]; then
81+ cp " $LOG_FILE " " $ARTIFACTS_DIR /qemu-boot.log" 2> /dev/null || true
82+ echo " $POST_SSH_RC " > " $ARTIFACTS_DIR /exit-code"
83+ fi
84+ exit " $POST_SSH_RC "
85+ fi
86+ fi
87+
6688# Run distro-specific post-boot setup (e.g. install packages, restart services)
6789if [ -x /test/hooks/post-boot.sh ]; then
6890 echo " "
69- echo " --- Step 3b : Post-boot setup ---"
91+ echo " --- Step 3c : Post-boot setup ---"
7092 /test/hooks/post-boot.sh localhost " $SSH_PORT " || echo " WARNING: post-boot hook failed"
7193fi
7294
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ set -e
3+
4+ LIGHTDM_CONF=/etc/lightdm/lightdm.conf
5+ TTY1_AUTOLOGIN_CONF=/etc/systemd/system/getty@tty1.service.d/autologin.conf
6+
7+ set_lightdm_option () {
8+ local key=" $1 "
9+ local value=" $2 "
10+
11+ if grep -Eq " ^#?${key} =" " ${LIGHTDM_CONF} " ; then
12+ sed -i -E " s|^#?${key} =.*|${key} =${value} |" " ${LIGHTDM_CONF} "
13+ else
14+ printf ' %s=%s\n' " ${key} " " ${value} " >> " ${LIGHTDM_CONF} "
15+ fi
16+ }
17+
218if [ ! -f /etc/updated_lightdm_conf ]; then
3- sed -i ' s/UID_1000_PLACEHOLDER/' $( id -nu 1000) ' /g' /etc/lightdm/lightdm.conf
19+ gui_user=" $( id -nu 1000) "
20+
21+ sed -i " s/UID_1000_PLACEHOLDER/${gui_user} /g" " ${LIGHTDM_CONF} "
22+
23+ # raspi-config do_autologin uses a bitmask: 1=TTY, 2=GUI, 3=both.
24+ # FullPageOS needs GUI autologin without opening a local tty shell.
25+ if ! SUDO_USER=" ${gui_user} " raspi-config nonint do_autologin 2; then
26+ rm -f " ${TTY1_AUTOLOGIN_CONF} "
27+ rmdir --ignore-fail-on-non-empty " $( dirname " ${TTY1_AUTOLOGIN_CONF} " ) " 2> /dev/null || true
28+ set_lightdm_option autologin-user " ${gui_user} "
29+ fi
30+
31+ set_lightdm_option user-session guisession
32+ set_lightdm_option autologin-session guisession
33+ set_lightdm_option autologin-user " ${gui_user} "
34+
35+ systemctl daemon-reload || true
36+ systemctl try-restart getty@tty1.service || true
37+
438 touch /etc/updated_lightdm_conf
5- # sudo shutdown -r now
639fi
Original file line number Diff line number Diff line change 11[Unit]
22Description =on first boot set up the user name auto login in lightdm.service
3+ Before =lightdm.service
34[Service]
45ExecStart =/opt/custompios/scripts/update_lightdm_conf
56Type =oneshot
You can’t perform that action at this time.
0 commit comments