summaryrefslogtreecommitdiff
path: root/net-misc/airouter/airouter-0.1.2-r5.ebuild
blob: 0da29316ea4741b30cdd982a82efca0da93684de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
EAPI=8

RUST_MIN_VER="1.88.0"
inherit cargo

DESCRIPTION="Metadata-only routing plane for owned and frontier AI compute"
HOMEPAGE="https://trunkmasters.com/airouter"
SRC_URI="https://www.srcux.com/distfiles/airouter-0.1.2-r5.tar.zst https://www.srcux.com/distfiles/llmbridge-0.1.2-20260919.tar.zst"
S="${WORKDIR}/airouter"

# The archive contains AIRouter, its pinned LLMBridge path dependency, and a
# complete Cargo vendor tree. The package must build without /srv/airouter or
# network access.
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"


RDEPEND="
    acct-group/airouter
    acct-group/airouter-admin
    acct-group/airouter-framework
    acct-user/airouter
    acct-user/airouter-agent
    dev-db/postgresql
    sys-auth/citadel
    >=dev-lang/python-3.10
    sys-apps/acl
    sys-apps/bubblewrap
    sys-apps/util-linux
"
BDEPEND="
    net-misc/rsync
    >=dev-lang/rust-1.88.0
"

src_unpack() {
    # Portage on the target profile does not unpack .tar.zst through the
    # generic helper; extract both immutable source inputs explicitly.
    tar --zstd -xf "${DISTDIR}/airouter-0.1.2-r5.tar.zst" -C "${WORKDIR}" || die
    tar --zstd -xf "${DISTDIR}/llmbridge-0.1.2-20260919.tar.zst" -C "${WORKDIR}" || die
    mv "${WORKDIR}/llmbridge-0.1.2-20260919" "${WORKDIR}/llmbridge" || die
}

src_compile() {
    cargo build --offline --release --workspace --locked \
        --features "airouter-catalog/skills-tools,airouter-catalog/workspace-tools,\
airouter-catalog/development-tools,airouter-catalog/release-tools,\
airouter-catalog/learning-tools,airouter-catalog/host-tools,\
airouter-catalog/control-tools" || die
}

src_install() {
    dosbin target/release/airouterd
    dosbin target/release/airouter-agentd
    dosbin target/release/airouterctl
    dosbin target/release/airouter-catalog
    dosbin target/release/airouter-host
    dosbin target/release/airouter-release
    dosbin target/release/airouter-verify
    dosbin target/release/airouter-permissions
    dosbin target/release/airouter-toolsd
    dobin target/release/airouter-smoke
    dobin target/release/airouter-tool
    exeinto /usr/libexec/airouter
    doexe target/release/enroll-node
    doexe packaging/scripts/airouter-renew-node-server
    doexe packaging/scripts/airouter-capability-refresh
    doexe packaging/scripts/airouter-framework-backup
    doexe packaging/scripts/airouter-tools-launch
    doexe target/release/airouter-desktop-worker
    # The Workbench selector invokes this stable top-level helper directly.
    # Keep it beside the AIRouter executables; catalog helpers belong below
    # /usr/libexec/airouter/catalog.
    exeinto /usr/libexec/airouter
    newexe scripts/airouter-route.py airouter-route
    exeinto /usr/libexec/airouter/catalog
    doexe target/release/airouter-skills-catalog
    doexe target/release/airouter-workspace-catalog
    doexe target/release/airouter-development-catalog
    doexe target/release/airouter-release-catalog
    doexe target/release/airouter-learning-catalog
    doexe target/release/airouter-host-catalog
    doexe target/release/airouter-control-catalog
    exeinto /usr/libexec/airouter/qualification
    doexe scripts/qualify-citadel-session.py
    insinto /etc/cron.d
    doins packaging/cron/airouter-server-cert-renew
    doins packaging/cron/airouter-capability-refresh
    doins packaging/cron/airouter-framework-backup
    insinto /etc/airouter
    doins config/airouter.toml
    newins config/framework.example.toml framework.toml
    doins config/tools.example.toml config/tools-client.example.toml
    newins config/routing.example.json routing.json
    insinto /etc/airouter-capabilities
    newins packaging/capabilities.sources.example.json sources.json
    insinto /etc/airouter/qualification
    doins packaging/qualification/native-codex-workbench.json
    diropts -o airouter -g airouter -m 0700
    keepdir /etc/airouter/secrets
    newinitd packaging/openrc/airouterd airouterd
    newinitd packaging/openrc/airouter-frameworkd airouter-frameworkd
    newinitd packaging/openrc/airouter-catalog-refresh airouter-catalog-refresh
    newinitd packaging/openrc/airouter-qualification airouter-qualification
    newinitd packaging/openrc/airouter-toolsd airouter-toolsd
    docinto tools
    dodoc config/tools.example.toml config/tools-client.example.toml crates/airouter-tools/README.md crates/airouter-tools/DESKTOPS.md
    docinto /
    dodoc README.md schema/README.md
    diropts -o airouter -g airouter -m 0750
    keepdir /var/lib/airouter
    keepdir /var/backups/airouter-framework
}

pkg_postinst() {
    elog "Create the signing key with: airouterctl generate-signing-key"
    elog "Apply migrations with the restricted airouter_migrate role before starting airouterd."
}