zenity 不再以root启动

This commit is contained in:
shenmo 2022-10-26 15:43:43 +08:00
parent a6e9dac2f9
commit 8d84e433a6
4 changed files with 33 additions and 11 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
spark-store (3.3.3~test1) stable; urgency=medium
* 3.3.3将会是修复大部分bug后的最终版本
* 图形环境中所有root权限的组件剥离到cli
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
spark-store (3.3.1~test1) stable; urgency=medium
* 安装时不再需要联网

View File

@ -4,15 +4,15 @@
<policyconfig>
<vendor>Spark Store</vendor>
<icon_name>x-package-repository</icon_name>
<action id="store.spark-app.ss-do-upgrade">
<description>运行ss-do-upgrade需要权限</description>
<message>要使用ss-do-upgrade需要权限</message>
<action id="store.spark-app.ss-do-upgrade-worker">
<description>运行ss-do-upgrade-worker需要权限</description>
<message>要使用ss-do-upgrade-worker需要权限</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh</annotate>
<annotate key="org.freedesktop.policykit.exec.path">/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

View File

@ -0,0 +1,18 @@
#!/bin/bash
if [ "$(id -u)" != "0" ];then
pkexec "$0" "$@"
exit
fi
case $1 in
ssupdate)
aptss ssupdate
;;
upgradable-list)
bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" | awk 'BEGIN {FS="/"} {print $1}' | awk NR\>1
;;
upgrade-app)
aptss install "${@:2}" --only-upgrade
esac

View File

@ -1,11 +1,8 @@
#!/bin/bash
if [ "$(id -u)" != "0" ];then
pkexec $0
exit
fi
bash aptss ssupdate | zenity --progress --auto-close --no-cancel --pulsate --text=正在更新检查,请稍候... --height 70 --width 400 --title="星火商店更新模块"
PKG_LIST="$(bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" | awk 'BEGIN {FS="/"} {print $1}' | awk NR\>1)"
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh ssupdate | zenity --progress --auto-close --no-cancel --pulsate --text=正在更新检查,请稍候... --height 70 --width 400 --title="星火商店更新模块"
PKG_LIST="$(pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh upgradable-list)"
####如果没更新,就弹出不需要更新
if [ -z "$PKG_LIST" ];then
zenity --info --icon-name=spark-store --text "没有软件需要更新\n但是你并没有站在世界之巅" --title "星火商店更新检测服务" --height 150 --width 300
@ -28,7 +25,7 @@ if [ "$PKG_UPGRADE_LIST" = "" ];then
zenity --info --icon-name=spark-store --text "没有选中任何软件\n但是你并没有站在世界之巅" --title "星火商店更新检测服务" --height 150 --width 300
else
bash aptss install $PKG_UPGRADE_LIST -y | zenity --progress --auto-close --no-cancel --pulsate --text=正在更新已选中的应用,请稍候... --height 70 --width 400 --title="星火商店更新模块"
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh upgrade-app $PKG_UPGRADE_LIST -y | zenity --progress --auto-close --no-cancel --pulsate --text=正在更新已选中的应用,请稍候... --height 70 --width 400 --title="星火商店更新模块"
if [ "$?" = "0" ];then