-
Notifications
You must be signed in to change notification settings - Fork 3
/
bootstrap.py
executable file
·37 lines (28 loc) · 953 Bytes
/
bootstrap.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
#!/usr/bin/python
import os
import subprocess
import platform
import sys
import shutil
def fullpath(*args):
_p = os.path
return _p.abspath(_p.normpath(_p.expanduser(_p.join(*args))))
del _p
projectroot = fullpath(os.path.dirname(__file__))
def path(*args):
return fullpath(projectroot, *args)
if platform.system() == "Linux":
subprocess.check_call(["sudo", "python",
path("bin/dotfiles-install"), "bootstrap-root"])
elif platform.system() == "Darwin":
subprocess.check_call(["python",
path("bin/dotfiles-install"), "bootstrap-user"])
if not os.path.exists(path(".git")):
os.chdir(fullpath("~"))
subprocess.check_call(["git", "clone",
"https://github.com/lahwran/dotfiles.git",
fullpath("~/dotfiles")])
os.chdir(fullpath("~/dotfiles"))
if "autodel" in sys.argv:
shutil.rmtree(projectroot)
subprocess.call(["python", fullpath("./bin/dotfiles-install"), "init"])