summaryrefslogtreecommitdiff
path: root/network/vnstat/doinst.sh
diff options
context:
space:
mode:
authorWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-04-16 00:13:45 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-04-16 00:13:45 +0700
commit831a6b69396a7f8a1bf8d66b6d4b649a4a7d80e0 (patch)
tree0041fc6b8ff69ae20fc394ed920067998f2cd83f /network/vnstat/doinst.sh
parenta5c6ddbd70e2928ae72b2bfb6a3718f39b76b61d (diff)
downloadslackbuilds-831a6b69396a7f8a1bf8d66b6d4b649a4a7d80e0.tar.gz
network/vnstat: Updated for version 1.17 + new maintainer.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/vnstat/doinst.sh')
-rw-r--r--network/vnstat/doinst.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/network/vnstat/doinst.sh b/network/vnstat/doinst.sh
index 052e2f8929..5806a5036d 100644
--- a/network/vnstat/doinst.sh
+++ b/network/vnstat/doinst.sh
@@ -11,12 +11,16 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider...
}
-# Keep same perms on rc.vnstat.new:
-if [ -e etc/rc.d/rc.vnstat ]; then
- cp -a etc/rc.d/rc.vnstat etc/rc.d/rc.vnstat.new.incoming
- cat etc/rc.d/rc.vnstat.new > etc/rc.d/rc.vnstat.new.incoming
- mv etc/rc.d/rc.vnstat.new.incoming etc/rc.d/rc.vnstat.new
-fi
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
-config etc/rc.d/rc.vnstat.new
+preserve_perms etc/rc.d/rc.vnstat.new
config etc/vnstat.conf.new