From 7f09470ed92c3b3d1021cf8fcd54a4335fd0638d Mon Sep 17 00:00:00 2001 From: Matteo Bernardini Date: Sat, 14 Nov 2020 23:32:59 +0100 Subject: network/strongswan: Fix the no-clobber routine. The package's /install dir should not contain additional files Signed-off-by: Matteo Bernardini Signed-off-by: Willy Sudiarto Raharjo --- network/strongswan/doinst.sh | 29 ++++++++++------------------- network/strongswan/strongswan.SlackBuild | 4 ++-- 2 files changed, 12 insertions(+), 21 deletions(-) (limited to 'network/strongswan') 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 diff --git a/network/strongswan/strongswan.SlackBuild b/network/strongswan/strongswan.SlackBuild index a36d0c351c..d9d0310224 100644 --- a/network/strongswan/strongswan.SlackBuild +++ b/network/strongswan/strongswan.SlackBuild @@ -165,7 +165,7 @@ cd $PKG for i in $(find etc -type f) do mv $i $i.new - echo $i -done 1>>$PKG/install/conffiles + echo "config $i.new" >> $PKG/install/doinst.sh +done /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} -- cgit v1.2.3