Files
fempkg_recipes/ssh.recipe.py
2026-01-28 17:53:44 +01:00

53 lines
2.0 KiB
Python

pkgname = "ssh"
pkgver = "10.2" # TODO wen update remove p1 shit idk why i ddi
source = f"https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-{pkgver}p1.tar.gz"
builddir = f"/tmp/fempkg/build/{pkgname}/open{pkgname}-{pkgver}p1"
fembuilddir = f"/tmp/fempkg/build/{pkgname}"
outputdir = "/home/gabry/lfs-repo/binpkg"
manifestdir = "/home/gabry/lfs-repo/manifests"
destdir = f"{fembuilddir}/DESTDIR"
deps = []
build = [
# Extract
f"mkdir -p /tmp/fempkg/build {fembuilddir} && cd {fembuilddir} && tar -xvf /var/lib/fempkg/pkgs/open{pkgname}-{pkgver}p1.tar.gz",
# 64-bit build
f"cd {builddir} && ./configure --prefix=/usr --sysconfdir=/etc/ssh "
f"--with-privsep-path=/var/lib/sshd --with-default-path=/usr/bin "
f"--with-superuser-path=/usr/sbin:/usr/bin --with-pid-dir=/run",
f"cd {builddir} && make -j$(nproc)",
f"""cd {builddir} && make DESTDIR={destdir} install && \\
# Install ssh-copy-id into DESTDIR
install -v -m755 contrib/ssh-copy-id {destdir}/usr/bin && \\
# Install manpage into DESTDIR
install -v -m644 contrib/ssh-copy-id.1 {destdir}/usr/share/man/man1/ && \\
# Install docs into DESTDIR
install -v -d {destdir}/usr/share/doc/openssh-{pkgver}p1 && \\
install -v -m644 INSTALL OVERVIEW README* {destdir}/usr/share/doc/openssh-{pkgver}p1
""",
f"install -v -d -m755 {destdir}/usr/share/licenses/{pkgname}/",
f"install -v -m644 {builddir}/LICENCE {destdir}/usr/share/licenses/{pkgname}/LICENSE",
# Make tarball + manifests
f"mkdir -p {outputdir} && cd {destdir} && tar --transform 's|^\\.||' -I zstd -cf {outputdir}/{pkgname}-{pkgver}.tar.zst .",
f"mkdir -p {manifestdir} && tar -tf {outputdir}/{pkgname}-{pkgver}.tar.zst | grep -v '/$' > {manifestdir}/{pkgname}.txt",
# Cleanup
f"rm -rf {builddir} {fembuilddir}"
]
triggers = [
f"""install -v -g sys -m700 -d /var/lib/sshd || true &&
groupadd -g 50 sshd || true &&
useradd -c 'sshd PrivSep' \
-d /var/lib/sshd \
-g sshd \
-s /bin/false \
-u 50 sshd || true""",
]