recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / boot / perp / recipe
blobbcc0fa07c9c31d5d9e43a9ab58cc07522c198a20
1 # Build recipe for perp.
3 # Copyright (c) 2016-2019, 2021 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=perp
21 version=2.07
22 release=8
24 # Define a category for the output of the package name
25 pkgcategory=boot
27 tarname=${program}-${version}.tar.gz
29 # Remote source(s)
30 fetch="
31  https://dragora.mirror.garr.it/current/sources/$tarname
32  https://b0llix.net/perp/distfiles/$tarname
35 description="
36 A persistent process supervisor and service managment framework.
38 The perp package provides a set of daemons and utilities to reliably
39 start, monitor, log, and control a collection of persistent processes.
41 A \"persistent process\" is any program intended to be long-running,
42 highly available, and purpose critical.  Also known and often described
43 as a service, a persistent process normally provides some essential,
44 on-demand system service.  Programs that serve email, domain name
45 queries, and http requests are all examples of services that are
46 normally run as persistent processes.
48 These are the programs that you want to start at system boot, and to
49 continue running for as long as the system itself.  These are the
50 programs you need running in uninterrupted service, day and night,
51 forever and ever.
53 perp helps make sure that they do.
56 homepage=https://b0llix.net/perp
57 license=Custom
59 # Source documentation
60 docs="CHANGES LICENSE README THANKS"
61 docsdir="${docdir}/${program}-${version}"
63 build()
65     unpack "${tardir}/$tarname"
67     cd "$srcdir"
69     # Set sane permissions
70     chmod -R u+w,go-w,a+rX-s .
72     # Apply patches in order to refresh perp-2.07
73     # See: https://github.com/michaelforney/perp/commits/master
74     patch -Np1 -i "${worktree}/patches/perp/perp-patches"
76     # Apply patches from Dragora
77     patch -Np1 -i "${worktree}/patches/perp/runchoom-use-oom_score_adj"
78     patch -Np0 -i "${worktree}/patches/perp/flags-conf.mk.diff"
80     make -j${jobs} CC="cc -static" \
81      CPPFLAGS="$QICPPFLAGS" QICFLAGS="$QICFLAGS"
82     make -j${jobs} V=1 strip
83     make -j${jobs} DESTDIR="$destdir" install
85     # Automatic installation setup
86     DESTDIR="$destdir" ./perp/perp-setup /etc/perp
88     # Create "the blessed" /var/run/perp directory
89     mkdir -p "${destdir}/var/run/perp"
90     chmod 700 "${destdir}/var/run/perp"
92     # Include our config file for tinylog(8)
93     cp -p "${worktree}/archive/perp/etc/tinylog.conf" \
94           "${destdir}/etc/"
95     chmod 644 "${destdir}/etc/tinylog.conf"
97     # Include our custom essential perp init scripts
98     cp -p "${worktree}/archive/perp/etc/rc.log-boot" \
99           "${destdir}/etc/perp/.boot/rc.log"
101     cp -p "${worktree}/archive/perp/etc/rc.perp-boot" \
102           "${destdir}/etc/perp/.boot/rc.perp"
104     chmod 755 "${destdir}/etc/perp/.boot/rc.log" \
105               "${destdir}/etc/perp/.boot/rc.perp"
107     # Include profile file
108     mkdir -p "${destdir}/etc/profile.d"
109     cp -p "${worktree}/archive/perp/etc/profile.d/perp.sh" \
110            "${destdir}/etc/profile.d/"
111     chmod 644 "${destdir}/etc/profile.d/perp.sh"
113     # To handle config file(s)
114     touch "${destdir}/etc/.graft-config" \
115           "${destdir}/etc/perp/.boot/.graft-config" \
116           "${destdir}/etc/profile.d/.graft-config"
118     # We don't include perp-setup*
119     rm -f "${destdir}/usr/sbin/perp-setup" \
120           "${destdir}/${mandir}/man8/perp-setup.8"
122     # Compress and link man pages (if needed)
123     if test -d "${destdir}/$mandir"
124     then
125         (
126             cd "${destdir}/$mandir"
127             find . -type f -exec lzip -9 {} +
128             find . -type l | while read -r file
129             do
130                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
131                 rm -- "$file"
132             done
133         )
134     fi
136     # Copy documentation
137     mkdir -p "${destdir}/$docsdir"
138     cp -p $docs "${destdir}/$docsdir"