summaryrefslogtreecommitdiffstats
path: root/source/n/openssh/doinst.sh
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/openssh/doinst.sh')
-rw-r--r--source/n/openssh/doinst.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/n/openssh/doinst.sh b/source/n/openssh/doinst.sh
index d696245d0..73ce62836 100644
--- a/source/n/openssh/doinst.sh
+++ b/source/n/openssh/doinst.sh
@@ -9,10 +9,24 @@ config() {
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
+ touch -r ${NEW} ${NEW}.incoming
+ mv ${NEW}.incoming ${NEW}
+ fi
+ config ${NEW}
+}
config etc/ssh/ssh_config.new
config etc/ssh/sshd_config.new
-config etc/rc.d/rc.sshd.new
+preserve_perms etc/rc.d/rc.sshd.new
+if [ -e etc/rc.d/rc.sshd.new ]; then
+ mv etc/rc.d/rc.sshd.new etc/rc.d/rc.sshd
+fi
# If the sshd user/group/shadow don't exist, add them: