From 3880fbbf0f707ba265bea4d4f97a9c2f4331b117 Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Sat, 1 Jan 2022 17:38:51 -0800 Subject: [PATCH] fix: lightdm setup-cleanup change script directory and add make executable call user script as root so bindfs map works --- all/modules/chromium/chromium.sh | 8 ++++++-- all/modules/lightdm/50-setup-cleanup.conf | 5 +++-- all/modules/lightdm/lightdm-cleanup.sh | 4 ---- all/modules/lightdm/lightdm-setup.sh | 4 ---- all/modules/lightdm/loginout-install.sh | 15 ++++++++++----- all/modules/lightdm/scripts/lightdm-cleanup.sh | 9 +++++++++ all/modules/lightdm/scripts/lightdm-setup.sh | 9 +++++++++ 7 files changed, 37 insertions(+), 17 deletions(-) delete mode 100644 all/modules/lightdm/lightdm-cleanup.sh delete mode 100644 all/modules/lightdm/lightdm-setup.sh create mode 100644 all/modules/lightdm/scripts/lightdm-cleanup.sh create mode 100644 all/modules/lightdm/scripts/lightdm-setup.sh diff --git a/all/modules/chromium/chromium.sh b/all/modules/chromium/chromium.sh index 15fea02..975ac59 100755 --- a/all/modules/chromium/chromium.sh +++ b/all/modules/chromium/chromium.sh @@ -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= --command=/app/bin/chromium --file-forwarding com.github.Eloston.UngoogledChromium @@u" diff --git a/all/modules/lightdm/50-setup-cleanup.conf b/all/modules/lightdm/50-setup-cleanup.conf index adf4c8e..3e6c851 100644 --- a/all/modules/lightdm/50-setup-cleanup.conf +++ b/all/modules/lightdm/50-setup-cleanup.conf @@ -1,3 +1,4 @@ [Seat:*] -session-cleanup-script=/opt/scripts/lightdm-cleanup.sh -session-setup-script=/opt/scripts/lightdm-setup.sh \ No newline at end of file +session-setup-script=/opt/session/lightdm-setup.sh +session-cleanup-script=/opt/session/lightdm-cleanup.sh + diff --git a/all/modules/lightdm/lightdm-cleanup.sh b/all/modules/lightdm/lightdm-cleanup.sh deleted file mode 100644 index d63c247..0000000 --- a/all/modules/lightdm/lightdm-cleanup.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/all/modules/lightdm/lightdm-setup.sh b/all/modules/lightdm/lightdm-setup.sh deleted file mode 100644 index 69adc97..0000000 --- a/all/modules/lightdm/lightdm-setup.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/all/modules/lightdm/loginout-install.sh b/all/modules/lightdm/loginout-install.sh index 694c28f..81ea48f 100755 --- a/all/modules/lightdm/loginout-install.sh +++ b/all/modules/lightdm/loginout-install.sh @@ -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 diff --git a/all/modules/lightdm/scripts/lightdm-cleanup.sh b/all/modules/lightdm/scripts/lightdm-cleanup.sh new file mode 100644 index 0000000..382f507 --- /dev/null +++ b/all/modules/lightdm/scripts/lightdm-cleanup.sh @@ -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 \ No newline at end of file diff --git a/all/modules/lightdm/scripts/lightdm-setup.sh b/all/modules/lightdm/scripts/lightdm-setup.sh new file mode 100644 index 0000000..c878e2f --- /dev/null +++ b/all/modules/lightdm/scripts/lightdm-setup.sh @@ -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