From 366ed1d58d0d6f8871414137ea731f3030fb760d Mon Sep 17 00:00:00 2001 From: gfdgd-xi <3025613752@qq.com> Date: Mon, 26 Jun 2023 09:23:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E8=A7=A3=E5=86=B3=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gx-env-load-desktop-in-chroot | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gx-env-load-desktop-in-chroot b/gx-env-load-desktop-in-chroot index e27fe64..7434143 100644 --- a/gx-env-load-desktop-in-chroot +++ b/gx-env-load-desktop-in-chroot @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import os +import subprocess #chrootEnvPath="/opt/new-system-env" chrootEnvPath="/" @@ -7,6 +8,8 @@ if not os.path.exists("/gx-env/desktop"): os.makedirs("/gx-env/desktop") if not os.path.exists("/gx-env/shell"): os.makedirs("/gx-env/shell") +if not os.path.exists("/gx-env/icons"): + os.makedirs("/gx-env/icons") for i in os.listdir("{}/usr/share/applications".format(chrootEnvPath)): if os.path.exists("/usr/share/applications/gx-env-{}".format(i)): continue @@ -32,6 +35,13 @@ for i in os.listdir("{}/usr/share/applications".format(chrootEnvPath)): elif "icon=" in r.lower(): if os.path.exists(r[5:]): newInfo += "Icon=/opt/new-system-env/" + r[5:] + "\n" + else: + path = subprocess.getoutput("find /usr/share/icons -name '{}.???' | head -n1".format(r[5:])) + if os.path.islink(path): + os.system("cp '{}' '/gx-env/icons/{}'".format(path, os.path.basename(path))) + newInfo += "Icon=/opt/new-system-env/gx-env/icons/" + os.path.basename(path) + "\n" + else: + newInfo += "Icon=/opt/new-system-env/" + path + "\n" else: newInfo += r + "\n" print(newInfo)