slackware-current/source/n/wsdd2/doinst.sh
Patrick J Volkerding 7aefbd4988 Fri May 24 19:58:32 UTC 2024
ap/sqlite-3.46.0-x86_64-1.txz:  Upgraded.
l/gvfs-1.54.1-x86_64-1.txz:  Upgraded.
l/python-requests-2.32.2-x86_64-1.txz:  Upgraded.
n/c-ares-1.29.0-x86_64-1.txz:  Upgraded.
n/dhcpcd-10.0.8-x86_64-1.txz:  Upgraded.
n/wsdd2-1.8.7-x86_64-1.txz:  Added.
  Needed by Samba to enable share discovery.
  Thanks to mistfire and Tim Dickson.
2024-05-24 22:29:19 +02:00

26 lines
614 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
chmod +x $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
}
preserve_perms etc/rc.d/rc.wsdd2.new