75 lines
1.9 KiB
Bash
Executable File
75 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
loginout_install() {
|
|
module_load confirm
|
|
module_load helpers
|
|
|
|
[[ ! $(systemctl list-units | grep lightdm) ]] && echo lightdm not running on this machine, aborting && return
|
|
|
|
SDIR=$(adirname "${BASH_SOURCE[0]}")
|
|
# echo source directory: $SDIR
|
|
|
|
|
|
pushd $SDIR &> /dev/null || exit
|
|
[[ ! -d /etc/lightdm/lightdm.conf.d ]] && mkdir -p /etc/lightdm/lightdm.conf.d
|
|
echo copying 50-setup-cleanup.conf to /etc/lightdm/lightdm.conf.d
|
|
sudo cp -f 50-setup-cleanup.conf /etc/lightdm/lightdm.conf.d
|
|
|
|
if [[ ! -d /opt/session ]]; then
|
|
if [[ ! $(mkdir -p /opt/session) ]]; then
|
|
echo unable to make /opt/session with user $USER, elevating to sudo
|
|
_sudo="sudo"
|
|
[[ $($_sudo mkdir -p /opt/session) ]] && echo can not make /opt/session, aborting && return
|
|
fi
|
|
fi
|
|
|
|
|
|
echo copying lightdm-cleanup.sh and lightdm-setup.sh to /opt/session
|
|
$_sudo cp -f scripts/* /opt/session
|
|
echo setting execute permissions
|
|
$_sudo chmod -R +x /opt/session/*.sh
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
_user=${1:-${USER}}
|
|
confirm "add a user .session folder for $_user" && add_user_session $1
|
|
|
|
|
|
}
|
|
|
|
function add_user_session {
|
|
|
|
module_load confirm
|
|
module_load helpers
|
|
|
|
SDIR=$(adirname "${BASH_SOURCE[0]}")
|
|
# echo source directory: $SDIR
|
|
|
|
pushd $SDIR &> /dev/null || exit
|
|
|
|
_user=${1:-${USER}}
|
|
|
|
[[ ! $(user_exists $_user) ]] && echo user $_user does not exist, aborting && return
|
|
_home=$(bash -c "cd ~$(printf %q $_user) && pwd")
|
|
|
|
echo making $_home/.session folder for $_user
|
|
# mkdir $USER/.session
|
|
|
|
sudo -H -E -u "$_user" -s /bin/bash cpy.session.sh
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
# confirm "do you want to install WidevineCDM for digital streaming rights?"
|
|
# if [ $? -eq 0 ]; then
|
|
# module_load widevine-install
|
|
# widevine_install
|
|
# fi
|
|
|
|
|
|
}
|
|
|
|
# if script was executed then call the function
|
|
(return 0 2>/dev/null) || loginout_install $@
|