2010-05-11 15:01:37 +02:00
|
|
|
config() {
|
|
|
|
NEW="$1"
|
2010-05-13 00:38:27 +02:00
|
|
|
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
2010-05-11 15:01:37 +02:00
|
|
|
# If there's no config file by that name, mv it over:
|
|
|
|
if [ ! -r $OLD ]; then
|
|
|
|
mv $NEW $OLD
|
2010-05-13 00:38:27 +02:00
|
|
|
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
|
|
|
|
# toss the redundant copy
|
2010-05-11 15:01:37 +02:00
|
|
|
rm $NEW
|
|
|
|
fi
|
|
|
|
# Otherwise, we leave the .new copy for the admin to consider...
|
|
|
|
}
|
2011-10-19 00:29:46 +02:00
|
|
|
|
2010-05-13 00:38:27 +02:00
|
|
|
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
|
|
|
|
}
|
2010-05-11 15:01:37 +02:00
|
|
|
|
2010-05-13 00:38:27 +02:00
|
|
|
preserve_perms etc/rc.d/rc.tor.new
|
2010-05-12 17:44:17 +02:00
|
|
|
config etc/tor/torrc.new
|
2010-06-16 15:33:16 +02:00
|
|
|
config etc/logrotate.d/tor.new
|
2011-10-19 00:29:46 +02:00
|
|
|
|