slackware-current/source/n/dnsmasq/doinst.sh
Patrick J Volkerding 1e4e21c504 Sun Apr 25 19:00:34 UTC 2021
d/gdb-10.2-x86_64-1.txz:  Upgraded.
d/python-pip-21.1-x86_64-1.txz:  Upgraded.
n/dnsmasq-2.85-x86_64-2.txz:  Rebuilt.
  rc.dnsmasq: display stop message. Thanks to vineetmehta.
  rc.dnsmasq: kill by .pid file (or at least within the current namespace).
  Thanks to Petri Kaukasoina.
n/wireguard-tools-1.0.20210424-x86_64-1.txz:  Upgraded.
x/fcitx-qt5-1.2.6-x86_64-1.txz:  Upgraded.
2021-04-26 08:59:56 +02:00

23 lines
634 B
Bash

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/dnsmasq.conf.new
preserve_perms etc/rc.d/rc.dnsmasq.new