description="Synchronizing files over a network by sending just the differences in the files."
url="http://samba.anu.edu.au/rsync/"

packager="Tnut <tnut@nutyx.org>"
contributors="Spiky"
run=(shadow)

name=rsync
version=3.2.7
release=2
runyx_version=20201011

source=(http://downloads.tuxfamily.org/nutyx/files/runyx-${runyx_version}.tar.xz
	http://rsync.samba.org/ftp/$name/$name-$version.tar.gz)

prepare(){
UN=rsyncd
if ! (getent group $UN > /dev/null); then
   groupadd -g 48 $UN
fi
if ! (getent passwd $UN > /dev/null); then
   useradd  -c "rsyncd Daemon" -d /home/rsync \
   -g $UN -s /bin/false -u 48 $UN
fi
}
build() {

cd $name-$version
./configure --prefix=/usr \
-mandir=/usr/share/man \
--disable-xxhash \
--disable-lz4    \
--disable-zstd   \
--without-included-zlib \
--infodir=/usr/share/info
make
make DESTDIR=$PKG install


# Service

cd ../runyx-${runyx_version}
make DESTDIR=$PKG install-sysv-rsyncd
make DESTDIR=$PKG install-runyx-rsyncd
make DESTDIR=$PKG install-sysd-rsyncd


}
service() {
cd $PKG
bsdtar -r -f \
$PKGMK_PACKAGE_DIR/${name}.${group}${PKGMK_BUILDVER}any.${PKGMK_PACKAGE_EXT} \
etc/rc.d etc/init lib/init lib/systemd
rm -r etc/rc.d etc/init lib/init lib/systemd
}
