modify: 加入了配置系统,不再用瞳孔地震的方式处理升级

This commit is contained in:
2023-08-13 21:44:53 +08:00
parent 9f32a02f35
commit 0e810cea87
4 changed files with 30 additions and 37 deletions

View File

@@ -45,26 +45,13 @@ case "$1" in
gpg --dearmor /tmp/spark-store-install/spark-store.asc
cp -f /tmp/spark-store-install/spark-store.asc.gpg /etc/apt/trusted.gpg.d/spark-store.gpg
# Run apt update to avoid users being fucked up by the non-exist dependency problem
# Now abandoned as aptss now run ssupdate everytime
#aptss ssupdate
# Start upgrade detect service
systemctl daemon-reload
# Do NOT enable upgrade detect service if disabled by user
if [ ! -f "/usr/lib/systemd/system/spark-update-notifier.service.bak" ] ; then
systemctl enable spark-update-notifier
systemctl start spark-update-notifier
else
if [ $(systemctl is-enabled spark-update-notifier.service) = "enabled" ] ; then
systemctl reenable spark-update-notifier
if [ $(systemctl is-active spark-update-notifier.service) = "active" ] ; then
systemctl restart spark-update-notifier
fi
fi
systemctl enable spark-update-notifier
systemctl start spark-update-notifier
rm -f /usr/lib/systemd/system/spark-update-notifier.service.bak
fi
# Update certain caches
update-icon-caches /usr/share/icons/hicolor || true

View File

@@ -28,6 +28,16 @@ if [ "$1" = "remove" -o "$1" = "purge" ] ; then
# Remove residual symbol links to stop upgrade detect
rm -f /etc/xdg/autostart/spark-update-notifier.desktop
# Remove config files
for username in `ls /home`
do
echo /home/$username
if [ -d /home/$username/.config/spark-union/spark-store ]
then
rm -rf /home/$username/.config/spark-union/spark-store
fi
done
# Shutdown services
systemctl stop spark-update-notifier
@@ -49,18 +59,4 @@ else
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