slackware-current/patches/source/dehydrated/doinst.sh
Patrick J Volkerding 2fac477c48 Thu Feb 8 22:17:18 UTC 2024
patches/packages/dehydrated-0.7.1-noarch-1_slack15.0.txz:  Upgraded.
  This is a bugfix release that addresses (among other things) an
  "unbound variable" error if the signing server is not available.
  Thanks to metaed for the heads-up.
2024-02-09 13:30:41 +01:00

26 lines
653 B
Bash

#!/bin/sh
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}
}
config etc/dehydrated/config.new
preserve_perms etc/cron.daily/dehydrated.new