python/python-pypolicyd-spf: Fixed (Don't clobber config files)

Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
This commit is contained in:
dsomero 2012-09-30 01:13:28 -04:00 committed by Robby Workman
parent 932b788044
commit ebc138379a
2 changed files with 20 additions and 3 deletions

View file

@ -0,0 +1,15 @@
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...
}
config etc/python-policyd-spf/policyd-spf.conf.new

View file

@ -24,7 +24,7 @@
PRGNAM=python-pypolicyd-spf
VERSION=${VERSION:-0.8.0}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
ORIGNAM=$(echo $PRGNAM | cut -f2- -d-)
@ -79,21 +79,23 @@ find . \
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mv $PKG/etc/python-policyd-spf/policyd-spf.conf \
$PKG/etc/python-policyd-spf/policyd-spf.conf.new
# Move man-pages to correct location
mv $PKG/usr/share/man $PKG/usr/
rm -rf $PKG/usr/share
find $PKG/usr/man -type f -exec gzip -9 {} \;
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
CHANGES LICENSE README README.per_user_whitelisting TODO \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}