diff options
author | Timo Weingärtner <timo@tiwe.de> | 2014-02-26 17:12:04 +0100 |
---|---|---|
committer | Timo Weingärtner <timo@tiwe.de> | 2014-02-26 17:12:04 +0100 |
commit | 34fb9827e7e68b9e35faf2e1568c80176bfcbb05 (patch) | |
tree | 62790bae5119274718f0b6de1fd2c7e6f1d0bd25 /debian | |
parent | f1d36688e00b2c332eb14acb3bdec4915b36c3c2 (diff) | |
download | openssh-known-hosts-34fb9827e7e68b9e35faf2e1568c80176bfcbb05.tar.gz |
postinst: check for dangling but possibly correct symlink
test -e dereferences symlinks
Diffstat (limited to 'debian')
-rw-r--r-- | debian/openssh-known-hosts.postinst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/debian/openssh-known-hosts.postinst b/debian/openssh-known-hosts.postinst index 7caf740..0d810a9 100644 --- a/debian/openssh-known-hosts.postinst +++ b/debian/openssh-known-hosts.postinst @@ -20,10 +20,12 @@ set -e case "$1" in configure|abort-upgrade|abort-remove|abort-deconfigure) - [ -e /etc/ssh/ssh_known_hosts ] || ln -s /var/lib/openssh-known-hosts/ssh_known_hosts /etc/ssh/ssh_known_hosts - if [ "`readlink /etc/ssh/ssh_known_hosts`" != /var/lib/openssh-known-hosts/ssh_known_hosts ]; then - echo "/etc/ssh/ssh_known_hosts already exists, please set up the link to" - echo "/var/lib/openssh-known-hosts/ssh_known_hosts yourself or point to it" + kh_link=/etc/ssh/ssh_known_hosts + kh_dest=/var/lib/openssh-known-hosts/ssh_known_hosts + [ -L $kh_link ] || [ -e $kh_link ] || ln -s $kh_dest $kh_link + if [ "`readlink $kh_link`" != $kh_dest ]; then + echo "$kh_link already exists, please set up the link to" + echo "$kh_dest yourself or point to it" echo "with GlobalKnownHostsFile in ssh_config(5)." fi ;; |