mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-15 05:12:04 +08:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cd976491f | ||
|
|
60d336e2dd | ||
| 4957e006d0 | |||
|
|
a3d803477a | ||
| 9897ba84ba | |||
| ca29afa425 | |||
| 97098f794d | |||
| ebaeca359a | |||
| 63ca640c31 | |||
| e67d3fab76 | |||
| d01fe44152 | |||
| 43042b5ae7 | |||
| 9614efa0aa | |||
| b1499b5942 | |||
| e8c344f75d | |||
| a388535361 | |||
| e94ee00ade | |||
| 0119b21c82 | |||
| 601b086923 | |||
| f1a2886161 | |||
| e2f1a344c4 | |||
| 9fc5153f37 | |||
|
|
b93f6362b7 | ||
| 32350cf519 | |||
| c27c922d0b | |||
| 6dee04f5e8 | |||
| 924d8d18a9 | |||
| f027a2fa7e | |||
| 89c4b968f3 | |||
| ab36e76032 | |||
| f49db42c3a | |||
| 58b31f182a | |||
| a30c26a7f2 | |||
| 4dbd79a1ac |
@@ -18,7 +18,7 @@ stages:
|
||||
name: execute_by_docker
|
||||
displayName: 基于镜像的脚本执行
|
||||
certificate: ''
|
||||
image: docker.io/debian:buster-slim
|
||||
image: docker.io/debian:buster
|
||||
command:
|
||||
- sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
|
||||
- '# 换源'
|
||||
|
||||
@@ -14,31 +14,40 @@ stages:
|
||||
trigger: auto
|
||||
executor: []
|
||||
steps:
|
||||
- step: build@nodejs
|
||||
name: build_dtk
|
||||
displayName: DTK构建
|
||||
nodeVersion: 14.16.0
|
||||
commands:
|
||||
- git clone https://gitlink.org.cn/shenmo7192/debian-10-container.git
|
||||
- mv debian-10-container/Debian-10.tar.xz /mnt
|
||||
- rm -rf debian-10-container
|
||||
- WORK_DIR=`pwd`
|
||||
- yum install xz -y
|
||||
- cd /mnt/
|
||||
- tar -xf Debian-10.tar.xz
|
||||
- cd Debian-10
|
||||
- wget https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/spark-build.sh
|
||||
- chmod +x spark-build.sh
|
||||
- mkdir build-spark
|
||||
- cp -r $WORK_DIR build-spark/spark-store
|
||||
- echo "进入Debian 10环境"
|
||||
- chroot /mnt/Debian-10 /bin/bash /spark-build.sh
|
||||
- cd /mnt/Debian-10/build-spark
|
||||
- step: execute@docker
|
||||
name: execute_by_docker
|
||||
displayName: 基于镜像的DTK构建
|
||||
certificate: ''
|
||||
image: docker.io/debian:buster
|
||||
command:
|
||||
- sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
|
||||
- '# 换源'
|
||||
- apt update
|
||||
- export DEBIAN_FRONTEND=noninteractive
|
||||
- echo "安装git devscripts equivs curl..."
|
||||
- 'apt install git devscripts equivs curl -y '
|
||||
- git clone https://gitlink.org.cn/shenmo7192/dtk-old-bundle.git
|
||||
- cd dtk-old-bundle
|
||||
- apt install ./*.deb -y
|
||||
- cd ..
|
||||
- rm -rf dtk-old-bundle
|
||||
- ''
|
||||
- 'mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes -y" '
|
||||
- ''
|
||||
- dpkg-buildpackage -b -us -uc
|
||||
- cd ..
|
||||
- ls -all
|
||||
- pwd
|
||||
- ''
|
||||
- 'mkdir target '
|
||||
- for f in $(find . -type f -name "*.deb")
|
||||
- do
|
||||
- ' mv $f target'
|
||||
- done
|
||||
artifacts:
|
||||
- name: BUILD_ARTIFACT
|
||||
path:
|
||||
- /mnt/Debian-10/build-spark/target
|
||||
caches: []
|
||||
- ../target
|
||||
notify: []
|
||||
strategy:
|
||||
retry: '0'
|
||||
|
||||
36
debian/changelog
vendored
36
debian/changelog
vendored
@@ -1,3 +1,39 @@
|
||||
spark-store (3.5.3) stable; urgency=medium
|
||||
|
||||
* fix: sender-d功能修复
|
||||
|
||||
|
||||
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
||||
|
||||
spark-store (3.5.2) stable; urgency=medium
|
||||
|
||||
* fix: aptss 转为使用内置的ss-apt-fast指令
|
||||
|
||||
|
||||
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
||||
|
||||
spark-store (3.5.1.1) stable; urgency=medium
|
||||
|
||||
* fix: aptss shebang 修复
|
||||
|
||||
|
||||
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
||||
|
||||
spark-store (3.5.1) stable; urgency=medium
|
||||
|
||||
* fix: 搜索修复,在appinfo界面可以正常搜索
|
||||
|
||||
|
||||
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
||||
|
||||
spark-store (3.5) stable; urgency=medium
|
||||
|
||||
* feat: 搜索转为使用网页,提高加载速度和用户体验
|
||||
* 下载软件时指定DNS,修复移动网络问题
|
||||
* 准备进入LTS阶段
|
||||
|
||||
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
|
||||
|
||||
spark-store (3.4~test1) stable; urgency=medium
|
||||
|
||||
* feat: aptss不再尝试安装apt-fast,转而自带
|
||||
|
||||
3
debian/spark-store.postinst
vendored
3
debian/spark-store.postinst
vendored
@@ -30,6 +30,9 @@ case "$1" in
|
||||
|
||||
ln -s -f /opt/durapps/spark-store/bin/aptss /usr/bin/aptss
|
||||
|
||||
# Create symbol links for SSINSTALL
|
||||
ln -s -f /opt/durapps/spark-store/bin/auto-install-policy/store.spark-app.ssinstall.policy /usr/share/polkit-1/actions/store.spark-app.ssinstall.policy
|
||||
|
||||
# Compile the Sender module
|
||||
|
||||
gcc /opt/durapps/spark-store/bin/ss-feedback/sender-d.sh.c -o /opt/durapps/spark-store/bin/ss-feedback/sender-d
|
||||
|
||||
2
debian/spark-store.prerm
vendored
2
debian/spark-store.prerm
vendored
@@ -8,8 +8,10 @@ rm /usr/local/bin/spark-dstore-patch
|
||||
rm /usr/local/bin/ussinstall
|
||||
rm /usr/local/bin/ussremove
|
||||
rm /usr/local/bin/ss-apt-fast
|
||||
|
||||
rm /usr/bin/aptss
|
||||
|
||||
|
||||
rm -rf /etc/aptss/
|
||||
|
||||
# Remove Sender module
|
||||
|
||||
@@ -169,7 +169,7 @@ void downloadlist::install(int t)
|
||||
|
||||
QProcess isInstall;
|
||||
isInstall.start("dpkg -s " + pkgName);
|
||||
isInstall.waitForFinished(180); // 默认超时 3 分钟
|
||||
isInstall.waitForFinished(180*1000); // 默认超时 3 分钟
|
||||
int error = QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
|
||||
if(error == 0)
|
||||
{
|
||||
|
||||
@@ -212,7 +212,7 @@ void DownloadController::startDownload(const QString &url)
|
||||
QProcess mailProcess;
|
||||
mailProcess.start(SenderdPath.toUtf8() + " " + metaUrl.toUtf8() + " " + "HD70642");
|
||||
mailProcess.waitForStarted();
|
||||
mailProcess.waitForFinished(3);
|
||||
mailProcess.waitForFinished();
|
||||
mailProcess.deleteLater();
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ DWIDGET_USE_NAMESPACE
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Get build time
|
||||
static const QString version = "Version 3.4~test1";
|
||||
static const QString version = "Version 3.5.3";
|
||||
static const QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy");
|
||||
static const QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
|
||||
|
||||
|
||||
@@ -789,8 +789,10 @@ void Widget::searchApp(QString text)
|
||||
}else{
|
||||
ui->webEngineView->setUrl(serverUrl + "store/#/darksearch?keywords=" + text);
|
||||
}
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
// spinner->stop();
|
||||
// spinner->hide();
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
mutex.unlock();
|
||||
|
||||
|
||||
@@ -1198,7 +1200,7 @@ void Widget::on_pushButton_uninstall_clicked()
|
||||
|
||||
QProcess check;
|
||||
check.start("dpkg", QStringList() << "-s" << pkgName.toLower());
|
||||
check.waitForFinished(180); // 默认超时 3 分钟
|
||||
check.waitForFinished(180*1000); // 默认超时 3 分钟
|
||||
|
||||
if (check.readAllStandardOutput().isEmpty())
|
||||
{
|
||||
@@ -1238,10 +1240,15 @@ void Widget::on_pushButton_clearWebCache_clicked()
|
||||
{
|
||||
QtConcurrent::run([=]()
|
||||
{
|
||||
|
||||
QString dataLocal = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
|
||||
QDir cacheDir(dataLocal );
|
||||
cacheDir.removeRecursively(); });
|
||||
qDebug() << dataLocal;
|
||||
QDir dataDir(dataLocal);
|
||||
dataDir.removeRecursively();
|
||||
dataLocal = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||
qDebug() << dataLocal;
|
||||
QDir cacheDir(dataLocal);
|
||||
cacheDir.removeRecursively();
|
||||
});
|
||||
}
|
||||
|
||||
quint64 Widget::dirFileSize(const QString &path)
|
||||
|
||||
@@ -92,7 +92,7 @@ void SpkAppInfoLoaderThread::run()
|
||||
QProcess isInstall;
|
||||
packagename = json["Pkgname"].toString();
|
||||
isInstall.start("dpkg -s " + json["Pkgname"].toString());
|
||||
isInstall.waitForFinished(180); // 默认超时 3 分钟
|
||||
isInstall.waitForFinished(180*1000); // 默认超时 3 分钟
|
||||
int error = QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
|
||||
if(error == 0)
|
||||
{
|
||||
@@ -100,12 +100,12 @@ void SpkAppInfoLoaderThread::run()
|
||||
|
||||
QProcess isUpdate;
|
||||
isUpdate.start("dpkg-query --showformat='${Version}' --show " + json["Pkgname"].toString());
|
||||
isUpdate.waitForFinished(180); // 默认超时 3 分钟
|
||||
isUpdate.waitForFinished(180*1000); // 默认超时 3 分钟
|
||||
QString localVersion = isUpdate.readAllStandardOutput();
|
||||
localVersion.replace("'", "");
|
||||
|
||||
isUpdate.start("dpkg --compare-versions " + localVersion + " ge " + json["Version"].toString());
|
||||
isUpdate.waitForFinished(180); // 默认超时 3 分钟
|
||||
isUpdate.waitForFinished(180*1000); // 默认超时 3 分钟
|
||||
if(!isUpdate.exitCode())
|
||||
{
|
||||
isUpdated = true;
|
||||
|
||||
10
tool/aptss
10
tool/aptss
@@ -1,8 +1,6 @@
|
||||
#/bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
apt-fast(){
|
||||
/opt/durapps/spark-store/bin/apt-fast/ss-apt-fast "$@"
|
||||
}
|
||||
|
||||
if [ ! -e "/tmp/aptss-conf/apt-fast.conf" ];then
|
||||
###刷新apt-fast配置
|
||||
@@ -27,7 +25,7 @@ sudo bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-conf/sou
|
||||
bwrap --dev-bind / / \
|
||||
--bind '/tmp/aptss-conf/apt-fast.conf' /etc/apt-fast.conf \
|
||||
--bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list \
|
||||
apt-fast "$@" --allow-downgrades
|
||||
/opt/durapps/spark-store/bin/apt-fast/ss-apt-fast "$@" --allow-downgrades
|
||||
|
||||
|
||||
elif [ "$1" = "download" ];then
|
||||
@@ -36,7 +34,7 @@ elif [ "$1" = "download" ];then
|
||||
bwrap --dev-bind / / \
|
||||
--bind '/tmp/aptss-conf/apt-fast.conf' /etc/apt-fast.conf \
|
||||
--bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list \
|
||||
apt-fast "$@" --allow-downgrades
|
||||
/opt/durapps/spark-store/bin/apt-fast/ss-apt-fast "$@" --allow-downgrades
|
||||
|
||||
|
||||
elif [ "$1" = "policy" ] || [ "$1" = "search" ];then
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
#!/bin/bash
|
||||
#将来可能可以换成apt-metalink来直接用种子/链接下载
|
||||
|
||||
apt-fast(){
|
||||
/opt/durapps/spark-store/bin/apt-fast/ss-apt-fast "$@"
|
||||
}
|
||||
|
||||
echo "Spark Store Install script.星火商店安装脚本"
|
||||
|
||||
function pkexec_as_current_user() {
|
||||
#Detect the name of the display in use
|
||||
local display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
|
||||
|
||||
#Detect the user using such display
|
||||
local user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
|
||||
|
||||
#Detect the id of the user
|
||||
local uid=$(id -u $user)
|
||||
|
||||
sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus pkexec "$@"
|
||||
}
|
||||
|
||||
#################检测文件是否存在
|
||||
if [ $# -eq 0 ];then
|
||||
echo "没有接收到参数,退出"
|
||||
@@ -19,39 +27,38 @@ then
|
||||
echo "文件不存在"
|
||||
exit 1
|
||||
fi
|
||||
#################root校验+要密码
|
||||
if [ "$(id -u)" != "0" ]
|
||||
then
|
||||
echo "ssinstall需要在root下运行";
|
||||
uname=`whoami`
|
||||
echo "Now input the password of $uname"
|
||||
read -e upass
|
||||
################检查密码对不对
|
||||
echo "$upass" | sudo -S echo "i love amber forever"
|
||||
passcheck=`echo "$upass" | sudo -S echo "i love amber forever"`
|
||||
if [ "$passcheck" != "i love amber forever" ];then
|
||||
echo "-----------------------------------------------------"
|
||||
echo "E:密码错误,退出脚本!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
##############判断是否是root运行,如果是,则正常走;如果不是,则代输密码
|
||||
if [ "$(id -u)" != "0" ];then
|
||||
#############################无root权限时
|
||||
----------------------------------------------------------------------------------
|
||||
echo "$upass" | sudo -S dpkg -i $1 || sudo aptss install -yf
|
||||
echo "请使用root启动ssinstall"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
###
|
||||
|
||||
|
||||
if [ ! -e "/var/lib/apt/lists/d.store.deepinos.org.cn_Packages" ];then
|
||||
echo "接收星火仓库软件信息中..."
|
||||
aptss ssupdate
|
||||
fi
|
||||
|
||||
echo "正在计算hash并与星火仓库匹配..."
|
||||
|
||||
DEB_MD5SUM=`md5sum "$1" | cut -c -32`
|
||||
|
||||
IS_MD5SUM_CHECKD=`cat /var/lib/apt/lists/d.store.deepinos.org.cn_Packages | grep $DEB_MD5SUM`
|
||||
if [ ! -z "$IS_MD5SUM_CHECKD" ];then
|
||||
|
||||
echo "校验成功,开始安装"
|
||||
echo ----------------------------------------------------------------------------------
|
||||
dpkg -i "$1" || aptss install -yf
|
||||
|
||||
else
|
||||
###########################有root权限时
|
||||
|
||||
echo ----------------------------------------------------------------------------------
|
||||
dpkg -i $1 || aptss install -yf
|
||||
|
||||
echo "校验失败,该deb不是星火已经上架的软件包,这可能是因为你正在尝试安装一个尚未上架的软件包"
|
||||
echo "如果你是审核人员,这是正常的"
|
||||
echo "为确保安全,将会询问密码"
|
||||
|
||||
pkexec_as_current_user bash -c "dpkg -i "$1" || aptss install -yf "
|
||||
|
||||
fi
|
||||
|
||||
@@ -1,26 +1,39 @@
|
||||
#!/bin/bash
|
||||
if [ "$(id -u)" != "0" ];then
|
||||
pkexec "$0" "$@"
|
||||
exit
|
||||
if [ "$(id -u)" != "0" ] ; then
|
||||
pkexec "$0" "$@"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
case $1 in
|
||||
ssupdate)
|
||||
aptss ssupdate 2>&1 | tee /tmp/spark-store-app-ssupdate-log.txt
|
||||
IS_SSUPDATE_ERROR=`cat /tmp/spark-store-app-ssupdate-log.txt | grep "E: "`
|
||||
echo "$IS_SSUPDATE_ERROR" > /tmp/spark-store-app-ssupdate-status.txt
|
||||
aptss ssupdate 2>&1 | tee /tmp/spark-store-app-ssupdate-log.txt
|
||||
IS_SSUPDATE_ERROR=`cat /tmp/spark-store-app-ssupdate-log.txt | grep "E: "`
|
||||
echo "$IS_SSUPDATE_ERROR" > /tmp/spark-store-app-ssupdate-status.txt
|
||||
;;
|
||||
|
||||
upgradable-list)
|
||||
bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" | awk 'BEGIN {FS="/"} {print $1}' | awk NR\>1
|
||||
output=$(env LANGUAGE=en_US bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="/dev/null" -o APT::Get::List-Cleanup="0" | awk NR\>1)
|
||||
|
||||
IFS_OLD="$IFS"
|
||||
IFS=$'\n'
|
||||
|
||||
for line in $output ; do
|
||||
PKG_NAME=$(echo $line | awk -F '/' '{print $1}')
|
||||
PKG_NEW_VER=$(echo $line | awk -F ' ' '{print $2}')
|
||||
PKG_CUR_VER=$(echo $line | awk -F ' ' '{print $6}' | awk -F ']' '{print $1}')
|
||||
echo "${PKG_NAME} ${PKG_NEW_VER} ${PKG_CUR_VER}"
|
||||
done
|
||||
|
||||
IFS="$IFS_OLD"
|
||||
;;
|
||||
|
||||
upgrade-app)
|
||||
aptss install "${@:2}" --only-upgrade 2>&1 | tee /tmp/spark-store-app-upgrade-log.txt
|
||||
IS_UPGRADE_ERROR=`cat /tmp/spark-store-app-upgrade-log.txt | grep "Package manager quit with exit code."`
|
||||
echo "$IS_UPGRADE_ERROR" > /tmp/spark-store-app-upgrade-status.txt
|
||||
aptss install "${@:2}" --only-upgrade 2>&1 | tee /tmp/spark-store-app-upgrade-log.txt
|
||||
IS_UPGRADE_ERROR=`cat /tmp/spark-store-app-upgrade-log.txt | grep "Package manager quit with exit code."`
|
||||
echo "$IS_UPGRADE_ERROR" > /tmp/spark-store-app-upgrade-status.txt
|
||||
;;
|
||||
|
||||
clean-log)
|
||||
rm -f /tmp/spark-store-app-ssupdate-status.txt /tmp/spark-store-app-ssupdate-log.txt /tmp/spark-store-app-upgrade-log.txt /tmp/spark-store-app-upgrade-status.txt
|
||||
rm -f /tmp/spark-store-app-ssupdate-status.txt /tmp/spark-store-app-ssupdate-log.txt /tmp/spark-store-app-upgrade-log.txt /tmp/spark-store-app-upgrade-status.txt
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,58 +1,81 @@
|
||||
#!/bin/bash
|
||||
|
||||
touch /tmp/spark-store/upgradeStatus.txt
|
||||
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh ssupdate | zenity --progress --auto-close --pulsate --no-cancel --text="正在检查更新,请稍候..." --height 70 --width 400 --title="星火商店更新模块" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
|
||||
if [ -z `cat /tmp/spark-store-app-ssupdate-status.txt` != "0" ];then
|
||||
echo "无错误"
|
||||
# 执行 apt update
|
||||
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh ssupdate | zenity --progress --auto-close --pulsate --no-cancel --text="正在检查更新,请稍候..." --height 70 --width 400 --title="星火商店更新模块" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
|
||||
if [ -z `cat /tmp/spark-store-app-ssupdate-status.txt` ] ; then
|
||||
echo "无错误"
|
||||
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh clean-log
|
||||
else
|
||||
zenity --error --text "检查更新进程出现错误!按确定查看报错,可用于反馈" --title "星火商店更新检测模块" --height 200 --width 350 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
zenity --text-info --filename=/tmp/spark-store-app-ssupdate-log.txt --checkbox="我已复制了此文本框中的日志,且将会在反馈时附上 。反馈渠道可以在右上角菜单的设置中找到" --title="反馈渠道在商店右上角的设置里" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh clean-log
|
||||
exit
|
||||
zenity --error --text "检查更新进程出现错误!按确定查看报错,可用于反馈" --title "星火商店更新检测模块" --height 200 --width 350 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
zenity --text-info --filename=/tmp/spark-store-app-ssupdate-log.txt --checkbox="我已复制了此文本框中的日志,且将会在反馈时附上。反馈渠道可以在右上角菜单的设置中找到" --title="反馈渠道在商店右上角的设置里" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh clean-log
|
||||
exit
|
||||
fi
|
||||
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh clean-log
|
||||
|
||||
PKG_LIST="$(pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh upgradable-list)"
|
||||
####如果没更新,就弹出不需要更新
|
||||
if [ -z "$PKG_LIST" ];then
|
||||
zenity --info --text "没有软件需要更新\n但是你并没有站在世界之巅" --title "星火商店更新检测模块" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
# 获取可更新应用列表
|
||||
PKG_LIST="$(pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh upgradable-list)"
|
||||
## 如果没更新,就弹出不需要更新
|
||||
if [ -z "$PKG_LIST" ] ; then
|
||||
zenity --info --text "没有软件需要更新\n但是你并没有站在世界之巅" --title "星火商店更新检测模块" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
else
|
||||
PKG_UPGRADE_LIST=`for PKG_NAME in $PKG_LIST;
|
||||
do
|
||||
#### 检测是否是hold状态
|
||||
if [ "$(dpkg-query -W -f='${Status}' $PKG_NAME | grep hold)" = "" ];then
|
||||
echo "true"
|
||||
echo "$PKG_NAME"
|
||||
echo "$PKG_NAME"
|
||||
else
|
||||
echo "false"
|
||||
echo "$PKG_NAME(无法更新:已被标记为保留)"
|
||||
echo "$PKG_NAME"
|
||||
## 获取用户选择的要更新的应用
|
||||
### 指定分隔符为 \n
|
||||
IFS_OLD="$IFS"
|
||||
IFS=$'\n'
|
||||
|
||||
PKG_UPGRADE_LIST=`for line in $PKG_LIST ; do
|
||||
PKG_NAME=$(echo $line | awk -F ' ' '{print $1}')
|
||||
PKG_NEW_VER=$(echo $line | awk -F ' ' '{print $2}')
|
||||
PKG_CUR_VER=$(echo $line | awk -F ' ' '{print $3}')
|
||||
|
||||
dpkg --compare-versions $PKG_NEW_VER le $PKG_CUR_VER
|
||||
if [ $? -eq 0 ] ; then
|
||||
continue
|
||||
fi
|
||||
done | zenity --list --text="选择你想更新的应用" --column=是否更新 --column=应用包名 --column="真的应用包名" --separator=" " --checklist --print-column=3 --multiple --height 350 --width 550 --hide-column=3 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg`
|
||||
#### 检测是否是 hold 状态
|
||||
PKG_STA=$(dpkg-query -W -f='${db:Status-Want}' $PKG_NAME)
|
||||
if [ "$PKG_STA" != "hold" ] ; then
|
||||
echo "true"
|
||||
echo "$PKG_NAME"
|
||||
echo "$PKG_NEW_VER"
|
||||
echo "$PKG_CUR_VER"
|
||||
else
|
||||
echo "false"
|
||||
echo "$PKG_NAME(无法更新:已被标记为保留)"
|
||||
echo "$PKG_NEW_VER"
|
||||
echo "$PKG_CUR_VER"
|
||||
fi
|
||||
done`
|
||||
|
||||
#### 如果没有选择,则直接退出
|
||||
### 还原分隔符
|
||||
IFS="$IFS_OLD"
|
||||
|
||||
if [ "$PKG_UPGRADE_LIST" = "" ];then
|
||||
zenity --info --text "没有选中任何软件\n但是你并没有站在世界之巅" --title "星火商店更新检测服务" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
else
|
||||
|
||||
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh upgrade-app $PKG_UPGRADE_LIST -y | zenity --progress --auto-close --no-cancel --pulsate --text=正在更新已选中的应用,请稍候... --height 70 --width 400 --title="星火商店更新模块" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
|
||||
if [ -z "`cat /tmp/spark-store-app-upgrade-status.txt`" ];then
|
||||
|
||||
zenity --info --text "选中的软件已经更新完毕" --title "星火商店更新检测模块" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
else
|
||||
zenity --error --text "更新出现错误!按确定查看报错,可用于反馈" --title "星火商店更新检测模块" --height 200 --width 350 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
zenity --text-info --filename=/tmp/spark-store-app-upgrade-log.txt --checkbox="我已复制了此文本框中的日志,且将会在反馈时附上 。反馈渠道可以在右上角菜单的设置中找到" --title="反馈渠道在商店右上角的设置里往下拉" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
fi
|
||||
|
||||
|
||||
|
||||
fi
|
||||
## 如果没有应用需要更新,则直接退出
|
||||
if [ -z "$PKG_UPGRADE_LIST" ] ; then
|
||||
zenity --info --text "没有软件需要更新\n但是你并没有站在世界之巅" --title "星火商店更新检测服务" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
else
|
||||
PKG_UPGRADE_LIST=$(echo "$PKG_UPGRADE_LIST" | zenity --list --text="选择你想更新的应用" --column="是否更新" --column="包名" --column="新版本" --column="从该版本更新" --separator=" " --checklist --multiple --print-column=2 --height 350 --width 550 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg)
|
||||
## 如果没有选择,则直接退出
|
||||
if [ -z "$PKG_UPGRADE_LIST" ] ; then
|
||||
zenity --info --text "没有选中任何软件\n但是你并没有站在世界之巅" --title "星火商店更新检测服务" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
else
|
||||
### 更新用户选择的应用
|
||||
pkexec /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh upgrade-app $PKG_UPGRADE_LIST -y | zenity --progress --auto-close --no-cancel --pulsate --text="正在更新已选中的应用,请稍候..." --height 70 --width 400 --title="星火商店更新模块" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
|
||||
#### 更新成功
|
||||
if [ -z "`cat /tmp/spark-store-app-upgrade-status.txt`" ] ; then
|
||||
zenity --info --text "选中的软件已经更新完毕" --title "星火商店更新检测模块" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
else
|
||||
#### 更新异常
|
||||
zenity --error --text "更新出现错误!按确定查看报错,可用于反馈" --title "星火商店更新检测模块" --height 200 --width 350 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
zenity --text-info --filename=/tmp/spark-store-app-upgrade-log.txt --checkbox="我已复制了此文本框中的日志,且将会在反馈时附上 。反馈渠道可以在右上角菜单的设置中找到" --title="反馈渠道在商店右上角的设置里往下拉" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f touch /tmp/spark-store/upgradeStatus.txt
|
||||
####从最开头
|
||||
# 从最开头
|
||||
|
||||
@@ -13,14 +13,9 @@ else
|
||||
text_update_open="开启"
|
||||
fi
|
||||
|
||||
if [ -f /usr/share/polkit-1/actions/store.spark-app.ssinstall.policy ];then
|
||||
text_auto_install_open="关闭"
|
||||
#已经开启了就显示关闭
|
||||
else
|
||||
text_auto_install_open="开启"
|
||||
fi
|
||||
|
||||
option=`zenity --list --text="欢迎使用星火更新和安装设置工具\n请在以下操作中选择一个进行~" --column 数字 --column=操作选项 --print-column=2 --height 350 --width 760 0 "查看自动更新相关功能使用前须知(重要)" 1 "$text_update_open星火更新检测工具(如果开启则会在系统启动后自动检测更新。如有更新则会弹出通知)" 2 查看可更新软件包列表并决定是否更新 3 "$text_auto_install_open点击安装免输入密码功能" 4 退出脚本 --hide-column=1 --print-column=1`
|
||||
|
||||
option=`zenity --list --text="欢迎使用星火更新和安装设置工具\n请在以下操作中选择一个进行~" --column 数字 --column=操作选项 --print-column=2 --height 350 --width 760 0 "查看自动更新相关功能使用前须知(重要)" 1 "$text_update_open星火更新检测工具(如果开启则会在系统启动后自动检测更新。如有更新则会弹出通知)" 2 查看可更新软件包列表并决定是否更新 4 退出脚本 --hide-column=1 --print-column=1`
|
||||
|
||||
case $option in
|
||||
0)
|
||||
@@ -42,25 +37,7 @@ case $option in
|
||||
2)
|
||||
/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh
|
||||
;;
|
||||
3)
|
||||
if [ -f /usr/share/polkit-1/actions/store.spark-app.ssinstall.policy ];then
|
||||
zenity --info --icon-name=spark-store --height 150 --width 200 --text "---检测到已经启动了免输入密码,执行关闭" --timeout=2
|
||||
pkexec rm /usr/share/polkit-1/actions/store.spark-app.ssinstall.policy
|
||||
zenity --info --icon-name=spark-store --height 150 --width 200 --text "已关闭" --timeout=2
|
||||
else
|
||||
|
||||
is_accept_polkiy=`zenity --list --height 350 --width 300 --text "请注意:这个功能尚未开发完成,一旦开启,则运行pkexec ssinstall时不再需要授权\n仅对星火内置安装器生效\n理论上会存在一定的安全风险" --column 数字 --column=操作选项 --hide-column=1 --print-column=1 1 同意 2 拒绝`
|
||||
|
||||
|
||||
|
||||
if [ "$is_accept_polkiy" = "1" ];then
|
||||
pkexec ln -s /opt/durapps/spark-store/bin/auto-install-policy/store.spark-app.ssinstall.policy /usr/share/polkit-1/actions/store.spark-app.ssinstall.policy
|
||||
zenity --info --icon-name=spark-store --height 150 --width 200 --text "---已启动"
|
||||
else
|
||||
zenity --info --icon-name=spark-store --height 150 --width 200 --text "---未同意,返回"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
4)
|
||||
exit 0
|
||||
;;
|
||||
|
||||
@@ -1,96 +1,93 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
LANG=en.US
|
||||
LANGUAGE=en_US
|
||||
|
||||
# 发送通知
|
||||
function notify-send() {
|
||||
#Detect the name of the display in use
|
||||
# Detect name of the display in use
|
||||
local display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
|
||||
|
||||
#Detect the user using such display
|
||||
# Detect user using the display
|
||||
local user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
|
||||
|
||||
#Detect the id of the user
|
||||
# Detect uid of the user
|
||||
local uid=$(id -u $user)
|
||||
|
||||
sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"
|
||||
sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus notify-send "$@"
|
||||
}
|
||||
|
||||
#检测网络链接畅通
|
||||
# 检测网络链接畅通
|
||||
function network()
|
||||
{
|
||||
#超时时间
|
||||
# 超时时间
|
||||
local timeout=15
|
||||
|
||||
#目标网站
|
||||
# 目标网站
|
||||
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
|
||||
#网络畅通
|
||||
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
|
||||
if [ $? -ne 0 ] ; 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
|
||||
# The code above is modified from https://blog.csdn.net/yaxuan88521/article/details/120516298
|
||||
|
||||
curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list"
|
||||
# 每日更新星火源文件
|
||||
mkdir -p /etc/apt/preferences.d
|
||||
touch /etc/apt/preferences.d/sparkstore
|
||||
cat << EOF >/etc/apt/preferences.d/sparkstore
|
||||
Package: *
|
||||
Pin: origin *.deepinos.org.cn
|
||||
Pin-Priority: 100
|
||||
|
||||
EOF
|
||||
curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list"
|
||||
|
||||
updatetext=`aptss ssupdate`
|
||||
|
||||
rm /etc/apt/preferences.d/sparkstore
|
||||
|
||||
|
||||
isupdate=`echo ${updatetext: -5}`
|
||||
if [ "$isupdate" = "date." ];then
|
||||
exit 0
|
||||
if [ "$isupdate" = "date." ] ; then
|
||||
exit 0
|
||||
fi
|
||||
#### 从这里开始,只有检测到了更新才会进行
|
||||
|
||||
## 从这里开始,只有检测到了更新才会进行
|
||||
update_app_number=`echo ${updatetext%package*} #从右向左截取第一个 src 后的字符串`
|
||||
update_app_number=`echo ${update_app_number##*information...}`
|
||||
|
||||
# 获取用户选择的要更新的应用
|
||||
PKG_LIST="$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh upgradable-list)"
|
||||
# 指定分隔符为 \n
|
||||
IFS_OLD="$IFS"
|
||||
IFS=$'\n'
|
||||
|
||||
PKG_LIST="$(bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" | awk 'BEGIN {FS="/"} {print $1}' | awk NR\>1)"
|
||||
for line in $PKG_LIST ; do
|
||||
PKG_NAME=$(echo $line | awk -F ' ' '{print $1}')
|
||||
PKG_NEW_VER=$(echo $line | awk -F ' ' '{print $2}')
|
||||
PKG_CUR_VER=$(echo $line | awk -F ' ' '{print $3}')
|
||||
|
||||
dpkg --compare-versions $PKG_NEW_VER le $PKG_CUR_VER
|
||||
|
||||
if [ $? -eq 0 ] ; then
|
||||
let update_app_number=$update_app_number-1
|
||||
continue
|
||||
fi
|
||||
|
||||
for PKG_NAME in $PKG_LIST;do
|
||||
if [ "$(dpkg-query -W -f='${Status}' $PKG_NAME | grep hold)" != "" ];then
|
||||
let update_app_number=$update_app_number-1
|
||||
echo $update_app_number
|
||||
echo $PKG_NAME
|
||||
fi
|
||||
## 检测是否是 hold 状态
|
||||
PKG_STA=$(dpkg-query -W -f='${db:Status-Want}' $PKG_NAME)
|
||||
if [ "$PKG_STA" = "hold" ] ; then
|
||||
let update_app_number=$update_app_number-1
|
||||
fi
|
||||
done
|
||||
|
||||
# 还原分隔符
|
||||
IFS="$IFS_OLD"
|
||||
|
||||
|
||||
if [ $update_app_number -lt 1 ];then
|
||||
exit
|
||||
if [ $update_app_number -le 0 ] ; then
|
||||
exit 0
|
||||
fi
|
||||
#### 如果都是hold的那就直接退出,否则把剩余的给提醒了
|
||||
|
||||
notify-send -i spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
|
||||
|
||||
|
||||
## 如果都是hold或者版本一致的那就直接退出,否则把剩余的给提醒了
|
||||
notify-send -a spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
|
||||
|
||||
Reference in New Issue
Block a user