-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall
More file actions
executable file
·24 lines (19 loc) · 649 Bytes
/
Copy pathuninstall
File metadata and controls
executable file
·24 lines (19 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
import os
import shutil
import yaml
CONFIG = "install.conf.yaml"
stream = open(CONFIG, "r")
conf = yaml.load(stream)
for section in conf:
if 'link' in section:
for target, value in section['link'].items():
if 'path' in value:
dotfile = value['path']
else: dotfile = value
realpath = os.path.expanduser(target)
if os.path.islink(realpath):
print("removing symlink to", realpath)
os.unlink(realpath)
print("replacing {0} with {1}".format(target, dotfile))
shutil.copyfile(dotfile, realpath)