mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-15 21:32:05 +08:00
安全的免密码安装
This commit is contained in:
3
debian/spark-store.postinst
vendored
3
debian/spark-store.postinst
vendored
@@ -30,6 +30,9 @@ case "$1" in
|
||||
|
||||
ln -s -f /opt/durapps/spark-store/bin/aptss /usr/bin/aptss
|
||||
|
||||
# Create symbol links for SSINSTALL
|
||||
ln -s -f /opt/durapps/spark-store/bin/auto-install-policy/store.spark-app.ssinstall.policy /usr/share/polkit-1/actions/store.spark-app.ssinstall.policy
|
||||
|
||||
# Compile the Sender module
|
||||
|
||||
gcc /opt/durapps/spark-store/bin/ss-feedback/sender-d.sh.c -o /opt/durapps/spark-store/bin/ss-feedback/sender-d
|
||||
|
||||
@@ -15,19 +15,6 @@ function pkexec_as_current_user() {
|
||||
sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus pkexec "$@"
|
||||
}
|
||||
|
||||
function zenity() {
|
||||
#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
|
||||
local uid=$(id -u $user)
|
||||
|
||||
sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus zenity "$@"
|
||||
}
|
||||
|
||||
#################检测文件是否存在
|
||||
if [ $# -eq 0 ];then
|
||||
echo "没有接收到参数,退出"
|
||||
@@ -68,9 +55,9 @@ dpkg -i "$1" || aptss install -yf
|
||||
|
||||
else
|
||||
|
||||
|
||||
zenity --info --icon-name=spark-store --height 270 --width 500 --text "软件包校验失败!这不应该发生!\n可能是因为软件包已损坏,星火仓库未同步,或者最坏的情况:恶意软件尝试利用自动安装来入侵系统!\n如果你不清楚发生了什么,请在接下来的认证窗口中选择取消认证\n执行 sudo aptss ssupdate 后再尝试安装。\n如果问题仍然存在,请在应用信息界面点击 应用反馈 来提交反馈给我们!\n\n如果你是审核人员,这是正常现象,在审核通过前星火仓库不会保存相关信息。请在接下来的弹窗中进行认证即可"
|
||||
|
||||
echo "校验失败,该deb不是星火已经上架的软件包,这可能是因为你正在尝试安装一个尚未上架的软件包"
|
||||
echo "如果你是审核人员,这是正常的"
|
||||
echo "为确保安全,将会询问密码"
|
||||
|
||||
pkexec_as_current_user bash -c "dpkg -i "$1" || aptss install -yf "
|
||||
|
||||
|
||||
Reference in New Issue
Block a user