-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.py
executable file
·47 lines (37 loc) · 1.1 KB
/
deploy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
import sys
import os
import glob
import shutil
def main(args):
print("Updating submodules...")
os.system("git submodule sync")
os.system("git submodule update --init")
home = os.path.expanduser("~")
print("\nCreating file links...")
for f in glob.glob("*"):
if not f.startswith(".") and not f.endswith(".py"):
path = home + "/." + f
print(path)
if os.path.lexists(path):
if os.path.islink(path) or not os.path.isdir(path):
os.remove(path)
else:
shutil.rmtree(path)
from_path = os.path.abspath(f)
os.system("ln -s {} {}".format(from_path, path))
histfiles = [
"bash_history",
"viminfo",
"lesshst",
"python_history",
]
print("\nRemoving history files...")
for f in histfiles:
path = home + "/." + f
print(path)
if os.path.lexists(path):
os.remove(path)
os.system("ln -s /dev/null {}".format(path))
if __name__ == "__main__":
main(sys.argv)