recipes: tools/udevil: Add perp service to start devmon
[dragora.git] / recipes / tools / udevil / recipe
blobf4308b9eae3374945556cbcb87e32e0d4debd96f
1 # Build recipe for udevil.
3 # Copyright (c) 2019-2020 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 program=udevil
18 version=20150504_ce9f1c5
19 release=2
21 # Set 'outdir' for a nice and well-organized output directory
22 outdir="${outdir}/${arch}/tools"
24 tarname=${program}-${version}.tar.lz
26 # Remote source(s)
27 fetch="
28  http://rsync.dragora.org/current/sources/$tarname
29  http://mirror.cedia.org.ec/dragora/current/sources/$tarname
32 description="
33 Mounts and unmounts devices without password.
35 udevil is a command line GNU/Linux program which mounts and unmounts
36 removable devices without a password, shows device info, and monitors
37 device changes.  It can also mount ISO files, nfs://, smb://,
38 ftp://, ssh:// and WebDAV URLs, and tmpfs/ramfs filesystems.
41 homepage=http://ignorantguru.github.com/udevil/
42 license=GPLv3+
44 # Source documentation
45 docs="AUTHORS COPYING ChangeLog NEWS README"
46 docsdir="${docdir}/${program}-${version}"
48 build()
50     set -e
52     unpack "${tardir}/$tarname"
54     cd "$srcdir"
56     # Update for hosts based on musl
57     cp -f "${worktree}/archive/common/config.guess" config.guess
58     cp -f "${worktree}/archive/common/config.sub" config.sub
60     # Set sane permissions
61     chmod -R u+w,go-w,a+rX-s .
63     ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
64      $configure_args \
65      --libdir=/usr/lib${libSuffix} \
66      --mandir=$mandir \
67      --docdir=$docsdir \
68      --disable-systemd \
69      --build="$(cc -dumpmachine)"
71     make -j${jobs} V=1
72     make -j${jobs} libdir=/usr/lib${libSuffix} \
73      DESTDIR="$destdir" install-strip
75     # To handle (dot) .new files via graft(1)
76     touch "${destdir}/etc/udevil/.graft-config"
78     # Restrict execution of udevil to the 'plugdev' group
79     chown root:plugdev "${destdir}/usr/bin/udevil"
80     chmod u+s,go-s,o-x "${destdir}/usr/bin/udevil"
82     # Install devmon (udevil) perp service
84     mkdir -p "${destdir}/etc/perp/devmon"
86     cp -p "${worktree}/archive/udevil/rc.log" \
87           "${worktree}/archive/udevil/rc.main" \
88           "${destdir}/etc/perp/devmon/"
90     chmod 755 "${destdir}"/etc/perp/devmon/rc.*
92     # Be an active service by default
93     chmod +t "${destdir}/etc/perp/devmon"
95     # To handle config file(s)
96     touch "${destdir}/etc/perp/devmon/.graft-config"
98     # Compress and link man pages (if needed)
99     if test -d "${destdir}/$mandir"
100     then
101         (
102             cd "${destdir}/$mandir"
103             find . -type f -exec lzip -9 '{}' +
104             find . -type l | while read -r file
105             do
106                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
107                 rm -- "$file"
108             done
109         )
110     fi
112     # Copy documentation
113     mkdir -p "${destdir}${docsdir}"
114     cp -p $docs "${destdir}${docsdir}"