diff --git a/tool/ssaudit b/tool/ssaudit index 7d63180..b34d870 100755 --- a/tool/ssaudit +++ b/tool/ssaudit @@ -1,50 +1,134 @@ #!/bin/bash -echo "Spark Store Audit script.星火商店审核脚本" +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +load_transhell_debug + +case $(arch) in + x86_64) + STORE_URL="store" + ;; + aarch64) + STORE_URL="aarch64-store" + ;; +esac + +echo "Spark Store Install script. 星火商店安装脚本" + +function pkexec_as_current_user() { + local user=$(who | awk '{print $1}' | head -n 1) + local uid=$(id -u "$user") + sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus pkexec "$@" +} +function create_desktop_file() { + if [ -e $(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-show-upgrade-notify ];then + echo "It is configured that do not create desktop file. Give up" + else + create_desktop_file + fi +] +function exec_create_desktop_file() { + local user=$(who | awk '{print $1}' | head -n 1) + for desktop_file_path in $(dpkg -L "$package_name" | grep .desktop); do + if [ "$(cat $desktop_file_path | grep NoDisplay=true)" = "" ];then + echo $desktop_file_path is checked and will be installed to desktop + sudo -u "$user" cp "$desktop_file_path" "$(sudo -u "$user" xdg-user-dir DESKTOP)/" + fi + done +} + +function zenity() { + local user=$(who | awk '{print $1}' | head -n 1) + local uid=$(id -u "$user") + sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus zenity "$@" +} + +function hash_check() { + if [ ! -e "/var/lib/aptss/lists/cdn.d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && \ + [ ! -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && \ + [ ! -e "/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" ]; then + echo "接收星火仓库软件信息中..." + aptss ssupdate + fi + + if [ -e "/var/lib/aptss/lists/cdn.d.store.deepinos.org.cn_${STORE_URL}_Packages" ]; then + PACKAGES_DATA_PATH="/var/lib/aptss/lists/cdn.d.store.deepinos.org.cn_${STORE_URL}_Packages" + echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是星火域名单目录仓库配置" + elif [ -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ]; then + PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" + echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是星火域名单目录仓库配置" + else + PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" + echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是SDU镜像仓库配置" + fi + + echo "正在运行包验证..." + echo "Running Spark Package Verify..." + + DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1) + IS_SHA512SUM_CHECKED=$(cat "$PACKAGES_DATA_PATH" | grep "$DEB_SHA512SUM") +} -#################检测文件是否存在 -if [ $# -eq 0 ];then -echo "没有接收到参数,退出" -echo "用法:$0 deb路径" -exit -fi -if [ ! -f "$1" ] -then - echo "文件不存在" - exit 1 -fi +#################################### -if [ "$(id -u)" != "0" ];then -#############################无root权限时 -echo "请使用root启动ssaudit" -exit 1 -fi - -### - - -DEBPATH=`realpath $1` -echo ------------------------------------------------------------ -try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") -try_run_ret="$?" - - if [ "$try_run_ret" -ne 0 ] - then +if [ $# -eq 0 ]; then + echo "没有接收到参数,退出" + echo "用法:$0 deb路径" echo "OMG-IT-GOES-WRONG" - echo -e "${try_run_output}" - exit "$try_run_ret" - fi + exit +fi - -dpkg -i "$DEBPATH" || aptss install -yf -install_ret="$?" - - - if [ "$install_ret" -ne 0 ] - then +if [ ! -f "$1" ]; then + echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST}" echo "OMG-IT-GOES-WRONG" - exit "$install_ret" - fi -echo ---------------安装结束--------------- \ No newline at end of file + exit 1 +fi + +if [ "$(id -u)" != "0" ]; then + echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}" + echo "OMG-IT-GOES-WRONG" + exit 1 +fi + +DEBPATH=$(realpath "$1") + + + + package_name=$(dpkg-deb -f "$DEBPATH" Package) + echo "Package name is $package_name" + try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") + try_run_ret="$?" + + if [ "$try_run_ret" -ne 0 ]; then + echo "OMG-IT-GOES-WRONG" + echo -e "${try_run_output}" + exit "$try_run_ret" + fi + + dpkg -i "$DEBPATH" || aptss install -yf + + if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已安装:$package_name" + create_desktop_file + rm "$DEBPATH" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + else + echo "软件包未安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + fi + else + echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已安装:$package_name" + create_desktop_file + else + echo "软件包未安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + fi + fi + + diff --git a/tool/update-upgrade/ss-update-controler.sh b/tool/update-upgrade/ss-update-controler.sh index c6297a0..74f6130 100755 --- a/tool/update-upgrade/ss-update-controler.sh +++ b/tool/update-upgrade/ss-update-controler.sh @@ -24,7 +24,7 @@ fi update_transhell -option=`zenity --list --text="${TRANSHELL_CONTENT_WELCOME_AND_CHOOSE_ONE_TO_RUN}" --column 数字 --column=${TRANSHELL_CONTENT_OPTIONS} --print-column=2 --height 350 --width 760 0 "${TRANSHELL_CONTENT_OPEN_OR_CLOSE_UPGRADE_CHECK}" 1 "${CONTENT_SET_CREATE_DESKTOP}" 2 "${TRANSHELL_CONTENT_CHECK_FOR_UPDATE}" 3 "${TRANSHELL_CONTENT_EXIT}" --hide-column=1 --print-column=1` +option=$(zenity --list --text="${TRANSHELL_CONTENT_WELCOME_AND_CHOOSE_ONE_TO_RUN}" --column 数字 --column=${TRANSHELL_CONTENT_OPTIONS} --print-column=2 --height 350 --width 760 0 "${TRANSHELL_CONTENT_OPEN_OR_CLOSE_UPGRADE_CHECK}" 1 "${CONTENT_SET_CREATE_DESKTOP}" 2 "${TRANSHELL_CONTENT_CHECK_FOR_UPDATE}" 3 "${TRANSHELL_CONTENT_EXIT}" --hide-column=1 --print-column=1) case $option in 0) @@ -45,6 +45,7 @@ case $option in else rm -f $HOME/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop zenity --info --icon-name=spark-store --height 150 --width 200 --text "${TRANSHELL_CONTENT_OPENED}" --timeout=2 + fi ;; 2) /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh diff --git a/tool/update-upgrade/transhell/ss-update-controler.sh.zh_CN.transhell b/tool/update-upgrade/transhell/ss-update-controler.sh_zh_CN.transhell similarity index 100% rename from tool/update-upgrade/transhell/ss-update-controler.sh.zh_CN.transhell rename to tool/update-upgrade/transhell/ss-update-controler.sh_zh_CN.transhell diff --git a/tool/update-upgrade/transhell/ss-update-controler.sh.zh_TW.transhell b/tool/update-upgrade/transhell/ss-update-controler.sh_zh_TW.transhell similarity index 100% rename from tool/update-upgrade/transhell/ss-update-controler.sh.zh_TW.transhell rename to tool/update-upgrade/transhell/ss-update-controler.sh_zh_TW.transhell diff --git a/translations/spark-store_en.ts b/translations/spark-store_en.ts index aa11124..2fe4e31 100644 --- a/translations/spark-store_en.ts +++ b/translations/spark-store_en.ts @@ -480,33 +480,33 @@ <translation type="unfinished"></translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="189"/> + <location filename="../src/mainwindow-dtk.cpp" line="188"/> <source>Submit App</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="190"/> + <location filename="../src/mainwindow-dtk.cpp" line="189"/> <source>Submit App with client(Recommanded)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="191"/> + <location filename="../src/mainwindow-dtk.cpp" line="190"/> <source>Settings</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="192"/> + <location filename="../src/mainwindow-dtk.cpp" line="191"/> <source>APP Upgrade and Install Settings</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="148"/> - <location filename="../src/mainwindow-dtk.cpp" line="243"/> + <location filename="../src/mainwindow-dtk.cpp" line="147"/> + <location filename="../src/mainwindow-dtk.cpp" line="242"/> <source>Spark Store</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="153"/> + <location filename="../src/mainwindow-dtk.cpp" line="152"/> <source>Search or enter spk://</source> <translation type="unfinished"></translation> </message> @@ -516,7 +516,7 @@ <message> <location filename="../src/application.cpp" line="35"/> <location filename="../src/application.cpp" line="36"/> - <location filename="../src/mainwindow-dtk.cpp" line="128"/> + <location filename="../src/mainwindow-dtk.cpp" line="126"/> <source>Spark Store</source> <translation type="unfinished"></translation> </message> @@ -536,7 +536,7 @@ <translation type="unfinished"></translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="246"/> + <location filename="../src/mainwindow-dtk.cpp" line="245"/> <source>Show MainWindow</source> <translation type="unfinished"></translation> </message> @@ -658,12 +658,12 @@ <context> <name>TitleBarMenu</name> <message> - <location filename="../src/mainwindow-dtk.cpp" line="247"/> + <location filename="../src/mainwindow-dtk.cpp" line="246"/> <source>About</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="248"/> + <location filename="../src/mainwindow-dtk.cpp" line="247"/> <source>Exit</source> <translation type="unfinished"></translation> </message> diff --git a/translations/spark-store_es.ts b/translations/spark-store_es.ts index 28ee71c..421c0e3 100644 --- a/translations/spark-store_es.ts +++ b/translations/spark-store_es.ts @@ -480,33 +480,33 @@ <translation>Actualización de app</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="189"/> + <location filename="../src/mainwindow-dtk.cpp" line="188"/> <source>Submit App</source> <translation>Presentación de la aplicación</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="190"/> + <location filename="../src/mainwindow-dtk.cpp" line="189"/> <source>Submit App with client(Recommanded)</source> <translation>Enviar la aplicación al cliente (recomendación)</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="191"/> + <location filename="../src/mainwindow-dtk.cpp" line="190"/> <source>Settings</source> <translation>Configuración</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="192"/> + <location filename="../src/mainwindow-dtk.cpp" line="191"/> <source>APP Upgrade and Install Settings</source> <translation>Actualización e instalación de app</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="148"/> - <location filename="../src/mainwindow-dtk.cpp" line="243"/> + <location filename="../src/mainwindow-dtk.cpp" line="147"/> + <location filename="../src/mainwindow-dtk.cpp" line="242"/> <source>Spark Store</source> <translation>SPARK Store</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="153"/> + <location filename="../src/mainwindow-dtk.cpp" line="152"/> <source>Search or enter spk://</source> <translation>Buscar o introducir spk: /%</translation> </message> @@ -516,7 +516,7 @@ <message> <location filename="../src/application.cpp" line="35"/> <location filename="../src/application.cpp" line="36"/> - <location filename="../src/mainwindow-dtk.cpp" line="128"/> + <location filename="../src/mainwindow-dtk.cpp" line="126"/> <source>Spark Store</source> <translation>SPARK Store</translation> </message> @@ -536,7 +536,7 @@ <translation>Descargar lista</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="246"/> + <location filename="../src/mainwindow-dtk.cpp" line="245"/> <source>Show MainWindow</source> <translation>Mostrar la ventana principal</translation> </message> @@ -658,12 +658,12 @@ <context> <name>TitleBarMenu</name> <message> - <location filename="../src/mainwindow-dtk.cpp" line="247"/> + <location filename="../src/mainwindow-dtk.cpp" line="246"/> <source>About</source> <translation>Sobre</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="248"/> + <location filename="../src/mainwindow-dtk.cpp" line="247"/> <source>Exit</source> <translation>Exportaciones</translation> </message> diff --git a/translations/spark-store_fr.ts b/translations/spark-store_fr.ts index 5801d28..89dd7b8 100644 --- a/translations/spark-store_fr.ts +++ b/translations/spark-store_fr.ts @@ -480,33 +480,33 @@ <translation>Mise à niveau app</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="189"/> + <location filename="../src/mainwindow-dtk.cpp" line="188"/> <source>Submit App</source> <translation>Soumettre une application</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="190"/> + <location filename="../src/mainwindow-dtk.cpp" line="189"/> <source>Submit App with client(Recommanded)</source> <translation>Soumettre une demande au client (recommandé)</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="191"/> + <location filename="../src/mainwindow-dtk.cpp" line="190"/> <source>Settings</source> <translation>Paramètres</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="192"/> + <location filename="../src/mainwindow-dtk.cpp" line="191"/> <source>APP Upgrade and Install Settings</source> <translation>Paramètres de mise à niveau et d'installation de l'app</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="148"/> - <location filename="../src/mainwindow-dtk.cpp" line="243"/> + <location filename="../src/mainwindow-dtk.cpp" line="147"/> + <location filename="../src/mainwindow-dtk.cpp" line="242"/> <source>Spark Store</source> <translation>Le Spark store</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="153"/> + <location filename="../src/mainwindow-dtk.cpp" line="152"/> <source>Search or enter spk://</source> <translation>Rechercher ou entrer SPK /</translation> </message> @@ -516,7 +516,7 @@ <message> <location filename="../src/application.cpp" line="35"/> <location filename="../src/application.cpp" line="36"/> - <location filename="../src/mainwindow-dtk.cpp" line="128"/> + <location filename="../src/mainwindow-dtk.cpp" line="126"/> <source>Spark Store</source> <translation>Le Spark store</translation> </message> @@ -536,7 +536,7 @@ <translation>Télécharger la Liste</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="246"/> + <location filename="../src/mainwindow-dtk.cpp" line="245"/> <source>Show MainWindow</source> <translation>Afficher la fenêtre principale</translation> </message> @@ -658,12 +658,12 @@ <context> <name>TitleBarMenu</name> <message> - <location filename="../src/mainwindow-dtk.cpp" line="247"/> + <location filename="../src/mainwindow-dtk.cpp" line="246"/> <source>About</source> <translation>À propos</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="248"/> + <location filename="../src/mainwindow-dtk.cpp" line="247"/> <source>Exit</source> <translation>Exportations</translation> </message> diff --git a/translations/spark-store_zh_CN.ts b/translations/spark-store_zh_CN.ts index 8ebdcae..1601d08 100644 --- a/translations/spark-store_zh_CN.ts +++ b/translations/spark-store_zh_CN.ts @@ -480,33 +480,33 @@ <translation>更新</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="189"/> + <location filename="../src/mainwindow-dtk.cpp" line="188"/> <source>Submit App</source> <translation>投递应用</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="190"/> + <location filename="../src/mainwindow-dtk.cpp" line="189"/> <source>Submit App with client(Recommanded)</source> <translation>使用本地投稿器投递应用(推荐)</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="191"/> + <location filename="../src/mainwindow-dtk.cpp" line="190"/> <source>Settings</source> <translation>设置</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="192"/> + <location filename="../src/mainwindow-dtk.cpp" line="191"/> <source>APP Upgrade and Install Settings</source> <translation>应用更新和安装设置</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="148"/> - <location filename="../src/mainwindow-dtk.cpp" line="243"/> + <location filename="../src/mainwindow-dtk.cpp" line="147"/> + <location filename="../src/mainwindow-dtk.cpp" line="242"/> <source>Spark Store</source> <translation>星火应用商店</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="153"/> + <location filename="../src/mainwindow-dtk.cpp" line="152"/> <source>Search or enter spk://</source> <translation>搜索或打开链接</translation> </message> @@ -516,7 +516,7 @@ <message> <location filename="../src/application.cpp" line="35"/> <location filename="../src/application.cpp" line="36"/> - <location filename="../src/mainwindow-dtk.cpp" line="128"/> + <location filename="../src/mainwindow-dtk.cpp" line="126"/> <source>Spark Store</source> <translation>星火应用商店</translation> </message> @@ -536,7 +536,7 @@ <translation>下载列表</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="246"/> + <location filename="../src/mainwindow-dtk.cpp" line="245"/> <source>Show MainWindow</source> <translation>显示主窗口</translation> </message> @@ -658,12 +658,12 @@ <context> <name>TitleBarMenu</name> <message> - <location filename="../src/mainwindow-dtk.cpp" line="247"/> + <location filename="../src/mainwindow-dtk.cpp" line="246"/> <source>About</source> <translation>关于</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="248"/> + <location filename="../src/mainwindow-dtk.cpp" line="247"/> <source>Exit</source> <translation>退出</translation> </message> diff --git a/translations/spark-store_zh_TW.ts b/translations/spark-store_zh_TW.ts index 3c2f0c3..d61447a 100644 --- a/translations/spark-store_zh_TW.ts +++ b/translations/spark-store_zh_TW.ts @@ -480,33 +480,33 @@ <translation>軟體更新</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="189"/> + <location filename="../src/mainwindow-dtk.cpp" line="188"/> <source>Submit App</source> <translation>上傳軟體</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="190"/> + <location filename="../src/mainwindow-dtk.cpp" line="189"/> <source>Submit App with client(Recommanded)</source> <translation>從客戶端上傳軟體(推薦的)</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="191"/> + <location filename="../src/mainwindow-dtk.cpp" line="190"/> <source>Settings</source> <translation>設定</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="192"/> + <location filename="../src/mainwindow-dtk.cpp" line="191"/> <source>APP Upgrade and Install Settings</source> <translation>軟體升級 和 安裝設定</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="148"/> - <location filename="../src/mainwindow-dtk.cpp" line="243"/> + <location filename="../src/mainwindow-dtk.cpp" line="147"/> + <location filename="../src/mainwindow-dtk.cpp" line="242"/> <source>Spark Store</source> <translation>星火应用商店</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="153"/> + <location filename="../src/mainwindow-dtk.cpp" line="152"/> <source>Search or enter spk://</source> <translation>搜索或打开链接</translation> </message> @@ -516,7 +516,7 @@ <message> <location filename="../src/application.cpp" line="35"/> <location filename="../src/application.cpp" line="36"/> - <location filename="../src/mainwindow-dtk.cpp" line="128"/> + <location filename="../src/mainwindow-dtk.cpp" line="126"/> <source>Spark Store</source> <translation>星火应用商店</translation> </message> @@ -536,7 +536,7 @@ <translation>下载列表</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="246"/> + <location filename="../src/mainwindow-dtk.cpp" line="245"/> <source>Show MainWindow</source> <translation>显示主窗口</translation> </message> @@ -658,12 +658,12 @@ <context> <name>TitleBarMenu</name> <message> - <location filename="../src/mainwindow-dtk.cpp" line="247"/> + <location filename="../src/mainwindow-dtk.cpp" line="246"/> <source>About</source> <translation>关于</translation> </message> <message> - <location filename="../src/mainwindow-dtk.cpp" line="248"/> + <location filename="../src/mainwindow-dtk.cpp" line="247"/> <source>Exit</source> <translation>退出</translation> </message>