修改: 现在只检测星火源的更新,避免出现问题

新文件:   检测网络环境,没网就退出
This commit is contained in:
shenmo 2022-04-14 17:26:54 +08:00
parent c4b26045d9
commit 72019f7cce
2 changed files with 28 additions and 1 deletions

@ -20,7 +20,7 @@ case "$1" in
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
apt update
apt update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"`
# Create symbo links to start upgrade detect
ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop /etc/xdg/autostart/spark-update-notifier.desktop

27
debian/spark-store.preinst vendored Executable file

@ -0,0 +1,27 @@
#!/bin/bash
#检测网络链接畅通
function network-check()
{
#超时时间
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
echo "Network Checked successful ! Continue..."
echo "网络通畅,继续安装"
else
#网络不畅通
echo "Network failed ! Cancel the installation"
echo "网络不畅,终止安装"
exit -1
fi
}
network-check