summaryrefslogtreecommitdiff
path: root/core/rsync/MAKEPKG
blob: 51e94e30d5d4d5ae63b7eb52eb19f5b0f9558dae (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/mkpkg
# description: Fast incremental file transfer
# url: https://rsync.samba.org

name=rsync
version=3.5.1
release=2
depends=(zlib libressl xxhash zstd lz4)
groups=(rsyncd:user:rsyncd:/nonexistent:700:873:873)
services=(rsyncd)
permissions=(
    /etc/rsyncd.conf:root:root:644
)
source=(https://www.samba.org/ftp/rsync/src/$name-$version.tar.gz)

sha256sums=(
    "c55f9c9dc10fb8bec397b399a0fdded53cc9a2d8e30891bb0d63724d25c37bef"
)

build() {
    cd $name-$version

    ./configure \
        --prefix=/ \
        --bindir=/bin \
        --libdir=/lib \
        --mandir=/usr/share/man \
        --sysconfdir=/etc \
        --disable-debug \
        --disable-idn \
        --with-included-popt \
        --with-included-zlib=no \
        --enable-ipv6 \
        --enable-xxhash \
        --enable-zstd \
        --enable-lz4

    make
    make DESTDIR=$PKG install

    # Minimal daemon config - no modules exported by default
    install -d $PKG/etc

    printf '%s\n' \
        '## rawnix rsyncd configuration' \
        '## See rsyncd.conf(5) for options' \
        '' \
        'uid = rsyncd' \
        'gid = rsyncd' \
        'use chroot = yes' \
        'read only = yes' \
        'list = no' \
        'reverse lookup = no' \
        'max connections = 8' \
        'timeout = 300' \
        'transfer logging = no' \
        '' \
        '# Example module:' \
        '# [pub]' \
        '#     path = /srv/rsync/pub' \
        '#     comment = public files' \
        '#     hosts allow = 192.168.0.0/16' \
        '#     auth users = backup' \
        '#     secrets file = /etc/rsyncd.secrets' \
        > $PKG/etc/rsyncd.conf
}

post_build() {
    # runit service
    install -d $PKG/etc/sv/rsyncd/log

    printf '%s\n' \
        '#!/bin/sh' \
        'exec 2>&1' \
        '' \
        'exec /bin/rsync --daemon --no-detach --config=/etc/rsyncd.conf --log-file=/dev/stdout' \
        > $PKG/etc/sv/rsyncd/run

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

    chmod 755 $PKG/etc/sv/rsyncd/run
    chmod 755 $PKG/etc/sv/rsyncd/log/run

    # Service disabled by default - must explicitly: rm /etc/sv/rsyncd/down
    touch $PKG/etc/sv/rsyncd/down
}

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

# vim: filetype=sh