1 # Build recipe for perp.
3 # Copyright (c) 2016-2019 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
24 # Define a category for the output of the package name
27 tarname=${program}-${version}.tar.gz
31 http://rsync.dragora.org/current/sources/$tarname
32 http://b0llix.net/perp/distfiles/$tarname
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,
53 perp helps make sure that they do.
56 homepage=http://b0llix.net/perp
59 # Source documentation
60 docs="CHANGES LICENSE README THANKS"
61 docsdir="${docdir}/${program}-${version}"
65 unpack "${tardir}/$tarname"
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: http://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" QICFLAGS="$QICFLAGS"
82 make -j${jobs} DESTDIR="$destdir" install
84 # Automatic installation setup
85 DESTDIR="$destdir" ./perp/perp-setup /etc/perp
87 # Create "the blessed" /var/run/perp directory
88 mkdir -p "${destdir}/var/run/perp"
89 chmod 700 "${destdir}/var/run/perp"
91 # Include our config file for tinylog(8)
92 cp -p "${worktree}/archive/perp/etc/tinylog.conf" \
94 chmod 644 "${destdir}/etc/tinylog.conf"
96 # Include our custom essential perp init scripts
97 cp -p "${worktree}/archive/perp/etc/rc.log-boot" \
98 "${destdir}/etc/perp/.boot/rc.log"
100 cp -p "${worktree}/archive/perp/etc/rc.perp-boot" \
101 "${destdir}/etc/perp/.boot/rc.perp"
103 chmod 755 "${destdir}/etc/perp/.boot/rc.log" \
104 "${destdir}/etc/perp/.boot/rc.perp"
106 # Include profile file
107 mkdir -p "${destdir}/etc/profile.d"
108 cp -p "${worktree}/archive/perp/etc/profile.d/perp.sh" \
109 "${destdir}/etc/profile.d/"
110 chmod 644 "${destdir}/etc/profile.d/perp.sh"
112 # To handle config file(s)
113 touch "${destdir}/etc/.graft-config" \
114 "${destdir}/etc/perp/.boot/.graft-config" \
115 "${destdir}/etc/profile.d/.graft-config"
117 # We don't include perp-setup*
118 rm -f "${destdir}/usr/sbin/perp-setup" \
119 "${destdir}/${mandir}/man8/perp-setup.8"
121 # Compress and link man pages (if needed)
122 if test -d "${destdir}/$mandir"
125 cd "${destdir}/$mandir"
126 find . -type f -exec lzip -9 {} +
127 find . -type l | while read -r file
129 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
136 mkdir -p "${destdir}${docsdir}"
137 cp -p $docs "${destdir}${docsdir}"/