blob: 06749624bb680d04eb86cef188c5a9378ed77a05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/bin/sh
NAME="doas"
DESC="OpenBSD's temporary privilege escalation tool"
MAKEDEPS="bison"
PKG_VER=6.8.2
SOURCE="https://github.com/Duncaen/OpenDoas/archive/v$PKG_VER.tar.gz"
ADDITIONAL="
configuration-directory.patch
manpage-example-path.patch
"
prepare () {
apply_patches
}
build() {
./configure \
--prefix=/usr \
--without-pam \
--with-timestamp \
--with-doas-confdir
make
}
check() {
# doas -v returns 1
./doas -v || test $? = 1
}
package() {
make install DESTDIR="$PKG_DEST"
install -d "$PKG_DEST"/usr/share/doc/doas
cat > "$PKG_DEST"/usr/share/doc/doas/doas.conf.example <<-EOF
# see doas.conf(5) for configuration details
# Uncomment to allow group "wheel" to become root
# permit persist :wheel
EOF
}
postinstall () {
[ -d /etc/doas.d ] || install -d -m 0750 /etc/doas.d
[ -e /etc/doas.d/doas.conf ] && exit 0
cat > /etc/doas.d/doas.conf << EOF
# This file is actually located at /etc/doas.d/doas.conf, and reflects
# the system doas configuration. It may have been migrated from its
# previous location, /etc/doas.conf, automatically.
EOF
[ -f /etc/doas.conf ] && {
cat /etc/doas.conf >> /etc/doas.d/doas.conf
cat >> /etc/doas.d/doas.conf << EOF
# Please see /usr/share/doc/doas/doas.conf.example in the doas-doc
# package for configuration examples.
EOF
# install compatibility symlink
rm -f /etc/doas.conf
ln -sf /etc/doas.d/doas.conf /etc/doas.conf
# chmod 600
chmod 600 /etc/doas.d/doas.conf
cat >&2 << EOF
* Your configuration in /etc/doas.conf was migrated to
* /etc/doas.d/doas.conf and a symlink was installed in its
* place. For more information about the new doas configuration
* directory, consult doas.d(5).
EOF
} || true
}
|