openssh/PKGBUILD
2024-04-29 19:31:28 +08:00

84 lines
3.0 KiB
Bash

# Maintainer: Future Linux Team <futurelinux@163.com>
pkgname=openssh
pkgver=9.6p1
pkgrel=1
pkgdesc="SSH protocol implementation for remote login, command execution and file transfer"
arch=('x86_64')
url="https://www.openssh.com/portable.html"
license=('BSD-2-Clause' 'BSD-3-Clause' 'ISC' 'LicenseRef-Public-Domain' 'MIT')
groups=('base-devel')
depends=('glibc')
makedepends=('libxcrypt' 'openssl' 'linux-pam' 'zlib')
backup=(etc/pam.d/sshd
etc/ssh/ssh_config
etc/ssh/sshd_config)
install=${pkgname}.install
source=(https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/${pkgname}-${pkgver}.tar.gz
sshd.service
sshd@.service
sshd.socket
sshd.pam)
sha256sums=(910211c07255a8c5ad654391b40ee59800710dd8119dd5362de09385aa7a777c
d5315c06d024b450bdff521c5680257609006d3b9bec9bfb9fee8c07ce2821ab
c764855f85eb06e453e56099b2fdb010ee5833d5086588478e1208b7cf72be92
efc5cf5e700036acdae0602bc551f71adf9a29af8b85505db7195382fc475f03
15e711122662d6c7cc7f671b688f1e1709c543d2e61e61e2832c52d6d55f0530)
prepare() {
cd ${pkgname}-${pkgver}
# remove variable (but useless) first line in config (related to upstream VCS)
sed '/^#.*\$.*\$$/d' -i ssh{,d}_config
# prepend configuration option to include drop-in configuration files for sshd_config
printf "# Include drop-in configurations\nInclude /etc/ssh/sshd_config.d/*.conf\n" | cat - sshd_config > sshd_config.tmp
mv -v sshd_config.tmp sshd_config
# prepend configuration option to include drop-in configuration files for ssh_config
printf "# Include drop-in configurations\nInclude /etc/ssh/ssh_config.d/*.conf\n" | cat - ssh_config > ssh_config.tmp
mv -v ssh_config.tmp ssh_config
}
build() {
cd ${pkgname}-${pkgver}
${CONFIGURE} \
--sysconfdir=/etc/ssh \
--with-privsep-path=/var/lib/sshd \
--with-default-path=/usr/bin \
--with-superuser-path=/usr/sbin:/usr/bin \
--with-pid-dir=/run \
--with-pam \
--with-ssl-engine \
--with-privsep-user=nobody
make
}
package() {
cd ${pkgname}-${pkgver}
make DESTDIR=${pkgdir} install
install -v -m755 contrib/ssh-copy-id ${pkgdir}/usr/bin
install -v -m644 contrib/ssh-copy-id.1 ${pkgdir}/usr/share/man/man1
install -vdm755 -d ${pkgdir}/usr/share/doc/${pkgname}-${pkgver}
install -v -m644 INSTALL LICENCE OVERVIEW README* ${pkgdir}/usr/share/doc/${pkgname}-${pkgver}
install -v -g sys -m700 -d ${pkgdir}/var/lib/sshd
install -Dm 644 ${srcdir}/sshd.pam ${pkgdir}/etc/pam.d/sshd
install -Dm 644 ${srcdir}/sshd.service ${pkgdir}/usr/lib/systemd/system/sshd.service
install -Dm 644 ${srcdir}/sshd@.service ${pkgdir}/usr/lib/systemd/system/sshd@.service
install -Dm 644 ${srcdir}/sshd.socket ${pkgdir}/usr/lib/systemd/system/sshd.socket
# PAM feature
sed -i -e '/^#ChallengeResponseAuthentication yes$/c ChallengeResponseAuthentication no' \
-e '/^#PrintMotd yes$/c PrintMotd no # pam does that' \
-e '/^#UsePAM no$/c UsePAM yes' \
${pkgdir}/etc/ssh/sshd_config
}