install.sh: umask 022, and the graphical session type from loginctl when run from ssh or a console
Found installing on the owner's desktop over ssh with umask 077: sudo made /usr/local/share/summit root-only, so the engine's venv went into the source folder. Over ssh XDG_SESSION_TYPE is tty: Wayland extras were skipped.
This commit is contained in:
1 parent
41986c910f
commit
97e762642c
1 file changed
+15
-3
+15
-3
@@ -25,6 +25,9 @@
|
||||
# SUMMIT_REPO clone and update from this git URL instead (testing)
|
||||
|
||||
set -eu
|
||||
# Files and folders it makes under the prefix must be readable by everyone, whatever umask the caller has (with
|
||||
# 077, sudo made /usr/local/share/summit root-only and the engine's venv went to the wrong place).
|
||||
umask 022
|
||||
|
||||
REPO_API="https://git.molberg.cloud/api/v1/repos/alex/summit"
|
||||
REPO_GIT="${SUMMIT_REPO:-https://git.molberg.cloud/alex/summit.git}"
|
||||
@@ -167,14 +170,23 @@ detect_gpu() {
|
||||
SESSION_TYPE=unknown # wayland, x11
|
||||
|
||||
detect_session() {
|
||||
if [ -n "${XDG_SESSION_TYPE:-}" ]; then
|
||||
SESSION_TYPE="$XDG_SESSION_TYPE"
|
||||
elif [ -n "${WAYLAND_DISPLAY:-}" ]; then
|
||||
SESSION_TYPE="${XDG_SESSION_TYPE:-}"
|
||||
case "$SESSION_TYPE" in
|
||||
wayland|x11) return ;;
|
||||
esac
|
||||
if [ -n "${WAYLAND_DISPLAY:-}" ]; then
|
||||
SESSION_TYPE=wayland
|
||||
elif [ -n "${DISPLAY:-}" ]; then
|
||||
SESSION_TYPE=x11
|
||||
else
|
||||
# From a text console or ssh (XDG_SESSION_TYPE=tty): the type of this user's graphical session, if any.
|
||||
SESSION_TYPE=unknown
|
||||
if command -v loginctl >/dev/null 2>&1; then
|
||||
for s in $(loginctl list-sessions --no-legend 2>/dev/null | awk -v u="$(id -un)" '$3 == u {print $1}'); do
|
||||
t="$(loginctl show-session "$s" -p Type --value 2>/dev/null || true)"
|
||||
case "$t" in wayland|x11) SESSION_TYPE="$t"; break ;; esac
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user