From 4485ff3b7464a92f946cc417460d5cd4d895b45f Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Wed, 1 May 2024 08:09:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BD=AC=E5=8C=85=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShellList/turn-loongarch64-to-loong64-deb.py | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 ShellList/turn-loongarch64-to-loong64-deb.py diff --git a/ShellList/turn-loongarch64-to-loong64-deb.py b/ShellList/turn-loongarch64-to-loong64-deb.py new file mode 100755 index 0000000..5618a53 --- /dev/null +++ b/ShellList/turn-loongarch64-to-loong64-deb.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +import os +import sys + +def ReadTXT(path): + with open(path, "r") as file: + thing = file.read() + return thing + +def WriteTXT(path, data): + with open(path, "w") as file: + file.write(data) + +debList = sys.argv[1:] +for i in debList: + # 解包 + os.system("rm -rf /tmp/change-old-to-new") + os.system(f"dpkg -x '{i}' /tmp/change-old-to-new") + os.system(f"dpkg -e '{i}' /tmp/change-old-to-new/DEBIAN") + info = ReadTXT("/tmp/change-old-to-new/DEBIAN/control").replace(": loongarch64", ": loong64").replace("Depends: ", "Depends: liblol, ") + WriteTXT("/tmp/change-old-to-new/DEBIAN/control", info) + os.system(f"dpkg-deb -Z xz -z 9 -b /tmp/change-old-to-new '{os.path.basename(i).replace('_loongarch64', '_loong64')}'") + # 检查是否能正常安装