vinix-ports / ports / vinix-accounts / PKGBUILD.vile
35 lines · 35 sloc · 1.86 KB · c33d8afc2906b8dd9a8b905224eccd49a44f7ad5
Raw
1defpkgbuild(vinix-accounts,
2 #:pkgname, "vinix-accounts",
3 #:pkgver, "0.1.0",
4 #:pkgrel, 2,
5 #:pkgdesc, "Initial account databases from the Vinix account service",
6 #:arch, [#:any],
7 #:url, "https://github.com/vlang/vinix",
8 #:license, "GPL-2.0-or-later",
9 #:backup, ["etc/passwd", "etc/group", "etc/shadow"],
10 #:source, ["https://raw.githubusercontent.com/vlang/vinix/a58255423edea821aef9b2a0d10cb4091d59355a/tools/accounts/defaults/passwd",
11 "https://raw.githubusercontent.com/vlang/vinix/a58255423edea821aef9b2a0d10cb4091d59355a/tools/accounts/defaults/group",
12 "https://raw.githubusercontent.com/vlang/vinix/a58255423edea821aef9b2a0d10cb4091d59355a/tools/accounts/defaults/shadow"],
13 #:sha256sums, ["79492b90d473e2387338ef1518dfbceb9e3392ae5740235a6696621e42218efa",
14 "7a696fcfba89a55a6d73fa1a03c7f071fad2141340027b17a25db249e26b9be8",
15 "5dffe858d3df0b14106a1bae99da509d4820468fcbb134044627fced7c2534e7"],
16 #:prepare, fn() {
17 ; vpac uses this locked account for sandboxed downloads from first boot.
18 run("sed", "-i", "$a nobody:x:65534:65534:Unprivileged user:/nonexistent:/bin/false", "passwd")
19 run("sed", "-i", "$a nobody:x:65534:", "group")
20 run("sed", "-i", "$a nobody:*:0:0:99999:7:::", "shadow")
21 },
22 #:check, fn() {
23 run("grep", "-Fx", "root:x:0:0:root:/root:/bin/sh", "passwd")
24 run("grep", "-Fx", "root:x:0:", "group")
25 run("grep", "-Eq", "^root:[!*]", "shadow")
26 run("grep", "-Fx", "nobody:x:65534:65534:Unprivileged user:/nonexistent:/bin/false", "passwd")
27 run("grep", "-Fx", "nobody:x:65534:", "group")
28 run("grep", "-Eq", "^nobody:[!*]", "shadow")
29 },
30 #:package, fn() {
31 for-each(fn(file) {
32 run("install", "-Dm644", file, string-append(pkgdir(), "/etc/", file))
33 }, list("passwd", "group"))
34 run("install", "-Dm600", "shadow", string-append(pkgdir(), "/etc/shadow"))
35 })
36