Paketierungs-Postinstall-Skripte für /var/lib/mac2ip ergänzen
deb/rpm/arch legen beim Paket-Install /var/lib/mac2ip mit 0777 an, da der globale Cache für alle Nutzer beschreibbar sein muss, /var/lib selbst aber nur root beschreiben kann. package-arch.py unterstützt dafür neu ein optionales, metadatengetriebenes Install-Skriptlet ([package.metadata.arch].install_script), das pacman-konform als <name>.install eingebettet wird. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0118Wbg95ADSDynYfci2qUjK
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
post_install() {
|
||||||
|
mkdir -p /var/lib/mac2ip
|
||||||
|
chmod 0777 /var/lib/mac2ip
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
post_install
|
||||||
|
}
|
||||||
Executable
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mkdir -p /var/lib/mac2ip
|
||||||
|
chmod 0777 /var/lib/mac2ip
|
||||||
|
|
||||||
|
exit 0
|
||||||
+16
-1
@@ -87,6 +87,7 @@ def build_package(target_triple=None, target_arch=None, pkgrel=None):
|
|||||||
|
|
||||||
depends = arch_meta.get("depends", ["gcc-libs", "glibc"])
|
depends = arch_meta.get("depends", ["gcc-libs", "glibc"])
|
||||||
optdepends = arch_meta.get("optdepends", [])
|
optdepends = arch_meta.get("optdepends", [])
|
||||||
|
install_rel_path = arch_meta.get("install_script")
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as build_dir:
|
with tempfile.TemporaryDirectory() as build_dir:
|
||||||
bin_dir = os.path.join(build_dir, "usr/bin")
|
bin_dir = os.path.join(build_dir, "usr/bin")
|
||||||
@@ -102,6 +103,14 @@ def build_package(target_triple=None, target_arch=None, pkgrel=None):
|
|||||||
if os.path.exists("README.md"):
|
if os.path.exists("README.md"):
|
||||||
subprocess.run(["install", "-m", "644", "README.md", f"{doc_dir}/README.md"], check=True)
|
subprocess.run(["install", "-m", "644", "README.md", f"{doc_dir}/README.md"], check=True)
|
||||||
|
|
||||||
|
install_scriptlet_name = None
|
||||||
|
if install_rel_path and os.path.exists(install_rel_path):
|
||||||
|
install_scriptlet_name = f"{name}.install"
|
||||||
|
subprocess.run(
|
||||||
|
["install", "-m", "644", install_rel_path, os.path.join(build_dir, install_scriptlet_name)],
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
|
||||||
installed_size = subprocess.check_output(["du", "-sb", build_dir]).decode().split()[0]
|
installed_size = subprocess.check_output(["du", "-sb", build_dir]).decode().split()[0]
|
||||||
builddate = str(int(time.time()))
|
builddate = str(int(time.time()))
|
||||||
|
|
||||||
@@ -117,6 +126,8 @@ def build_package(target_triple=None, target_arch=None, pkgrel=None):
|
|||||||
f"arch = {arch}",
|
f"arch = {arch}",
|
||||||
f"license = {license_name}",
|
f"license = {license_name}",
|
||||||
]
|
]
|
||||||
|
if install_scriptlet_name:
|
||||||
|
pkginfo_lines.append(f"install = {install_scriptlet_name}")
|
||||||
for dep in depends:
|
for dep in depends:
|
||||||
pkginfo_lines.append(f"depend = {dep}")
|
pkginfo_lines.append(f"depend = {dep}")
|
||||||
for optdep in optdepends:
|
for optdep in optdepends:
|
||||||
@@ -128,7 +139,11 @@ def build_package(target_triple=None, target_arch=None, pkgrel=None):
|
|||||||
|
|
||||||
os.makedirs("target/arch", exist_ok=True)
|
os.makedirs("target/arch", exist_ok=True)
|
||||||
output_file = os.path.abspath(f"target/arch/{name}-{version}-{pkgrel}-{arch}.pkg.tar.zst")
|
output_file = os.path.abspath(f"target/arch/{name}-{version}-{pkgrel}-{arch}.pkg.tar.zst")
|
||||||
subprocess.run(["tar", "--zstd", "-cf", output_file, ".PKGINFO", "usr"], cwd=build_dir, check=True)
|
tar_members = [".PKGINFO"]
|
||||||
|
if install_scriptlet_name:
|
||||||
|
tar_members.append(install_scriptlet_name)
|
||||||
|
tar_members.append("usr")
|
||||||
|
subprocess.run(["tar", "--zstd", "-cf", output_file, *tar_members], cwd=build_dir, check=True)
|
||||||
print(f"Arch-Paket erfolgreich erstellt: {output_file}")
|
print(f"Arch-Paket erfolgreich erstellt: {output_file}")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user