Skip to content
Snippets Groups Projects
Commit f196b014 authored by Alberto LIVIO BECCARIA's avatar Alberto LIVIO BECCARIA
Browse files

Autologin per LightDM

parent b3a373c3
No related branches found
No related tags found
No related merge requests found
#!/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
File moved
[Unit] [Unit]
Description=KDM Autologin Description=DM Autologin
After=esame-mk-homedir.service esame-desktop-wallpaper.service esame-firefox-home.service esame-virtualbox.service After=esame-mk-homedir.service esame-desktop-wallpaper.service esame-firefox-home.service esame-virtualbox.service
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
EnvironmentFile=-/local/esame-machine.conf EnvironmentFile=-/local/esame-machine.conf
ExecStart=/usr/libexec/labmanager/dm-autologin start ExecStart=/usr/libexec/labmanager/lightdm-autologin start
ExecStop=/usr/libexec/labmanager/dm-autologin stop ExecStop=/usr/libexec/labmanager/lightdm-autologin stop
[Install] [Install]
WantedBy=esame.target esamekiosk.target esameshow.target WantedBy=esame.target esamekiosk.target esameshow.target
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment