mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-03-26 07:19:44 +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:
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
|
||||
Reference in New Issue
Block a user