feat: #I7R2L5 更新星火商店时不再自动打开更新提示服务

prerm 脚本中添加判断,upgrade 时将更新提示 service 文件改名添加 bak,以此作为升级判断依据;postinst 脚本中判断 bak 文件存在时,优先判断更新提示服务是否为 enable 状态,若被 disable 则不再自启(若为 inactive 状态则同理不再重启服务)

Log: 修改 prerm 和 postinst 实现更新时判断更新提示服务是否需要重新设置自启;修改 debian/changelog,消除编译打包警告
This commit is contained in:
zty199
2023-08-11 23:23:22 +08:00
parent 1f98c8df7c
commit 9f23c2b381
3 changed files with 101 additions and 47 deletions

View File

@@ -1,16 +1,20 @@
#!/bin/bash
function notify-send()
{
#Detect the user using such display
# Detect the user using such display
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)
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 "$@"
}
if [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then
if [ "$1" = "remove" -o "$1" = "purge" ] ; then
echo "$1"
echo "卸载操作,进行配置清理"
# Remove residual symbol links
rm -f /usr/local/bin/spark-store
rm -f /usr/local/bin/ssinstall
@@ -22,8 +26,6 @@ if [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then
rm -rf /etc/aptss/
rm -rf /var/lib/aptss/
# Remove residual symbol links to stop upgrade detect
rm -f /etc/xdg/autostart/spark-update-notifier.desktop
@@ -39,13 +41,26 @@ if [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then
rm -f /etc/apt/trusted.gpg.d/spark-store.gpg
apt-key del '9D9A A859 F750 24B1 A1EC E16E 0E41 D354 A29A 440C'
else
echo "非卸载操作,不进行配置清理"
if [ ! -z "`pidof spark-store`" ];then
echo "关闭已有 spark-store.."
notify-send "正在升级星火商店" "请在升级结束后重启星火商店" -i spark-store
killall spark-store
else
echo "继续安装 spark-store.."
if [ ! -z "`pidof spark-store`" ] ; then
echo "关闭已有 spark-store.."
notify-send "正在升级星火商店" "请在升级结束后重启星火商店" -i spark-store
killall spark-store
fi
fi
if [ "$1" = "upgrade" ] ; then
echo "非卸载操作,不进行配置清理"
if [ -f "/usr/lib/systemd/system/spark-update-notifier.service" ] ; then
mv -f /usr/lib/systemd/system/spark-update-notifier.service /usr/lib/systemd/system/spark-update-notifier.service.bak
fi
if [ ! -z "`pidof spark-store`" ] ; then
echo "关闭已有 spark-store..."
notify-send "正在升级星火商店" "请在升级结束后重启星火商店" -i spark-store
killall spark-store
else
echo "继续安装 spark-store..."
fi
fi