mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
fix: In ACE can't use updater
This commit is contained in:
45
tool/store-helper/pass-auth.sh
Executable file
45
tool/store-helper/pass-auth.sh
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# We use sudo twice to avoid ACE bug here
|
||||||
|
# https://gitee.com/amber-ce/amber-ce-bookworm/commit/43e1a1599ede474b37e41aa10c53fd8afc4d35a1
|
||||||
|
|
||||||
|
function zenity() {
|
||||||
|
if [[ -e /usr/bin/garma ]]; then
|
||||||
|
garma "$@"
|
||||||
|
else
|
||||||
|
$(command -v zenity) "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 检查sudo是否需要密码
|
||||||
|
if sudo sudo -n true 2>/dev/null; then
|
||||||
|
echo "sudo 无需密码,继续执行"
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# 循环输入密码直到成功或用户取消
|
||||||
|
while true; do
|
||||||
|
# 使用zenity弹出密码输入框
|
||||||
|
PASSWORD=$(zenity --password --title="需要sudo权限" )
|
||||||
|
|
||||||
|
# 检查用户是否取消输入
|
||||||
|
if [ -z "$PASSWORD" ]; then
|
||||||
|
zenity --error --text="操作已取消"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 尝试使用输入的密码执行sudo命令
|
||||||
|
echo "$PASSWORD" | sudo sudo -S true 2>/dev/null
|
||||||
|
|
||||||
|
# 检查sudo是否成功
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "密码正确,继续执行"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
zenity --error --text="密码错误,请重新输入"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$PASSWORD" | sudo sudo -S "$@"
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ "$(id -u)" != "0" ] ; then
|
if [ "$(id -u)" != "0" ] ; then
|
||||||
pkexec "$0" "$@"
|
if [[ IS_ACE_ENV="1" ]];then
|
||||||
exit
|
/opt/durapps/spark-store/bin/store-helper/pass-auth.sh "$0" "$@"
|
||||||
|
else
|
||||||
|
pkexec "$0" "$@"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
trap "rm -f /tmp/spark-store/upgradeStatus.txt" EXIT
|
trap "rm -f /tmp/spark-store/upgradeStatus.txt" EXIT
|
||||||
source /opt/durapps/spark-store/bin/bashimport/transhell.amber
|
source /opt/durapps/spark-store/bin/bashimport/transhell.amber
|
||||||
|
|||||||
Reference in New Issue
Block a user