shell-host/modules/lightdm/readme.md

1.5 KiB

Lightdm (gdm) is the login manager for linux ubuntu and mint (by default)

If you need setup and cleanup that is ONLY done at lightdm login/logout then one can run a script to setup and cleanup the session by

running the loginout-install script, requires sudo

module_load loginout-install; loginout_install <user> # default is current user

after loading common scripts this will ask if you want to add the .session folder for the user

or if you just need to add a user .session folder afterward

module_load loginout-install; add_user_session <user>

the script does this

in /etc/lightdm/lightdm.conf.d adds a file 50-setup-cleanup.conf

[Seat:*]
session-cleanup-script=/opt/scripts/lightdm-cleanup.sh
session-setup-script=/opt/scripts/lightdm-setup.sh

in /opt/scripts put two files below and make sure they are +x executable

#!/bin/bash
#lightdm-setup.sh
echo "setup for ${USER}:${HOME} $(date)" >> /opt/scripts/lightdm.log
log=${HOME}/.session.log
if [[ -e $HOME/.session_login ]]; then su -c "/bin/bash $HOME/.session_login 1>>${log} 2>>${log} || true" $USER; fi
#!/bin/bash
#lightdm-cleanup.sh
echo "cleanup for ${USER}:${HOME} $(date)" >> /opt/scripts/lightdm.log
log=${HOME}/.session.log
if [[ -e $HOME/.session_logout ]]; then su -c "/bin/bash $HOME/.session_logout 1>>${log} 2>>${log} || true" $USER; fi

then in the user home puts .session_login and .session_logout files both executable in those you can do anything like bindfs and fusermount -u

make sure you restart lightdm or reboot sdr lightdm