mirror of
https://gitee.com/spark-store-project/uos-packaging-tools
synced 2025-06-11 01:36:00 +08:00
使用zenity显示实时进度
This commit is contained in:
parent
ea167c0021
commit
894fe87a3e
@ -1,9 +1,9 @@
|
||||
Package: uos-packaging-tools
|
||||
Version: 1.0.5
|
||||
Version: 1.0.6
|
||||
Architecture: all
|
||||
Maintainer: shenmo<shenmo@spark-app.store>
|
||||
Installed-Size: 10
|
||||
Depends: libnotify-bin,fakeroot,zstd,cn.flamescion.appimage2deb | appimage2deb ,policykit-1
|
||||
Depends: libnotify-bin,fakeroot,zstd,cn.flamescion.appimage2deb | appimage2deb ,policykit-1,zenity
|
||||
Section: graphics
|
||||
Priority: optional
|
||||
Description: uos-packaging-tools
|
||||
|
@ -11,6 +11,17 @@ function notify-send()
|
||||
sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"
|
||||
}
|
||||
|
||||
function zenity()
|
||||
{
|
||||
#Detect the user using such display
|
||||
local user=$(who | awk '{print $1}' | head -n 1)
|
||||
|
||||
#Detect the id of the user
|
||||
local uid=$(id -u $user)
|
||||
|
||||
sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus zenity "$@"
|
||||
}
|
||||
|
||||
if [ -e /usr/local/bin/ssaudit ];then
|
||||
|
||||
for DEBPATH in "$@"
|
||||
@ -22,12 +33,9 @@ do
|
||||
|
||||
DEBPATH=$(realpath "$DEBPATH")
|
||||
notify-send "正在使用ssaudit安装 $(dpkg-deb -f "$DEBPATH" Package),请稍候...." -i /usr/share/icons/uos-packaging-tools.png
|
||||
/usr/local/bin/ssaudit "$DEBPATH"
|
||||
if [ "$?" = "0" ];then
|
||||
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 安装已完成" -i /usr/share/icons/uos-packaging-tools.png
|
||||
else
|
||||
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 安装出错!请手动安装!" -i /usr/share/icons/uos-packaging-tools.png
|
||||
fi
|
||||
/usr/local/bin/ssaudit "$DEBPATH"| zenity --text-info --width=500 --height=300 --title="安装输出" --auto-scroll
|
||||
|
||||
|
||||
|
||||
echo "---------------------------------------------------------------------------"
|
||||
done
|
||||
@ -41,7 +49,10 @@ if [[ $DEBPATH == file://* ]]; then
|
||||
fi
|
||||
DEBPATH=$(realpath "$DEBPATH")
|
||||
notify-send "正在使用apt安装 $(dpkg-deb -f "$DEBPATH" Package),请稍候...." -i /usr/share/icons/uos-packaging-tools.png
|
||||
apt install "$DEBPATH" --reinstall -y
|
||||
|
||||
apt install "$DEBPATH" --reinstall -y | zenity --text-info --width=500 --height=300 --title="安装输出" --auto-scroll
|
||||
# 将输出传递给zenity进行实时显示
|
||||
|
||||
if [ "$?" = "0" ];then
|
||||
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 安装已完成" -i /usr/share/icons/uos-packaging-tools.png
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user