summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2013-08-02 00:11:55 -0400
committerAde Lee <alee@redhat.com>2013-08-02 00:41:12 -0400
commit68417821be716a300065c06d6c5c76828cb48c6a (patch)
treeb8b2db31bca31569f3f40dee9e38bece8c79b766
parentf99924991f0c7a5a527fb04910cf7871327d3a28 (diff)
downloadpki-68417821be716a300065c06d6c5c76828cb48c6a.tar.gz
pki-68417821be716a300065c06d6c5c76828cb48c6a.tar.xz
pki-68417821be716a300065c06d6c5c76828cb48c6a.zip
Fix link parsing code to remove broken symbolic links before replacing them
Trac Ticket 699
-rw-r--r--base/server/scripts/operations6
1 files changed, 6 insertions, 0 deletions
diff --git a/base/server/scripts/operations b/base/server/scripts/operations
index 93d3bda90..b71893e86 100644
--- a/base/server/scripts/operations
+++ b/base/server/scripts/operations
@@ -944,6 +944,12 @@ make_symlink()
"since target '${target}' is NOT fully resolvable!"
rv=1
else
+ # Attempt to remove any existing symbolic link.
+ # This is likely pointing to a non-existent target
+ if [ `readlink ${symlink}` ]; then
+ rm ${symlink}
+ fi
+
# Attempt to create a symbolic link and 'chown' it.
ln -s ${target} ${symlink}
rv=$?