diff options
Diffstat (limited to 'network/fail2ban/doinst.sh')
-rw-r--r-- | network/fail2ban/doinst.sh | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/network/fail2ban/doinst.sh b/network/fail2ban/doinst.sh index 5a77f216e6..f6a20b4af0 100644 --- a/network/fail2ban/doinst.sh +++ b/network/fail2ban/doinst.sh @@ -11,14 +11,18 @@ config() { # Otherwise, we leave the .new copy for the admin to consider... } -# Keep same perms on rc.fail2ban.new: -if [ -e etc/rc.d/rc.fail2ban ]; then - cp -a etc/rc.d/rc.fail2ban etc/rc.d/rc.fail2ban.new.incoming - cat etc/rc.d/rc.fail2ban.new > etc/rc.d/rc.fail2ban.new.incoming - mv etc/rc.d/rc.fail2ban.new.incoming etc/rc.d/rc.fail2ban.new -fi +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/rc.d/rc.fail2ban.new +preserve_perms etc/rc.d/rc.fail2ban.new config etc/logrotate.d/fail2ban.new config etc/fail2ban/fail2ban.conf.new config etc/fail2ban/jail.conf.new |