diff options
author | root <root@rshg054.dnsready.net> | 2012-05-28 00:02:35 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-05-28 00:02:35 +0000 |
commit | 89dd7b5f30d48c708092a71b1c8285090fe91505 (patch) | |
tree | fb3a22f789121b955ff0fce7ec8d2f8c8886579b /community/ipvsadm | |
parent | 1f45ad8e3f17397e2f44e68ef9a0d860091eea9e (diff) |
Mon May 28 00:02:35 UTC 2012
Diffstat (limited to 'community/ipvsadm')
-rw-r--r-- | community/ipvsadm/PKGBUILD | 43 | ||||
-rw-r--r-- | community/ipvsadm/ipvsadm.conf | 8 | ||||
-rw-r--r-- | community/ipvsadm/ipvsadm.install | 10 | ||||
-rw-r--r-- | community/ipvsadm/ipvsadm.rc | 50 | ||||
-rw-r--r-- | community/ipvsadm/ipvsadm.service | 11 | ||||
-rw-r--r-- | community/ipvsadm/ipvsadm.systemd | 22 |
6 files changed, 96 insertions, 48 deletions
diff --git a/community/ipvsadm/PKGBUILD b/community/ipvsadm/PKGBUILD index a8126aca1..42132b7b6 100644 --- a/community/ipvsadm/PKGBUILD +++ b/community/ipvsadm/PKGBUILD @@ -1,47 +1,56 @@ -# $Id: PKGBUILD 69082 2012-04-09 02:20:59Z seblu $ +# $Id: PKGBUILD 71320 2012-05-26 15:01:34Z seblu $ # Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org> # Contributor: Judd Vinet <jvinet@zeroflux.org> pkgname=ipvsadm pkgver=1.26 -pkgrel=4 +pkgrel=5 pkgdesc='The IP Virtual Server administration utility' arch=('i686' 'x86_64') url='http://www.linuxvirtualserver.org/software/ipvs.html' license=('GPL2') depends=('libnl1' 'popt') -backup=('etc/conf.d/ipvsadm') +backup=("etc/$pkgname.conf" "etc/conf.d/$pkgname") +options=('!makeflags') +install=$pkgname.install source=("http://www.linuxvirtualserver.org/software/kernel-2.6/$pkgname-$pkgver.tar.gz" - 'ipvsadm.rc' - 'ipvsadm.conf' - 'ipvsadm.rules' + "$pkgname.conf" + "$pkgname.rc" + "$pkgname.systemd" + "$pkgname.service" '01-fix-not-showing-all-server.patch') md5sums=('eac3ba3f62cd4dea2da353aeddd353a8' - '89b15096bb243dc694b6c5d4200561fd' - 'cd358130967a9cc0d31fc61282df43e7' - 'cd6649c647e495d4d6f981542ce5a93b' + 'b6cb7724aa6c61c3a9cdd40e8eaa973e' + 'f2f4a7c6d57c5301c5f12f9b323fdea8' + 'df28308873b437eeb55657f6aa438ecd' + 'dc87684064f85b64c1e79c1eac336303' 'e9fb77d2fbe2d3f41d60257316338543') build() { cd $pkgname-$pkgver patch -p1 -i ../01-fix-not-showing-all-server.patch - make INCLUDE="-I/usr/src/linux-$(uname -r)/include -I.. -I." + make #INCLUDE="-I/usr/src/linux-$(uname -r)/include -I.. -I." } package() { - cd $pkgname-$pkgver + pushd $pkgname-$pkgver make \ BUILD_ROOT="$pkgdir" \ MANDIR=usr/share/man \ SBIN="$pkgdir/usr/sbin" \ INIT="$pkgdir/etc/rc.d" \ install - cd "$srcdir" - # add initscripts - install -D -m 755 $pkgname.rc "$pkgdir/etc/rc.d/$pkgname" - install -D -m 644 $pkgname.conf "$pkgdir/etc/conf.d/$pkgname" - # add ipvsadm rules - install -D -m 644 $pkgname.rules "$pkgdir/etc/$pkgname.rules" + popd + # install initscripts + install -Dm 755 $pkgname.rc "$pkgdir/etc/rc.d/$pkgname" + install -Dm 644 $pkgname.conf "$pkgdir/etc/conf.d/$pkgname" + # install systemd service + install -Dm 755 $pkgname.systemd \ + "$pkgdir/usr/lib/systemd/scripts/$pkgname" + install -Dm 644 $pkgname.service \ + "$pkgdir/usr/lib/systemd/system/$pkgname.service" + # default config file + install -Dm 644 /dev/null "$pkgdir/etc/$pkgname.conf" } # vim:set ts=2 sw=2 ft=sh et: diff --git a/community/ipvsadm/ipvsadm.conf b/community/ipvsadm/ipvsadm.conf index aac7ba729..b9a98a36e 100644 --- a/community/ipvsadm/ipvsadm.conf +++ b/community/ipvsadm/ipvsadm.conf @@ -1,3 +1,7 @@ -# vim:set ts=2 sw=2 ft=sh et: +# Configuration file used to load/save configuration. +CONFIG_FILE='/etc/ipvsadm.conf' + +# Save configuration on stop/restart. +#SAVE_ON_STOP=yes -IPVSADM_CONF='/etc/ipvsadm.rules' +# vim:set ts=2 sw=2 ft=sh et: diff --git a/community/ipvsadm/ipvsadm.install b/community/ipvsadm/ipvsadm.install new file mode 100644 index 000000000..d235b560a --- /dev/null +++ b/community/ipvsadm/ipvsadm.install @@ -0,0 +1,10 @@ +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + [ $(vercmp "$2" '1.26-4') -gt 0 ] || cat <<EOF +Config file have been moved from /etc/ipvsadm.rules to /etc/ipvsadm.conf. +You can revert to the previous location by editing /etc/conf.d/ipvsadm. +EOF +} + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/community/ipvsadm/ipvsadm.rc b/community/ipvsadm/ipvsadm.rc index 5a9614106..b810dcd62 100644 --- a/community/ipvsadm/ipvsadm.rc +++ b/community/ipvsadm/ipvsadm.rc @@ -2,38 +2,30 @@ . /etc/rc.conf . /etc/rc.d/functions -. /etc/conf.d/ipvsadm +. /etc/conf.d/${0##*/} case "$1" in - start) + start) stat_busy 'Loading IPVS table' - if [[ -f $IPVSADM_CONF ]] && ipvsadm-restore < "$IPVSADM_CONF"; then - add_daemon ipvsadm - stat_done - else - stat_fail - fi - ;; - stop) - status 'Clearing IPVS table' ipvsadm -C - rm_daemon ipvsadm - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - save) - stat_busy 'Saving IPVS table' - if ipvsadm-save -n > "$IPVSADM_CONF" 2>/dev/null; then - stat_done - else - stat_fail - fi - ;; - *) - echo "usage: ${0##*/} {start|stop|restart|save}" + ipvsadm-restore < "$CONFIG_FILE" && + add_daemon ${0##*/} && stat_done || stat_die + ;; + stop) + [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save + stat_busy 'Clearing IPVS table' + ipvsadm -C && rm_daemon ${0##*/} && stat_done || stat_die + ;; + restart) + $0 stop + $0 start + ;; + save) + stat_busy 'Saving IPVS table' + ipvsadm-save -n > "$CONFIG_FILE" && stat_done || stat_die + ;; + *) + echo "usage: ${0##*/} {start|stop|restart|save}" >&2 + exit 1 esac -exit 0 # vim:set ts=2 sw=2 ft=sh et: diff --git a/community/ipvsadm/ipvsadm.service b/community/ipvsadm/ipvsadm.service new file mode 100644 index 000000000..bb6b01c3f --- /dev/null +++ b/community/ipvsadm/ipvsadm.service @@ -0,0 +1,11 @@ +[Unit] +Description=IP Virtual Server + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/lib/systemd/scripts/ipvsadm start +ExecStop=/usr/lib/systemd/scripts/ipvsadm stop + +[Install] +WantedBy=multi-user.target diff --git a/community/ipvsadm/ipvsadm.systemd b/community/ipvsadm/ipvsadm.systemd new file mode 100644 index 000000000..3b72bd3ef --- /dev/null +++ b/community/ipvsadm/ipvsadm.systemd @@ -0,0 +1,22 @@ +#!/bin/bash + +. /etc/conf.d/ipvsadm + +case $1 in + start) + ipvsadm-restore < "$CONFIG_FILE" + ;; + stop) + [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save + ipvsadm -C + ;; + save) + ipvsadm-save -n > "$CONFIG_FILE" + ;; + *) + echo "usage: ${0##*/} {start|stop|save}" >&2 + exit 1 + ;; +esac + +# vim:set ts=2 sw=2 ft=sh et: |