diff --git a/bin-ubuntu/lightdm-autologin b/bin-ubuntu/lightdm-autologin new file mode 100755 index 0000000000000000000000000000000000000000..c7f6955964c07cbd04cc8fae7817dd8657f45807 --- /dev/null +++ b/bin-ubuntu/lightdm-autologin @@ -0,0 +1,49 @@ +#!/bin/bash + +clear() { + sed -i '/autologin-user=/s/^#*/#/' /etc/lightdm/lightdm.conf + sed -i '/session-cleanup-script=/s/^#*/#/' /etc/lightdm/lightdm.conf +} + +dm_restart() { + systemctl restart display-manager.service +} + +stop() { + clear + #dm_restart +} + +start() { + echo "LightDM AUTOLOGIN FOR ${ESAME_USER}" + + # 1) .* get expanded by the shell if in double quotes... + # 2) $ESAME_USER does not get expanded if in single quotes... + # 3) We want the former as is, and the latter expanded. + # So, one solution is the following: + SEDCMD="/#*autologin-user=.*/s/"'.*'"/autologin-user=$ESAME_USER/" + sed -i "$SEDCMD" /etc/lightdm/lightdm.conf + # enable auto-relogin (remove the comment in the file) + sed -i '/session-cleanup-script=/s/^#*//' /etc/lightdm/lightdm.conf + + #sleep 5 + dm_restart +} + +case "$1" in +'start') + start + ;; +'stop') + stop + ;; +'restart') + stop + start + ;; +*) + echo "Usage: $0 { start | stop | restart }"; + exit 1; + ;; +esac +exit 0 diff --git a/bin-ubuntu/dm-autologin b/bin-ubuntu/sddm-autologin similarity index 100% rename from bin-ubuntu/dm-autologin rename to bin-ubuntu/sddm-autologin diff --git a/systemd-ubuntu/esame-dm-autologin.service b/systemd-ubuntu/esame-dm-autologin.service index 908c74d75029156c2b2e7717d6d3bab9b8855467..7d70332f918c512a4873096e666646815672a50e 100644 --- a/systemd-ubuntu/esame-dm-autologin.service +++ b/systemd-ubuntu/esame-dm-autologin.service @@ -1,13 +1,13 @@ [Unit] -Description=KDM Autologin +Description=DM Autologin After=esame-mk-homedir.service esame-desktop-wallpaper.service esame-firefox-home.service esame-virtualbox.service [Service] Type=oneshot RemainAfterExit=yes EnvironmentFile=-/local/esame-machine.conf -ExecStart=/usr/libexec/labmanager/dm-autologin start -ExecStop=/usr/libexec/labmanager/dm-autologin stop +ExecStart=/usr/libexec/labmanager/lightdm-autologin start +ExecStop=/usr/libexec/labmanager/lightdm-autologin stop [Install] WantedBy=esame.target esamekiosk.target esameshow.target