recipes: networking/openssh: Improve perp service instructions
[dragora.git] / recipes / networking / openssh / recipe
blob9dffa78b38b030f99e9cd650ac56a15fc8ed7453
1 # Build recipe for openssh.
3 # Copyright (c) 2018-2019, 2021-2022, 2024 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=openssh
21 version=9.1p1
22 release=2
24 # Define a category for the output of the package name
25 pkgcategory=networking
27 tarname=${program}-${version}.tar.gz
29 # Remote source(s)
30 fetch=https://ftp3.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/$tarname
32 description="
33 The OpenSSH suite.
35 OpenSSH is the premier connectivity tool for remote login with the
36 SSH protocol.  It encrypts all traffic to eliminate eavesdropping,
37 connection hijacking, and other attacks.  In addition, OpenSSH provides
38 a large suite of secure tunneling capabilities, several authentication
39 methods, and sophisticated configuration options.
42 homepage=https://www.openssh.com
43 license=Custom
45 # Source documentation
46 docs="CREDITS ChangeLog LICENCE OVERVIEW PROTOCOL* README* TODO"
47 docsdir="${docdir}/${program}-${version}"
49 build()
51     unpack "${tardir}/$tarname"
53     cd "$srcdir"
55     # Set sane permissions
56     chmod -R u+w,go-w,a+rX-s .
58     ./configure CPPFLAGS="$QICPPFLAGS" \
59     CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" LIBS="-ledit" \
60      $configure_args \
61      --libdir=/usr/lib${libSuffix} \
62      --sysconfdir=/etc/ssh \
63      --mandir=$mandir \
64      --docdir=$docsdir \
65      --enable-strip \
66      --with-default-path='/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin' \
67      --with-privsep-path=/var/lib/sshd \
68      --with-privsep-user=sshd \
69      --with-pid-dir=/var/run/sshd \
70      --with-md5-passwords \
71      --with-pie \
72      --without-zlib-version-check \
73      --build="$(gcc -dumpmachine)"
75     make -j${jobs} V=1
76     make -j${jobs} DESTDIR="$destdir" install
78     # Make empty directories for the package
79     mkdir -p "${destdir}/var/run/sshd" "${destdir}/var/lib/sshd"
81     # Copy additional utilities
83     cp -p contrib/ssh-copy-id "${destdir}/usr/bin"
84     chmod 755 "${destdir}/usr/bin/ssh-copy-id"
86     mkdir -p "${destdir}/${mandir}/man1"
87     cp -p contrib/ssh-copy-id.1 "${destdir}/${mandir}/man1"
89     # Install sshd perp service(s)
91     mkdir -p "${destdir}/etc/perp/sshd"
93     cp -p "${worktree}/archive/openssh/rc.log" \
94           "${worktree}/archive/openssh/rc.main" \
95           "${destdir}/etc/perp/sshd/"
97     chmod 755 "${destdir}"/etc/perp/sshd/rc.*
99     # THIS SERVICE IS DISABLED BY DEFAULT
100     chmod -t "${destdir}/etc/perp/sshd"
102     # Manage (dot) new files via graft(1)
103     touch "${destdir}/etc/ssh/.graft-config" \
104           "${destdir}/etc/perp/sshd/.graft-config"
106     # Compress and link man pages (if needed)
107     if test -d "${destdir}/$mandir"
108     then
109         (
110             cd "${destdir}/$mandir"
111             find . -type f -exec lzip -9 {} +
112             find . -type l | while read -r file
113             do
114                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
115                 rm -- "$file"
116             done
117         )
118     fi
120     # Copy documentation
121     mkdir -p "${destdir}/$docsdir"
122     cp -p $docs "${destdir}/$docsdir"