summaryrefslogtreecommitdiff
path: root/opt/fcgiwrap/MAKEPKG
blob: b3321f9179a97cc210cb5a960d36490210d84b4f (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/mkpkg
# description: Simple FastCGI wrapper for CGI scripts
# url: https://github.com/gnosek/fcgiwrap

name=fcgiwrap
version=1.1.0
release=2
depends=(fcgi2)
makedeps=(autoconf automake libtool m4)
groups=(fcgiwrap:user:fcgiwrap:/var/lib/fcgiwrap:750)
services=(fcgiwrap)
permissions=(
    /var/lib/fcgiwrap:fcgiwrap:fcgiwrap:750
)
source=(https://github.com/gnosek/fcgiwrap/archive/refs/tags/$version.tar.gz)
sha256sums=(
    "4c7de0db2634c38297d5fcef61ab4a3e21856dd7247d49c33d9b19542bd1c61f"
)

build() {
    cd $name-$version

    autoreconf -i

    ./configure \
        --prefix=/usr \
        --mandir=/share/man

    make
    make DESTDIR=$PKG install

    # rawnix uses unified /usr/bin
    # install -d $PKG/usr/bin
    # mv $PKG/usr/sbin/fcgiwrap $PKG/usr/bin/
    # rmdir $PKG/usr/sbin
}

post_build() {
    install -d $PKG/etc/sv/fcgiwrap/log

    # Listen on a unix socket; nginx (running as http) needs to reach it.
    # We start fcgiwrap as fcgiwrap user, then chmod the socket so http can connect.
    printf '%s\n' \
        '#!/bin/sh' \
        'exec 2>&1' \
        '' \
        'grp=fcgiwrap' \
        'getent group http >/dev/null && grp=http' \
        '' \
        'install -d -m 750 -o fcgiwrap -g "$grp" /run/fcgiwrap' \
        'rm -f /run/fcgiwrap/sock' \
        '' \
        'umask 0111' \
        'exec chpst -u fcgiwrap:fcgiwrap fcgiwrap -c 4 -s unix:/run/fcgiwrap/sock' \
        > $PKG/etc/sv/fcgiwrap/run

    printf '%s\n' \
        '#!/bin/sh' \
        'mkdir -p /var/log/fcgiwrap' \
        'exec svlogd -tt /var/log/fcgiwrap' \
        > $PKG/etc/sv/fcgiwrap/log/run

    printf '%s\n' \
        '#!/bin/sh' \
        'rm -f /run/fcgiwrap/sock' \
        > $PKG/etc/sv/fcgiwrap/finish

    chmod 755 $PKG/etc/sv/fcgiwrap/run
    chmod 755 $PKG/etc/sv/fcgiwrap/log/run
    chmod 755 $PKG/etc/sv/fcgiwrap/finish
}

signify() {
    untrusted comment: public key
    RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}

# vim: filetype=sh