diff options
author | Mario Preksavec <mario at slackware dot hr> | 2015-03-16 01:53:28 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2015-03-16 01:53:28 +0700 |
commit | 893b9070a8ea5be365e6cf3ba4af7b337af0027d (patch) | |
tree | a02d4a1d58635c495609bf33054d5ce62e470404 /network/openvswitch-utils/doinst.sh | |
parent | e9ad9ab3c9551bb067d2a3955468699bc467f65d (diff) | |
download | slackbuilds-893b9070a8ea5be365e6cf3ba4af7b337af0027d.tar.gz |
network/openvswitch-utils: Added (a multilayer software switch).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/openvswitch-utils/doinst.sh')
-rw-r--r-- | network/openvswitch-utils/doinst.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/network/openvswitch-utils/doinst.sh b/network/openvswitch-utils/doinst.sh new file mode 100644 index 0000000000..2057a9da19 --- /dev/null +++ b/network/openvswitch-utils/doinst.sh @@ -0,0 +1,25 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +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 +} + +preserve_perms etc/rc.d/rc.openvswitch.new |