From da2d22d423c5085cd65f30f53a0658b6e5e05c71 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Thu, 28 Mar 2024 16:02:33 +0100
Subject: autologinhook: automatically log in with lightdm

---
 useraddhook/customize.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'useraddhook/customize.sh')

diff --git a/useraddhook/customize.sh b/useraddhook/customize.sh
index 14230a2..d405b72 100755
--- a/useraddhook/customize.sh
+++ b/useraddhook/customize.sh
@@ -10,6 +10,7 @@
 #  - requires the passwd and coreutils packages installed inside the chroot
 #  - adds the new user to the sudo group if it exists
 #  - ~/.ssh/authorized_keys files is copied from root user if it exists
+#  - enables immediate autologin via lightdm if installed
 #
 # Example usage:
 #
@@ -34,3 +35,10 @@ if [ -e "$1"/root/.ssh/authorized_keys ]; then
 	chroot "$1" install -o "$USERNAME" -g "$USERNAME" -m 700 -d "/home/$USERNAME/.ssh"
 	chroot "$1" install -o "$USERNAME" -g "$USERNAME" -t "/home/$USERNAME/.ssh" /root/.ssh/authorized_keys
 fi
+if [ -e "$1/etc/lightdm/lightdm.conf" ]; then
+	cat >>"$1/etc/lightdm/lightdm.conf" <<EOF
+[SeatDefaults]
+autologin-user=$USERNAME
+autologin-user-timeout=0
+EOF
+fi
-- 
cgit v1.2.3