summaryrefslogtreecommitdiff
path: root/network/strongswan/doinst.sh
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2020-11-14 23:32:59 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2020-11-22 01:14:28 +0700
commit7f09470ed92c3b3d1021cf8fcd54a4335fd0638d (patch)
tree36975187510d82ceedee40cae226b009793f8027 /network/strongswan/doinst.sh
parentf9f687a91b9c13e8b43d770ec4c952a54881f6f9 (diff)
downloadslackbuilds-7f09470ed92c3b3d1021cf8fcd54a4335fd0638d.tar.gz
network/strongswan: Fix the no-clobber routine.
The package's /install dir should not contain additional files Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/strongswan/doinst.sh')
-rw-r--r--network/strongswan/doinst.sh29
1 files changed, 10 insertions, 19 deletions
diff --git a/network/strongswan/doinst.sh b/network/strongswan/doinst.sh
index a88995c5ed..19a6ff6ac8 100644
--- a/network/strongswan/doinst.sh
+++ b/network/strongswan/doinst.sh
@@ -1,22 +1,13 @@
-
config() {
- NEW="$1"
- OLD="${1%.new}"
- if [ ! -r $OLD ];
- then
- # If there's no config file by that name, mv it over:
- mv $NEW $OLD
- elif [ "$(md5sum <$OLD)" = "$(md5sum <$NEW)" ];
- then
- # toss the redundant copy
- rm $NEW
- fi
- # Otherwise, we leave the .new copy for the admin to consider...
+ 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...
}
-# doinst.sh reads the list of files from ./install/conffiles at install time.
-# ./install/conffiles was generated by strongswan.SlackBuild
-for cf in $(cat install/conffiles)
-do
- config $cf.new
-done