Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=openjava.git;a=commitdiff;h=901607627645835765abfdb8c7929187992fce56
commit 901607627645835765abfdb8c7929187992fce56 Author: James Buren <[email protected]> Date: Fri Jun 8 03:35:25 2012 -0500 rsync-3.0.9-2-x86_64 * convert to systemd schema diff --git a/source/network/rsync/FrugalBuild b/source/network/rsync/FrugalBuild index e30b6f9..03dad3f 100644 --- a/source/network/rsync/FrugalBuild +++ b/source/network/rsync/FrugalBuild @@ -4,18 +4,21 @@ pkgname=rsync pkgver=3.0.9 -pkgrel=1 +pkgrel=2 pkgdesc="An open source utility that provides fast incremental file transfer." url="http://samba.anu.edu.au/rsync/" groups=('network' 'devel-core') archs=('i686' 'x86_64' 'arm') backup=(etc/rsyncd.conf) depends=('popt>=1.14-2') -install=$pkgname.install up2date="lynx -dump http://samba.anu.edu.au/rsync/|grep -m1 'Rsync version \(.*\) released'|sed 's/.*on \(.*\) re.*/\1/'" source=(http://samba.org/ftp/rsync/src/$pkgname-$pkgver.tar.gz \ - rsyncd.conf rc.rsyncd) -signatures=($source.asc '' '') + rsyncd.conf rc.rsyncd rsyncd.service) +signatures=($source.asc '' '' '') +_F_systemd_scriptlet="$pkgname.install" +_F_sysvinit_units=(rsyncd) +_F_systemd_units=(rsyncd=) +Finclude systemd build() { @@ -24,6 +27,8 @@ build() Fbuild Ffile /etc/rsyncd.conf Frcd rsyncd + Ffile /lib/systemd/system/rsyncd.service + Fgenscriptlet } # optimization OK diff --git a/source/network/rsync/rsync.install b/source/network/rsync/rsync.install index 013246d..cbf79cc 100644 --- a/source/network/rsync/rsync.install +++ b/source/network/rsync/rsync.install @@ -1,28 +1,73 @@ -# arg 1: the new package version -post_install() { +sysvinit_units=(@_F_sysvinit_units@) +systemd_units=(@_F_systemd_units@) + +post_install() +{ if ! grep -q '^rsyncd:' /etc/group ; then groupadd -g 28 rsyncd fi if ! grep -q '^rsyncd:' /etc/passwd ; then useradd -u 28 -g 28 rsyncd fi + + local unit + local op + + for i in ${sysvinit_units[@]}; do + chkconfig --del rc.$i >/dev/null 2>&1 + done + + for i in ${systemd_units[@]}; do + unit=$(echo $i | cut -f 1 -d '=') + op=$(echo $i | cut -f 2 -d '=') + if echo $op | grep -q 'e'; then + systemctl enable $unit.service >/dev/null 2>&1 + fi + if echo $op | grep -q 's'; then + systemctl start $unit.service >/dev/null 2>&1 + fi + done } -# arg 1: the new package version -# arg 2: the old package version -post_upgrade() { - post_install $1 +post_upgrade() +{ + if ! grep -q '^rsyncd:' /etc/group ; then + groupadd -g 28 rsyncd + fi + if ! grep -q '^rsyncd:' /etc/passwd ; then + useradd -u 28 -g 28 rsyncd + fi + + for i in ${sysvinit_units[@]}; do + chkconfig --del rc.$i >/dev/null 2>&1 + done + + systemctl daemon-reload >/dev/null 2>&1 } -# arg 1: the old package version -pre_remove() { +pre_remove() +{ userdel rsyncd groupdel rsyncd + + local unit + + for i in ${sysvinit_units[@]}; do + chkconfig --del rc.$i >/dev/null 2>&1 + done + + for i in ${systemd_units[@]}; do + unit=$(echo $i | cut -f 1 -d '=') + systemctl --no-reload disable $unit.service >/dev/null 2>&1 + systemctl stop $unit.service >/dev/null 2>&1 + done +} + +post_remove() +{ + systemctl daemon-reload >/dev/null 2>&1 } op=$1 shift - $op $* - -# vim: ft=sh diff --git a/source/network/rsync/rsyncd.conf b/source/network/rsync/rsyncd.conf index 308d63e..b8c2471 100644 --- a/source/network/rsync/rsyncd.conf +++ b/source/network/rsync/rsyncd.conf @@ -2,6 +2,7 @@ # It exports a single module without user authentication. use chroot = yes +pid file = /var/run/rsyncd.pid [ftp] path = /home/ftp diff --git a/source/network/rsync/rsyncd.service b/source/network/rsync/rsyncd.service new file mode 100644 index 0000000..abc0b76 --- /dev/null +++ b/source/network/rsync/rsyncd.service @@ -0,0 +1,11 @@ +[Unit] +Description=rsyncd server +After=network.target + +[Service] +ExecStart=/usr/bin/rsync -4 --daemon +PIDFile=/var/run/rsyncd.pid +Type=forking + +[Install] +WantedBy=multi-user.target _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
