Compare commits

...

34 Commits

Author SHA1 Message Date
zty199
2cd976491f fix: 修复应用更新失败问题
zenity 处理多选框时,返回结果取值错误导致,获取值实际为已安装版本号,而不是包名

Log: 修改 zenity 参数为 --print-column=2 获取包名
2022-12-22 00:27:26 +08:00
zty199
60d336e2dd fix: 修复检查到应用更新没有系统通知的问题
错误地把 sudo 改为了 su(su $USER -c xxxxxx)

Log: 还原为 sudo -u $USER xxxxxx
2022-12-22 00:27:14 +08:00
4957e006d0 修复文案 2022-12-22 00:26:39 +08:00
zty199
a3d803477a fix: 修复可更新应用列表为空时仍然弹出选择应用更新对话框的问题
获取可更新应用列表后直接赋值给 zenity 处理,未对列表为空进行处理

Log: 获取可更新应用列表后,若列表为空则退出;不为空再交给 zenity 处理
2022-12-22 00:21:55 +08:00
9897ba84ba 仍然有点小问题的更新检测 2022-12-22 00:21:44 +08:00
ca29afa425 安全的免密码安装 2022-12-12 17:15:18 +08:00
97098f794d sync: sync changes form 4.0 2022-12-12 16:49:38 +08:00
ebaeca359a fix: 超时时间错误 2022-12-12 16:44:02 +08:00
63ca640c31 update debian/changelog.
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-12 08:31:23 +00:00
e67d3fab76 update src/main.cpp.
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-12 08:29:15 +00:00
d01fe44152 update src/downloadworker.cpp.
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-12 08:28:10 +00:00
43042b5ae7 缺少 echo
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-12 01:23:48 +00:00
9614efa0aa 仍然选用绝对路径 2022-12-11 18:33:46 +08:00
b1499b5942 3.5.2 ss-apt-fast作为apt-fast的别名 2022-12-11 18:28:57 +08:00
e8c344f75d version 3.5.1.1
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-11 10:03:35 +00:00
a388535361 fix shebang
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-11 10:02:20 +00:00
e94ee00ade update debian/changelog.
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-11 10:01:39 +00:00
0119b21c82 version 3.5.1
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-10 12:54:32 +00:00
601b086923 update debian/changelog.
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-10 12:53:24 +00:00
f1a2886161 !158 dev--->lts3.5同步
Merge pull request !158 from shenmo/dev
2022-12-10 12:48:59 +00:00
e2f1a344c4 !157 合入zty的修改
Merge pull request !157 from shenmo/lts-3.5
2022-12-10 12:48:16 +00:00
9fc5153f37 !156 修复搜索的一些细节
Merge pull request !156 from Pluto/lts-3.5
2022-12-09 05:09:18 +00:00
zty199
b93f6362b7 fix: Issues #I65G7Y 在 appinfo 界面执行搜索无反应
网页搜索未切换 stackedWidget

Log: 添加切换 stackedWidget 至 index 0 操作
2022-12-09 12:41:29 +08:00
32350cf519 fix: 多次搜索后页面不显示 2022-12-09 12:26:14 +08:00
c27c922d0b fix: 清除web缓存 2022-12-09 12:23:27 +08:00
6dee04f5e8 update .workflow/dtk-build-commit-20220425.yml.
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-09 03:47:22 +00:00
924d8d18a9 update dtk-build-release-tag-20220425.yml 2022-12-09 03:41:27 +00:00
f027a2fa7e !155 版本号
Merge pull request !155 from shenmo/dev
2022-12-09 03:34:32 +00:00
89c4b968f3 版本号
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-09 03:33:40 +00:00
ab36e76032 !154 dev--->master: 3.5正式版
Merge pull request !154 from shenmo/dev
2022-12-09 03:32:27 +00:00
f49db42c3a update debian/changelog.
Signed-off-by: shenmo <jifengshenmo@outlook.com>
2022-12-09 03:27:52 +00:00
58b31f182a !153 搜索从网页加载
Merge pull request !153 from Pluto/dev
2022-12-09 03:25:07 +00:00
a30c26a7f2 !151 fix: aria2指定dns,指定最大并发下载数
Merge pull request !151 from Pluto/dev
2022-12-08 10:20:40 +00:00
4dbd79a1ac !150 333 正式版
Merge pull request !150 from shenmo/dev
2022-11-26 09:28:40 +00:00
16 changed files with 271 additions and 199 deletions

View File

@@ -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
- '# 换源'

View File

@@ -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
View File

@@ -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转而自带

View File

@@ -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

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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();

View File

@@ -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");

View File

@@ -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)

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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
####从最开头
# 从最开头

View File

@@ -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
;;

View File

@@ -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个软件包可以更新啦!请到星火商店的菜单处理"