lilac/repo/ttf-ms-win11-auto/lilac.py
2023-05-20 14:19:33 +08:00

35 lines
1.1 KiB
Python

from lilaclib import *
import subprocess
def apply_patch(filename, patch):
patch_proc = subprocess.Popen(["patch", "-p1", filename], stdin=subprocess.PIPE, text=True)
patch_proc.communicate(patch)
def pre_build():
aur_pre_build()
apply_patch('PKGBUILD', PATCH)
PATCH=r"""
diff --git a/PKGBUILD b/PKGBUILD
index 7c63329..457ba24 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -401,13 +401,11 @@ prepare() {
echo "- Fonts are missing"
echo -ne "- Mount filesystems as a non-privileged user: "
touch test.mount
- _unprivilegedMountAllowed=false
- _testLoopDev=$(udisksctl loop-setup -r -f test.mount --no-user-interaction | awk '{print $NF}') && _unprivilegedMountAllowed=true
- _testLoopDev=${_testLoopDev::-1}
- udisksctl loop-delete -b "$_testLoopDev" --no-user-interaction
+ _mount=
+ udisksctl loop-setup -r -f test.mount --no-user-interaction >/dev/null 2>&1 && _mount=true
rm test.mount
- if [ $_unprivilegedMountAllowed ]; then
+ if [ $_mount ]; then
echo "allowed"
echo "- Downloading fonts directly"
mkdir -p mnt/http
"""