forked from HadesD/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
83 lines (68 loc) · 1.92 KB
/
install
File metadata and controls
83 lines (68 loc) · 1.92 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python3
import os
import sys
import shutil
import subprocess
which = None
if (sys.version_info > (3, 0)):
which = shutil.which
else:
import distutils.spawn
which = distutils.spawn.find_executable
import update
update.gitUpdate()
DIR = os.path.dirname(os.path.realpath(__file__))
HOME = os.environ['HOME']
DOT_VIM_DIR = HOME + '/.vim'
DOT_VIM_NAME = ''
THIS_VIM_DIR = DIR + '/.vim'
THIS_TMUX_DIR = DIR + '/.tmux'
THIS_I3_DIR = DIR + '/.i3'
def remove(path):
if not os.path.exists(path):
return
print('Detele :: ' + path)
if os.path.isfile(path):
os.remove(path)
elif os.path.islink(path):
os.unlink(path)
else:
shutil.rmtree(path)
if (sys.platform == 'linux2') or (sys.platform == 'linux') \
or (sys.platform == 'darwin') \
or (sys.platform == 'msys'):
print('Unix :: found')
HOME = os.environ['HOME']
print('Git :: .gitconfig')
DOT_GITCONFIG_DIR = HOME + '/.gitconfig'
if (os.path.exists(DOT_GITCONFIG_DIR)):
f = open(DOT_GITCONFIG_DIR, 'r')
r = f.read()
f.close()
f = open(DOT_GITCONFIG_DIR, 'w')
f.write(
r
+ '\n[include]\n'
+ ' path = '+DIR+'/.gitconfig\n'
)
f.close()
if (sys.platform == 'msys'):
f = open(HOME+'/.vimrc', 'w')
f.write('source "' + THIS_VIM_DIR + '/vimrc"')
f.close()
else:
remove(DOT_VIM_DIR)
print('Vim :: start :: Symlink')
os.symlink(THIS_VIM_DIR, DOT_VIM_DIR)
if (which('zsh')):
print('ZSH :: start')
subprocess.call(['bash', DIR + '/scripts/install-oh-my-zsh.sh'])
else:
print('ZSH :: NOT FOUND!!!')
print('Tmux :: start :: Symlink')
remove(HOME+'/.tmux')
remove(HOME+'/.tmux.conf')
os.symlink(THIS_TMUX_DIR, HOME+'/.tmux')
os.symlink(HOME+'/.tmux/.tmux.conf', HOME+'/.tmux.conf')
else:
print('OS not found')