vinix-ports / openssh-client / PKGBUILD.vile
50 lines · 50 sloc · 3.23 KB · 2bb2762a6c53324b820358700224364ddc7f867b
Raw
1defpkgbuild(openssh-client,
2 #:pkgname, "openssh-client",
3 #:pkgver, "9.9p2",
4 #:pkgrel, 1,
5 #:pkgdesc, "OpenSSH client, file transfer, key generation and authentication agent",
6 #:arch, [#:x86-64, #:aarch64],
7 #:license, "SSH-OpenSSH",
8 #:url, "https://www.openssh.com/portable.html",
9 #:depends, ["musl", "libedit", "openssl", "zlib"],
10 #:makedepends, ["linux-headers"],
11 #:backup, ["etc/ssh/ssh_config"],
12 #:source, ["https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.9p2.tar.gz",
13 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/openssh/include-config-dir.patch"],
14 #:sha256sums, ["91aadb603e08cc285eddf965e1199d02585fa94d994d6cae5b41e1721e215673",
15 "d64820f473f3421922c0b4d88b067b2816cd22323af3157af503688e1003f8c1"],
16 #:prepare, fn() {
17 run("patch", "-d", "openssh-9.9p2", "-p1", "-i", string-append(srcdir(), "/include-config-dir.patch"))
18 },
19 #:build, fn() {
20 run("vinix-configure", "openssh-9.9p2/configure", "--sysconfdir=/etc/ssh", "--libexecdir=/usr/lib/ssh",
21 "--with-libedit", "--with-xauth=/usr/bin/xauth", "--with-pid-dir=/run",
22 "--disable-utmp", "--disable-wtmp", "--disable-lastlog")
23 run("make", "ssh", "scp", "sftp", "ssh-keygen", "ssh-agent", "ssh-add", "ssh-keyscan", "ssh-pkcs11-helper")
24 },
25 #:check, fn() {
26 target := get-environment-variable("VPAC_TARGET_ARCH")
27 arm := if string?(target) { string=?("aarch64", target) } else { #f }
28 ; The emulated musl process resolves its UID through /etc/passwd, which
29 ; lacks the build worker's systemd-managed account. Give the check an
30 ; existing account without changing the package or the worker's users.
31 runner := if arm { list("fakeroot", "--", "vinix-run") } else { list("vinix-run") }
32 apply(run, append(runner, list("./ssh", "-V")))
33 apply(run, append(runner, list("./ssh", "-Q", "cipher")))
34 apply(run, append(runner, list("./ssh-keygen", "-q", "-t", "ed25519", "-N", "", "-f", "test-key")))
35 apply(run, append(runner, list("./ssh-keygen", "-lf", "test-key.pub")))
36 apply(run, append(runner, list("./ssh-keygen", "-Y", "sign", "-f", "test-key", "-n", "vinix", "openssh-9.9p2/LICENCE")))
37 run("test", "-s", "openssh-9.9p2/LICENCE.sig")
38 },
39 #:package, fn() {
40 for-each(fn(tool) {
41 run("install", "-Dm755", tool, string-append(pkgdir(), "/usr/bin/", tool))
42 }, list("ssh", "scp", "sftp", "ssh-keygen", "ssh-agent", "ssh-add", "ssh-keyscan", "ssh-pkcs11-helper"))
43 run("mkdir", "-p", string-append(pkgdir(), "/usr/lib/ssh"), string-append(pkgdir(), "/etc/ssh/ssh_config.d"))
44 run("ln", "-s", "../../bin/ssh-pkcs11-helper", string-append(pkgdir(), "/usr/lib/ssh/ssh-pkcs11-helper"))
45 run("install", "-Dm755", "openssh-9.9p2/contrib/ssh-copy-id", string-append(pkgdir(), "/usr/bin/ssh-copy-id"))
46 run("install", "-Dm755", "openssh-9.9p2/contrib/findssl.sh", string-append(pkgdir(), "/usr/bin/findssl.sh"))
47 run("install", "-Dm644", "openssh-9.9p2/ssh_config", string-append(pkgdir(), "/etc/ssh/ssh_config"))
48 run("install", "-Dm644", "openssh-9.9p2/moduli", string-append(pkgdir(), "/etc/ssh/moduli"))
49 run("install", "-Dm644", "openssh-9.9p2/LICENCE", string-append(pkgdir(), "/usr/share/licenses/openssh-client/LICENCE"))
50 })
51