aboutsummaryrefslogtreecommitdiffstats
path: root/confman.py
diff options
context:
space:
mode:
Diffstat (limited to 'confman.py')
-rw-r--r--confman.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/confman.py b/confman.py
index ba241d3..649fa6c 100644
--- a/confman.py
+++ b/confman.py
@@ -54,8 +54,11 @@ class SymlinkConfigAction(ConfigAction):
source = self.source_path()
dest = self.dest_path()
if os.path.lexists(dest):
+ # if the link already exists
if os.path.islink(dest):
- if not os.path.samefile(dest, source):
+ # if the old link is broken or incorrect
+ if not os.path.exists(dest) \
+ or not os.path.samefile(dest, source):
os.unlink(dest)
print "Link target altered"
else:
@@ -63,8 +66,9 @@ class SymlinkConfigAction(ConfigAction):
else:
self._makedirs()
+ relsource = os.path.relpath(source, self.config.dest)
+ os.symlink(relsource, dest)
print "Created new link: "+dest+" => "+source
- os.symlink(source, dest)
class CopyConfigAction(ConfigAction):