From 894fe87a3e0a63195284405e28a553940cfa1c76 Mon Sep 17 00:00:00 2001 From: shenmo Date: Mon, 24 Jul 2023 12:29:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8zenity=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DEBIAN/control | 4 ++-- src/opt/uos-packaging-tools/just-install-me | 25 +++++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/DEBIAN/control b/src/DEBIAN/control index e58acac..fa04010 100644 --- a/src/DEBIAN/control +++ b/src/DEBIAN/control @@ -1,9 +1,9 @@ Package: uos-packaging-tools -Version: 1.0.5 +Version: 1.0.6 Architecture: all Maintainer: shenmo 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 diff --git a/src/opt/uos-packaging-tools/just-install-me b/src/opt/uos-packaging-tools/just-install-me index 824e9d5..5ad7971 100755 --- a/src/opt/uos-packaging-tools/just-install-me +++ b/src/opt/uos-packaging-tools/just-install-me @@ -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