update tool/ssinstall.

Signed-off-by: shenmo <jifengshenmo@outlook.com>
This commit is contained in:
shenmo 2023-01-26 17:05:35 +00:00 committed by Gitee
parent 8d41966d67
commit 72ba481180
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -3,16 +3,11 @@
echo "Spark Store Install script.星火商店安装脚本" echo "Spark Store Install script.星火商店安装脚本"
function pkexec_as_current_user() { function pkexec_as_current_user() {
#Detect the name of the display in use
local display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
#Detect the user using such display
local user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
#Detect the id of the user #Detect the id of the user
local uid=$(id -u $user) local uid=$(id -u $user)
sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus pkexec "$@" sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus pkexec "$@"
} }
function zenity() { function zenity() {