From d19453bb2245983478549e1fcfe1dc71674cbaa5 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Thu, 6 Jun 2024 21:11:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BA=94=E6=80=A5=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair-arm-package-problem-to-uos.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 ShellList/repair-arm-package-problem-to-uos.py diff --git a/ShellList/repair-arm-package-problem-to-uos.py b/ShellList/repair-arm-package-problem-to-uos.py new file mode 100644 index 0000000..b8392dc --- /dev/null +++ b/ShellList/repair-arm-package-problem-to-uos.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +import os +import sys + +def Replace(path): + "spark-dwine-helper | store.spark-app.spark-dwine-helper" + "deepin-wine-helper (>= 5.1.30-1)" + "com.wine-helper.deepin" + with open(f"{path}/DEBIAN/control", "r") as file: + data = file.read() + + isReplace = False + isSparkHelper = False + if "spark-dwine-helper | store.spark-app.spark-dwine-helper" in data and not isReplace: + isReplace = True + isSparkHelper = True + data = data.replace("spark-dwine-helper | store.spark-app.spark-dwine-helper", "deepin-wine-helper | com.wine-helper.deepin") + if "deepin-wine-helper (>= 5.1.30-1)" in data and not isReplace: + isReplace = True + data = data.replace("deepin-wine-helper (>= 5.1.30-1)", "deepin-wine-helper | com.wine-helper.deepin") + with open(f"{path}/DEBIAN/control", "w") as file: + file.write(data) + if isSparkHelper: + ReplaceSparkHelper(path) + +def ReplaceSparkHelper(path): + name = os.listdir(f"{path}/opt/apps/")[0] + with open(f"{path}/opt/apps/{name}/files/run.sh", "r") as file: + data = file.read().replace("/opt/deepinwine/tools/spark_run_v4.sh", "/opt/deepinwine/tools/run_v4.sh") + with open(f"{path}/opt/apps/{name}/files/run.sh", "w") as file: + file.write(data) + +tempPath = "/tmp/turn-deb" +for i in sys.argv[1:]: + os.system(f"rm -rf '{tempPath}'") + os.system(f"dpkg -x '{i}' '{tempPath}'") + os.system(f"dpkg -e '{i}' '{tempPath}/DEBIAN'") + fileName = os.path.splitext(i)[0] + # 修改 control 文件 + Replace(tempPath) + + os.system(f"dpkg-deb -Z xz -z 0 -b '{tempPath}' '{fileName}-new.deb'") \ No newline at end of file