mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-06-02 22:49:49 +08:00
修改: debian/changelog
新文件: pkg/usr/lib/systemd/system/spark-update-notifier.service 修改: src/main.cpp 修改: src/widget.cpp 新文件: tool/update-upgrade/autostart/spark-update-notifier.desktop 新文件: tool/update-upgrade/ss-do-upgrade.sh 新文件: tool/update-upgrade/ss-update-controler.sh 新文件: tool/update-upgrade/ss-update-notify-placer.sh 新文件: tool/update-upgrade/ss-update-notify.sh 新文件: tool/update-upgrade/ss-upgrade-list.sh
This commit is contained in:
parent
161c9e320b
commit
f292f954f7
debian
pkg/usr/lib/systemd/system
src
tool/update-upgrade
9
debian/changelog
vendored
9
debian/changelog
vendored
@ -1,3 +1,12 @@
|
||||
spark-store (3.0.3-11) stable; urgency=medium
|
||||
|
||||
* Now support autoupdate
|
||||
|
||||
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800
|
||||
|
||||
|
||||
|
||||
|
||||
spark-store (3.0.3-10) stable; urgency=medium
|
||||
|
||||
* Now also compile dstore patch
|
||||
|
15
pkg/usr/lib/systemd/system/spark-update-notifier.service
Normal file
15
pkg/usr/lib/systemd/system/spark-update-notifier.service
Normal file
@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description:Spark Store update notifier
|
||||
After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service
|
||||
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify-placer
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
Alias=spark-update-notifier
|
||||
WantedBy=multi-user.target
|
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
||||
a.setOrganizationName("spark-union");
|
||||
a.setOrganizationDomain("https://www.deepinos.org/");
|
||||
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
|
||||
a.setApplicationVersion(DApplication::buildVersion("3.0.3-10"));
|
||||
a.setApplicationVersion(DApplication::buildVersion("3.0.3-11"));
|
||||
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
|
||||
a.setApplicationDescription(
|
||||
QObject::tr(
|
||||
|
@ -192,14 +192,18 @@ void Widget::initUI()
|
||||
// 添加菜单项
|
||||
QAction *actionSubmission = new QAction(tr("Submit App"), this);
|
||||
QAction *setting = new QAction(tr("Settings"));
|
||||
QAction *upgrade = new QAction(tr("App Upgrade"));
|
||||
|
||||
QMenu *menu = new QMenu;
|
||||
menu->addAction(setting);
|
||||
menu->addAction(upgrade);
|
||||
menu->addAction(actionSubmission);
|
||||
|
||||
titlebar->setMenu(menu);
|
||||
|
||||
connect(actionSubmission, &QAction::triggered, this, [=]{QDesktopServices::openUrl(QUrl("https://upload.deepinos.org/"));});
|
||||
connect(setting, &QAction::triggered, this, &Widget::opensetting);
|
||||
connect(upgrade, &QAction::triggered, this, [=]{QProcess::startDetached("x-terminal-emulator -e /opt/durapps/spark-store/bin/update-upgrade/ss-update-controler.sh");});
|
||||
|
||||
// 载入自定义字体
|
||||
int loadedFontID = QFontDatabase::addApplicationFont(":/fonts/fonts/hksnzt.ttf");
|
||||
|
@ -0,0 +1,5 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=Application
|
||||
Exec=/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify.sh
|
||||
Name=spark-update-notifier
|
4
tool/update-upgrade/ss-do-upgrade.sh
Executable file
4
tool/update-upgrade/ss-do-upgrade.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
sudo apt upgrade -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
|
||||
|
62
tool/update-upgrade/ss-update-controler.sh
Executable file
62
tool/update-upgrade/ss-update-controler.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
echo "因为目前没有有时间的Qt程序员志愿者所以现在加功能只有让shenmo写脚本了..."
|
||||
echo "下面一段是shenmo想了半天写出来的(为了让用户认真读操碎了心~"
|
||||
echo "请务必认真阅读("
|
||||
echo
|
||||
echo "此功能被添加的原因是:为了防止影响系统更新,星火源默认的优先级是400,低于默认的500。这导致了与系统仓库相同包名的软件包无法正常更新到比系统仓库更高的版本。例如:hugo,系统仓库中的低版本会被优先安装,而且默认不会更新到星火的更新的版本"
|
||||
echo "此脚本可以检测星火源中是否有比当前系统更高版本的软件包,由您决定是否安装"
|
||||
echo "此脚本使用apt update/apt list --upgrade/apt upgrade来更新软件源、列出更新列表和操作更新"
|
||||
echo
|
||||
echo "该脚本不对其使用效果有任何明示或暗示的担保,在使用前请您确保您清楚地知道您在干什么。您应当清楚,星火商店的软件包并不是适配所有发行版的;尽管绝大多数的软件更新是无害的,您仍然应该仔细检查显示出来的更新内容,以确保不会对您的依赖环境造成破坏,尤其是那些看起来和系统依赖相关的软件包。在查看过更新列表之后,确认更新之前,您仍有一次取消更新的机会。"
|
||||
echo "本脚本的开发者不对使用该脚本可能造成的后果负责"
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo "请按任意键继续..."
|
||||
read
|
||||
|
||||
reset
|
||||
|
||||
endloop=0
|
||||
while [ $endloop -eq 0 ] ;do
|
||||
echo "欢迎使用星火更新工具 脚本版 "
|
||||
echo "请在以下操作中选择一个进行~"
|
||||
echo "输入1 开启或关闭星火更新检测工具(如果开启则会在系统启动后自动检测更新。如有更新则会弹出通知)"
|
||||
echo "输入2 查看可更新软件包列表并决定是否更新"
|
||||
echo "输入3 退出脚本"
|
||||
read option
|
||||
|
||||
case $option in
|
||||
1)
|
||||
echo "执行以下操作需要授权..."
|
||||
|
||||
if [ -f $XDG_CONFIG_HOME/autostart/spark-update-notifier.desktop ];then
|
||||
echo "检测到已经启动了自动更新检测,关闭中"
|
||||
sudo systemctl disable spark-update-notifier
|
||||
rm $XDG_CONFIG_HOME/autostart/spark-update-notifier.desktop
|
||||
|
||||
else
|
||||
echo "未检测到自动更新检测,启动中"
|
||||
sudo systemctl enable spark-update-notifier
|
||||
sudo service spark-update-notifier start
|
||||
ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop $XDG_CONFIG_HOME/autostart
|
||||
/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify.sh
|
||||
fi
|
||||
;;
|
||||
|
||||
2)
|
||||
/opt/durapps/spark-store/bin/update-upgrade/ss-upgrade-list.sh
|
||||
/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh
|
||||
|
||||
;;
|
||||
3)
|
||||
echo "按回车退出"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "无法识别的输入!请重新输入"
|
||||
reset
|
||||
esac
|
||||
|
||||
done
|
48
tool/update-upgrade/ss-update-notify-placer.sh
Executable file
48
tool/update-upgrade/ss-update-notify-placer.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
LANG=en.US
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
#检测网络链接畅通
|
||||
function network()
|
||||
{
|
||||
#超时时间
|
||||
local timeout=1
|
||||
|
||||
#目标网站
|
||||
local target=www.baidu.com
|
||||
|
||||
#获取响应状态码
|
||||
local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
|
||||
|
||||
if [ "x$ret_code" = "x200" ]; then
|
||||
#网络畅通
|
||||
return 0
|
||||
else
|
||||
#网络不畅通
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
network
|
||||
if [ $? -eq 1 ];then
|
||||
echo "Network fail. Stop to avoid bother dpkg"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
#The code above is modified from https://blog.csdn.net/yaxuan88521/article/details/120516298
|
||||
|
||||
|
||||
updatetext=`sudo apt update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"`
|
||||
isupdate=`echo $updatetext | grep "can be upgraded"`
|
||||
#echo $isupdate
|
||||
|
||||
if [ "$isupdate" ];then
|
||||
update_app_number=`echo ${updatetext%package*} #从右向左截取第一个 src 后的字符串`
|
||||
update_app_number=`echo ${update_app_number: -1}`
|
||||
mkdir -p /tmp/spark-store-updatenum
|
||||
sudo echo "$update_app_number" > /tmp/spark-store-updatenum/number
|
||||
fi
|
8
tool/update-upgrade/ss-update-notify.sh
Executable file
8
tool/update-upgrade/ss-update-notify.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ -f /tmp/spark-store-updatenum/number ];then
|
||||
update_app_number=`cat /tmp/spark-store-updatenum/number`
|
||||
echo "$update_app_number"
|
||||
notify-send -i spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请及时处理"
|
||||
fi
|
6
tool/update-upgrade/ss-upgrade-list.sh
Executable file
6
tool/update-upgrade/ss-upgrade-list.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
|
||||
echo "可更新的应用有:"
|
||||
sudo apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
|
Loading…
x
Reference in New Issue
Block a user