update
This commit is contained in:
commit
a62abdff41
37 changed files with 6634 additions and 0 deletions
1
usr/bin/akm
Symbolic link
1
usr/bin/akm
Symbolic link
|
@ -0,0 +1 @@
|
|||
archlinux-kernel-manager
|
52
usr/bin/archlinux-kernel-manager
Executable file
52
usr/bin/archlinux-kernel-manager
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# this script should not be run as root
|
||||
# the polkit agent running on the desktop environment should prompt for root password
|
||||
|
||||
echo "---------------------------------------------------------------------------"
|
||||
echo "[INFO] Checking session"
|
||||
test $(whoami) == "root" && echo "[ERROR] Do not run this script as root." && exit 1
|
||||
test -z $DISPLAY && echo "[ERROR] DISPLAY variable is not set." && exit 1
|
||||
|
||||
# check session is either one of X11, Wayland or TTY
|
||||
session=$(loginctl show-session $(loginctl|grep $(whoami) | awk '{print $1}') -p Type | awk -F= '{print $2}' | grep "x11\|wayland\|tty")
|
||||
|
||||
test -z "$session" && echo "[ERROR] Failed to verify session for user." && exit 1
|
||||
|
||||
xauth_file=$(xauth info | awk -F"Authority file:" '{print $2}' | tr -d ' ')
|
||||
test -s "$xauth_file" || touch "$xauth_file"
|
||||
|
||||
case "$session" in
|
||||
"wayland")
|
||||
# Wayland session, generate Xauth session cookie for $DISPLAY
|
||||
xauth gen $DISPLAY &> /dev/null
|
||||
echo "[INFO] Display = $DISPLAY"
|
||||
echo "[INFO] Session = $session"
|
||||
|
||||
test -z "$(xauth list)" || echo "[INFO] Xauth session = OK"
|
||||
;;
|
||||
"x11")
|
||||
# X11 session, don't do anything here
|
||||
echo "[INFO] Display = $DISPLAY"
|
||||
echo "[INFO] Session = $session"
|
||||
|
||||
# just show msg on whether the Xauth session cookie is setup
|
||||
test -z "$(xauth list)" || echo "[INFO] Xauth session = OK"
|
||||
;;
|
||||
"tty")
|
||||
# TTY session, as user may not use a display manager
|
||||
echo "[INFO] Display = $DISPLAY"
|
||||
echo "[INFO] Session = $session"
|
||||
|
||||
test -z "$(xauth list)" || echo "[INFO] Xauth session = OK"
|
||||
;;
|
||||
*)
|
||||
# anything here is an unknown session, most likely AKM will fail to load
|
||||
echo "[WARN] Continuing, but cannot verify session for user."
|
||||
;;
|
||||
esac
|
||||
echo "---------------------------------------------------------------------------"
|
||||
|
||||
echo "[INFO] Starting Arch Linux Kernel Manager"
|
||||
pkexec '/usr/share/archlinux-kernel-manager/archlinux-kernel-manager.py'
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue