1 Commits
Author SHA256 Message Date
sisungo f2c2fa93c9 feat: add support for configure scripts
Signed-off-by: sisungo <[email protected]>
2026-09-11 07:24:46 +00:00
7 changed files with 28 additions and 56 deletions
+8
View File
@@ -16,6 +16,7 @@ _key_links = "links"
_key_dependencies = "dependencies"
_key_recommendations = "recommendations"
_key_provides = "provides"
_key_configure = "configure"
_current_pkgname: str = _key_global
_pkginfo: dict[str, dict[str, typing.Any]] = {
@@ -25,6 +26,7 @@ _pkginfo: dict[str, dict[str, typing.Any]] = {
_key_maintainers: [],
_key_provides: [],
_key_recommendations: [],
_key_configure: [],
},
}
_supported_arch: typing.Callable[[str], bool] = lambda x: True
@@ -87,6 +89,12 @@ def provide(s: str):
]
def configure_script(s: str):
_pkginfo[_current_pkgname][_key_configure] += [
os.path.realpath(s)
]
def _translate_dep_spec(s: str) -> str:
return (
s.replace("(same)", "(same-version) @same-arch")
+9
View File
@@ -25,6 +25,15 @@ class PkgComposer:
json.dump(link, f)
f.write("\n")
def add_configure(self, path: str, name: str = None):
if name is None:
name = os.path.basename(path)
configuredir = self.workdir + "/configure/"
dstpath = configuredir + name
os.makedirs(configuredir, exist_ok=True)
shutil.copy2(path, dstpath)
os.chmod(dstpath, 0o755)
def compose(self):
subprocess.run(
[
-21
View File
@@ -1,21 +0,0 @@
[
{
"on_failure": "terminate",
"request": {
"method": "CreateUser",
"params": {
"username": "root",
"fullname": "System Administrator",
"host_uid": { "manual": 0 },
"description": "UNIX system administrator",
"secure_tags": ["Login", "CreateUser", "RemoveUser", "ReadSecret", "WriteSecret"],
"extra_records": {},
"defaults": {
"CliLoginShell": "/bin/sh"
},
"home_directory": "/home/root",
"groups": []
}
}
}
]
-35
View File
@@ -1,35 +0,0 @@
import os
import shutil
from lib import rust
from lib.make import *
version("0.1.0-alpha.1")
description("SemiOS system account service & utilities")
maintainer("sisungo <[email protected]>")
source_url("https://gitea.semilabs.org/semios/account/archive/0.1.0-alpha.1.tar.gz")
builddep("shortcut/rust")
def build():
os.makedirs("build_config", exist_ok=True)
shutil.copy2("../../init.json", "build_config/init.json")
rust.build(["--features", "embed_init_file"])
on_build(build)
def pack(composer):
os.chdir(rust.artifacts_dir())
composer.makedir("bin")
composer.makedir("libexec")
composer.addfile("account", "bin/account")
composer.addfile("accountd", "bin/accountd")
composer.addfile("auth_password", "libexec/auth_password")
package("account")
on_pack(pack)
dep("semi-libc @same-arch")
@@ -0,0 +1,6 @@
#!/bin/sh
[ "${ACTION}" = "remove" ] && exit 0
command -v certutil >/dev/null 2>&1 || exit 0
certutil refresh
+2
View File
@@ -27,4 +27,6 @@ def pack(composer):
package("ca-certificates")
arch_any()
configure_script("configure/refresh")
recommend("certutil")
on_pack(pack)
+3
View File
@@ -123,6 +123,9 @@ def cmd_build_package(package: str):
}
composer.write_manifest(manifest)
composer.write_links(pkginfo[lib.make._key_links])
for i in pkginfo[lib.make._key_configure]:
composer.add_configure(i)
composer.compose()
# Build success