diff --git a/docs/resources/id-alloc.json b/docs/resources/id-alloc.json index d664da5..50f55fc 100644 --- a/docs/resources/id-alloc.json +++ b/docs/resources/id-alloc.json @@ -8,6 +8,7 @@ "wheel": 0, "_sshd": 22, "_lp": 631, - "users": 79 + "users": 79, + "seat": 600 } } diff --git a/lib/make.py b/lib/make.py index a1dcdf9..8d6a9b2 100644 --- a/lib/make.py +++ b/lib/make.py @@ -70,6 +70,9 @@ def package(s: str): _pkginfo[s][_key_links] = _pkginfo[s][_key_links].copy() _pkginfo[s][_key_dependencies] = _pkginfo[s][_key_dependencies].copy() _pkginfo[s][_key_provides] = _pkginfo[s][_key_provides].copy() + _pkginfo[s][_key_configure] = _pkginfo[s][_key_configure].copy() + _pkginfo[s][_key_recommendations] = _pkginfo[s][_key_recommendations].copy() + _pkginfo[s][_key_maintainers] = _pkginfo[s][_key_maintainers].copy() def version(s: str): diff --git a/lib/managed_source.py b/lib/managed_source.py index 1e07b0f..426d77d 100644 --- a/lib/managed_source.py +++ b/lib/managed_source.py @@ -45,6 +45,8 @@ def get_origin_url(s): return f"https://{url.hostname}{url.path}/archive/{url.fragment}.tar.gz" elif url.scheme == "gitlab": return f"https://{url.hostname}/{url.path}/-/archive/{url.fragment}/{url.path.split('/')[1]}-{url.fragment}.tar.gz" + elif url.scheme == "srht": + return f"https://{url.hostname}/{url.path}/archive/{url.fragment}.tar.gz" elif url.scheme == "pypi": pkgname = url.hostname return f"https://files.pythonhosted.org/packages/source/{pkgname[0]}/{pkgname}/{pkgname}-{url.fragment}.tar.gz" @@ -139,6 +141,10 @@ def get_repo_filename(s): gitlab_name = url.path.replace('/', '-') gitlab_host = url.hostname.split('.')[-2] return f"{gitlab_host}{gitlab_name}-{url.fragment}.tar.zst" + elif url.scheme == "srht": + srht_name = url.path.replace('~', '').replace('/', '-') + srht_host = url.hostname.split('.')[-2] + return f"{srht_host}{srht_name}-{url.fragment}.tar.zst" elif url.scheme == "pypi": return f"pypi-{url.hostname}-{url.fragment}.tar.zst" else: diff --git a/packages/seatd/configure/create-group b/packages/seatd/configure/create-group new file mode 100644 index 0000000..e521f51 --- /dev/null +++ b/packages/seatd/configure/create-group @@ -0,0 +1,15 @@ +#!/bin/sh + +[ "${ACTION}" = "remove" ] && exit 0 + +mkdir -p /var/lib/cups + +create_group() { + account create-group \ + --fullname "Seat Users" \ + --description "A group for users that are enable to login via a seat." \ + --host-gid 600 \ + seat +} + +account info seat > /dev/null 2>&1 || create_group diff --git a/packages/seatd/files/seatd.airs b/packages/seatd/files/seatd.airs new file mode 100644 index 0000000..498fbfe --- /dev/null +++ b/packages/seatd/files/seatd.airs @@ -0,0 +1,7 @@ +[service] +display-name = "Seat Daemon" +description = "Service that allocates physical seats for normal users." + +[exec] +pre-start = "mkdir -p /run/system" +start = "seatd -g seat" diff --git a/packages/seatd/pkgbuild.py b/packages/seatd/pkgbuild.py index 4924185..4de1b0e 100644 --- a/packages/seatd/pkgbuild.py +++ b/packages/seatd/pkgbuild.py @@ -1,17 +1,18 @@ import os from lib.make import * -from lib import cpp +from lib import cpp, arch -version("0.9.3") +version("0.9.3+1") description("A minimal seat management daemon, and a universal seat management library.") maintainer("sisungo ") -source_url("https://git.sr.ht/~kennylevinsen/seatd/archive/0.9.3.tar.gz") +source_managed("srht://git.sr.ht/~kennylevinsen/seatd#0.9.3") builddep("shortcut/c") builddep("shortcut/meson") -builddep("linux-dev @target") +if "linux" in arch.get_target(): + builddep("linux-dev @target") def build(): @@ -20,7 +21,7 @@ def build(): f"--libdir={get_prefix('libseat')}/lib", f"--includedir={get_prefix('libseat-dev')}/include", f"--bindir={get_prefix('seatd')}/bin", - "-Ddefaultpath=/run/seatd.sock", + "-Ddefaultpath=/run/system/seatd.sock", ]) cpp.meson_compile() cpp.meson_install() @@ -28,15 +29,28 @@ def build(): on_build(build) +airs = os.getcwd() + "/files/seatd.airs" + +def pack_daemon(composer): + composer.add("bin") + composer.makedirs("share/services") + composer.add(airs, "share/services/seatd.airs") + package("libseat") dep("semi-libc @same-arch") cpp.use_auto_pack(["lib"]) +package("libseat-dev") +dep("semi-libc-dev @same-arch") +dep("libseat (same)") +if "linux" in arch.get_target(): + dep("linux-dev @same-arch") +cpp.use_auto_pack(["dev"]) + package("seatd") dep("semi-libc @same-arch") -cpp.use_auto_pack(["bin"]) - -package("libseat-dev") -dep("semi-libc @same-arch") dep("libseat (same)") -cpp.use_auto_pack(["dev"]) +# Our `.airs` file uses coreutils commands +dep("coreutils @same-arch") +configure_script("configure/create-group") +on_pack(pack_daemon)