fix: lightdm setup-cleanup change script directory and add make executable call user script as root so bindfs map works

master
Kebler Network System Administrator 2022-01-01 17:38:51 -08:00
parent eb32c9ae03
commit 3880fbbf0f
7 changed files with 37 additions and 17 deletions

View File

@ -8,7 +8,10 @@ chromium_() {
# local DEFAULT="$HOME/.local/share/chromium"
local exe="/usr/bin/chromium"
[[ $1 == "-version" ]] && $exe -version && return
if [[ $1 == "-version" ]]; then
$exe -version
return
fi
[[ $1 == -g ]] && exe=$(command -v google-chrome) && shift
echo execuatble to be used: $exe
@ -16,7 +19,8 @@ chromium_() {
echo chromium/chrome not installed, checking for flatpak version
flatpak=$(flatpak info com.github.Eloston.UngoogledChromium | grep error:)
if [[ $flatpak ]]; then
echo no flatpak version either - exiting && return 1
echo no flatpak version either - exiting
return 1
else
flatpak=true
exe="/usr/bin/flatpak run --branch=stable --arch=x86_64 --filesystem=<dir> --command=/app/bin/chromium --file-forwarding com.github.Eloston.UngoogledChromium @@u"

View File

@ -1,3 +1,4 @@
[Seat:*]
session-cleanup-script=/opt/scripts/lightdm-cleanup.sh
session-setup-script=/opt/scripts/lightdm-setup.sh
session-setup-script=/opt/session/lightdm-setup.sh
session-cleanup-script=/opt/session/lightdm-cleanup.sh

View File

@ -1,4 +0,0 @@
#!/bin/bash
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

View File

@ -1,4 +0,0 @@
#!/bin/bash
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

View File

@ -14,15 +14,20 @@ loginout_install() {
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/scripts ]]; then
if [[ ! $(mkdir -p /opt/scripts) ]]; then
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/scripts) ]] && echo can not make /opt/scripts, aborting && return
[[ $($_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/scripts
$_sudo cp -f lightdm-*.sh /opt/scripts
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

View File

@ -0,0 +1,9 @@
#!/bin/bash
_udir=${HOME}/.session
_uscript=${_udir}/session_logout
_log=${_udir}/session.log
_sdir=$(dirname "${BASH_SOURCE[0]}")
echo "${UID:-$(id -u)}:$(whoami) is running CLEANUP script in $_sdir for ${USER} sourcing ${_uscript}::$(date)" >> ${_sdir}/lightdm.log
if [[ -e ${_uscript} ]]; then
/bin/bash ${_uscript} 1>>${_log} 2>>${_log} || true
fi

View File

@ -0,0 +1,9 @@
#!/bin/bash
_udir=${HOME}/.session
_uscript=${_udir}/session_login
_log=${_udir}/session.log
_sdir=$(dirname "${BASH_SOURCE[0]}")
echo "${UID:-$(id -u)}:$(whoami) is running SETUP script in $_sdir for ${USER} sourcing ${_uscript}::$(date)" >> ${_sdir}/lightdm.log
if [[ -e ${_uscript} ]]; then
/bin/bash ${_uscript} 1>>${_log} 2>>${_log} || true
fi