-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotfiles.py
executable file
·50 lines (41 loc) · 1.22 KB
/
dotfiles.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
48
49
#/usr/bin/python
import sys, shutil, os
files = {
'vimrc': '.vimrc',
'bash_profile': '.bash_profile',
'bashrc': '.bashrc',
'i3config': '.i3/config',
'packup': 'packup',
'xinitrc': '.xinitrc',
'gtkrc': '.gtkrc-2.0',
'tmuxconf': '.tmux.conf',
'hybrid.vim': '.vim/colors/hybrid.vim',
'newmachine.sh': 'newmachine.sh',
'Xresources': '.Xresources',
'zshrc': '.zshrc',
'sbtinit': 'bin/sbtinit',
'hybrid.zsh-theme': '.zsh/hybrid.zsh-theme'}
thisDir = os.path.dirname(os.path.realpath(__file__))
home = os.path.expanduser('~')
print home
def copyFile(src, dest):
try:
shutil.copy(src, dest)
except shutil.Error as e:
print 'Error: ' , e
except IOError as e:
print 'Error: ' , e
if sys.argv[1] == 'install':
for item in files:
src = thisDir + '/' + item
dest = home + '/' + files[item]
print 'gonna copy ', src, 'to ', dest
copyFile(src, dest)
elif sys.argv[1] == 'backup':
for item in files:
dest = thisDir + '/' + item
src = home + '/' + files[item]
print 'gonna copy ', src, 'to ', dest
copyFile(src, dest)
else:
print 'Argument must be \'install\' or \'backup\''