mirror of
https://gitee.com/spark-store-project/uos-packaging-tools
synced 2025-12-14 11:02:07 +08:00
修改: src/opt/uos-packaging-tools/just-install-me
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Package: uos-packaging-tools
|
Package: uos-packaging-tools
|
||||||
Version: 1.2.1
|
Version: 1.3
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Maintainer: shenmo<shenmo@spark-app.store>
|
Maintainer: shenmo<shenmo@spark-app.store>
|
||||||
Installed-Size: 10
|
Installed-Size: 10
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
function notify-send()
|
function notify-send()
|
||||||
{
|
{
|
||||||
#Detect the user using such display
|
# Detect the user using such display
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
local user=$(who | awk '{print $1}' | head -n 1)
|
||||||
|
|
||||||
#Detect the id of the user
|
# Detect the id of the user
|
||||||
local uid=$(id -u $user)
|
local uid=$(id -u $user)
|
||||||
|
|
||||||
sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"
|
sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"
|
||||||
@@ -13,52 +13,57 @@ function notify-send()
|
|||||||
|
|
||||||
function zenity()
|
function zenity()
|
||||||
{
|
{
|
||||||
#Detect the user using such display
|
# Detect the user using such display
|
||||||
local user=$(who | awk '{print $1}' | head -n 1)
|
local user=$(who | awk '{print $1}' | head -n 1)
|
||||||
|
|
||||||
#Detect the id of the user
|
# Detect the id of the user
|
||||||
local uid=$(id -u $user)
|
local uid=$(id -u $user)
|
||||||
|
|
||||||
sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus zenity "$@"
|
sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus zenity "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -e /usr/local/bin/ssaudit ];then
|
confirm_installation() {
|
||||||
|
local package_name=$(dpkg-deb -f "$1" Package)
|
||||||
for DEBPATH in "$@"
|
zenity --question --width=300 --height=150 --text="您正准备安装 ${package_name}\n\n若这次安装请求是您发起的,请按确定继续安装,否则请取消"
|
||||||
do
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -e /usr/local/bin/ssaudit ]; then
|
||||||
|
|
||||||
|
for DEBPATH in "$@"; do
|
||||||
DEBPATH="${DEBPATH#file://}"
|
DEBPATH="${DEBPATH#file://}"
|
||||||
|
|
||||||
|
|
||||||
DEBPATH=$(realpath "$DEBPATH")
|
DEBPATH=$(realpath "$DEBPATH")
|
||||||
notify-send "正在使用ssaudit安装 $(dpkg-deb -f "$DEBPATH" Package),请稍候...." -i /usr/share/icons/uos-packaging-tools.png
|
|
||||||
/usr/local/bin/ssaudit "$DEBPATH"| zenity --text-info --width=500 --height=300 --title="安装输出" --auto-scroll
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 弹出确认窗口
|
||||||
|
if confirm_installation "$DEBPATH"; then
|
||||||
|
notify-send "正在使用 ssaudit 安装 $(dpkg-deb -f "$DEBPATH" Package),请稍候...." -i /usr/share/icons/uos-packaging-tools.png
|
||||||
|
/usr/local/bin/ssaudit "$DEBPATH" | zenity --text-info --width=500 --height=300 --title="安装输出" --auto-scroll
|
||||||
|
else
|
||||||
|
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 的安装已取消" -i /usr/share/icons/uos-packaging-tools.png
|
||||||
|
fi
|
||||||
echo "---------------------------------------------------------------------------"
|
echo "---------------------------------------------------------------------------"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
|
||||||
for DEBPATH in "$@"
|
for DEBPATH in "$@"; do
|
||||||
do
|
if [[ $DEBPATH == file://* ]]; then
|
||||||
if [[ $DEBPATH == file://* ]]; then
|
|
||||||
# 如果是,移除 'file://' 部分并输出结果
|
|
||||||
DEBPATH="${DEBPATH#file://}"
|
DEBPATH="${DEBPATH#file://}"
|
||||||
fi
|
fi
|
||||||
DEBPATH=$(realpath "$DEBPATH")
|
DEBPATH=$(realpath "$DEBPATH")
|
||||||
notify-send "正在使用apt安装 $(dpkg-deb -f "$DEBPATH" Package),请稍候...." -i /usr/share/icons/uos-packaging-tools.png
|
|
||||||
|
|
||||||
|
# 弹出确认窗口
|
||||||
|
if confirm_installation "$DEBPATH"; then
|
||||||
|
notify-send "正在使用 apt 安装 $(dpkg-deb -f "$DEBPATH" Package),请稍候...." -i /usr/share/icons/uos-packaging-tools.png
|
||||||
apt install "$DEBPATH" --reinstall -y | zenity --text-info --width=500 --height=300 --title="安装输出" --auto-scroll
|
apt install "$DEBPATH" --reinstall -y | zenity --text-info --width=500 --height=300 --title="安装输出" --auto-scroll
|
||||||
# 将输出传递给zenity进行实时显示
|
if [ "$?" = "0" ]; then
|
||||||
|
|
||||||
if [ "$?" = "0" ];then
|
|
||||||
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 安装已完成" -i /usr/share/icons/uos-packaging-tools.png
|
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 安装已完成" -i /usr/share/icons/uos-packaging-tools.png
|
||||||
else
|
else
|
||||||
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 安装出错!请手动安装!" -i /usr/share/icons/uos-packaging-tools.png
|
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 安装出错!请手动安装!" -i /usr/share/icons/uos-packaging-tools.png
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
notify-send "$(dpkg-deb -f "$DEBPATH" Package) 的安装已取消" -i /usr/share/icons/uos-packaging-tools.png
|
||||||
|
fi
|
||||||
echo "---------------------------------------------------------------------------"
|
echo "---------------------------------------------------------------------------"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user