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/ipset | |
parent | 1f45ad8e3f17397e2f44e68ef9a0d860091eea9e (diff) |
Mon May 28 00:02:35 UTC 2012
Diffstat (limited to 'community/ipset')
-rw-r--r-- | community/ipset/PKGBUILD | 18 | ||||
-rw-r--r-- | community/ipset/ipset.conf | 8 | ||||
-rw-r--r-- | community/ipset/ipset.rc | 32 | ||||
-rw-r--r-- | community/ipset/ipset.service | 6 | ||||
-rw-r--r-- | community/ipset/ipset.systemd | 18 |
5 files changed, 47 insertions, 35 deletions
diff --git a/community/ipset/PKGBUILD b/community/ipset/PKGBUILD index 76c732531..9a7ebc1e5 100644 --- a/community/ipset/PKGBUILD +++ b/community/ipset/PKGBUILD @@ -1,15 +1,15 @@ -# $Id: PKGBUILD 70556 2012-05-11 12:51:57Z seblu $ +# $Id: PKGBUILD 71313 2012-05-26 14:56:36Z seblu $ # Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org> pkgname=ipset pkgver=6.12.1 -pkgrel=1 +pkgrel=2 pkgdesc='Administration tool for IP sets' arch=('i686' 'x86_64') url='http://ipset.netfilter.org' license=('GPL2') depends=('libmnl') -backup=('etc/ipset.conf' "etc/conf.d/$pkgname") +backup=("etc/$pkgname.conf" "etc/conf.d/$pkgname") options=('!libtool') source=("http://ipset.netfilter.org/$pkgname-$pkgver.tar.bz2" "$pkgname.conf" @@ -17,10 +17,10 @@ source=("http://ipset.netfilter.org/$pkgname-$pkgver.tar.bz2" "$pkgname.systemd" "$pkgname.service") md5sums=('80df500a4d93cb14e1373ae290716cda' - '61963bda45c002fb37977e58bb5b829c' - '888bf1eadffcc076b9e97de02e2147c8' - 'c5f38e5f3027066c1491a563e734796e' - 'b9ff3bd7b959cb1b97b8c492b52b8377') + '3e606a2823a700b4e9c5f17511a6f6a5' + 'de89b054d967036e08b13bc6a7235286' + 'dfc3105b89ed41fc4a1feb4f4f13f2a3' + 'b032241b96b5802975fe4321cc511c6b') build() { cd $pkgname-$pkgver @@ -29,13 +29,13 @@ build() { } package() { - cd $pkgname-$pkgver + pushd $pkgname-$pkgver make DESTDIR="$pkgdir" install # install doc install -dm755 "$pkgdir/usr/share/doc/$pkgname" install -m644 README UPGRADE ChangeLog "$pkgdir/usr/share/doc/$pkgname" + popd # install initscripts - cd .. install -Dm 755 $pkgname.rc "$pkgdir/etc/rc.d/$pkgname" install -Dm 644 $pkgname.conf "$pkgdir/etc/conf.d/$pkgname" # install systemd service diff --git a/community/ipset/ipset.conf b/community/ipset/ipset.conf index 686931f4c..d5d3cb699 100644 --- a/community/ipset/ipset.conf +++ b/community/ipset/ipset.conf @@ -1,3 +1,7 @@ -# vim:set ts=2 sw=2 ft=sh et: +# Configuration file used to load/save configuration. +CONFIG_FILE='/etc/ipset.conf' + +# Save configuration on stop/restart. +#SAVE_ON_STOP=yes -IPSET_CONF='/etc/ipset.conf' +# vim:set ts=2 sw=2 ft=sh et: diff --git a/community/ipset/ipset.rc b/community/ipset/ipset.rc index 1d5f7df8b..517eff1ea 100644 --- a/community/ipset/ipset.rc +++ b/community/ipset/ipset.rc @@ -2,38 +2,32 @@ . /etc/rc.conf . /etc/rc.d/functions -. /etc/conf.d/ipset +. /etc/conf.d/${0##*/} case "$1" in start) - stat_busy 'Loading IP Sets' - if [[ -f $IPSET_CONF ]] && ipset restore < "$IPSET_CONF"; then - add_daemon ipset - stat_done - else - stat_fail - fi + stat_busy 'Loading IP sets' + ipset restore < "$CONFIG_FILE" && add_daemon ${0##*/} && stat_done || stat_die ;; stop) - status 'Clearing IP Sets' ipset destroy - rm_daemon ipset + [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save + stat_busy 'Clearing IP sets' + ipset destroy && + rm_daemon ${0##*/} && stat_done || stat_die ;; restart) $0 stop - sleep 1 $0 start ;; save) - stat_busy 'Saving IP Sets' - if ipset save > "$IPSET_CONF" 2>/dev/null; then - stat_done - else - stat_fail - fi + stat_busy 'Saving IP sets' + ipset save > "$CONFIG_FILE" && + stat_done || stat_die ;; *) - echo "usage: ${0##*/} {start|stop|restart|save}" + 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/ipset/ipset.service b/community/ipset/ipset.service index 0e0dd4ff7..8c4889d3c 100644 --- a/community/ipset/ipset.service +++ b/community/ipset/ipset.service @@ -1,12 +1,12 @@ [Unit] Description=IP Sets +Before=iptables.service [Service] Type=oneshot -ExecStart=/usr/lib/systemd/scripts/ipset start -ExecStop=/usr/sbin/ipset destroy RemainAfterExit=yes +ExecStart=/usr/lib/systemd/scripts/ipset start +ExecStop=/usr/lib/systemd/scripts/ipset stop [Install] WantedBy=multi-user.target -Before=iptables.service diff --git a/community/ipset/ipset.systemd b/community/ipset/ipset.systemd index 36df5124a..92397f3a7 100644 --- a/community/ipset/ipset.systemd +++ b/community/ipset/ipset.systemd @@ -2,7 +2,21 @@ . /etc/conf.d/ipset -[[ -f $IPSET_CONF ]] || exit 1 -ipset restore < "$IPSET_CONF" +case $1 in + start) + ipset restore < "$CONFIG_FILE" + ;; + stop) + [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save + ipset destroy + ;; + save) + ipset save > "$CONFIG_FILE" + ;; + *) + echo "usage: ${0##*/} {start|stop|save}" >&2 + exit 1 + ;; +esac # vim:set ts=2 sw=2 ft=sh et: |