files/install-files

33 lines
869 B
Python
Executable File

#!/usr/bin/env python
import os
import sys
from subprocess import Popen, PIPE
here = os.path.dirname(sys.argv[0])
if here.startswith('./'):
here = os.getcwd() + here[1:]
def install_file(src, dst):
source = '%s/%s' % (here, src)
dest = '%s/%s' % (os.environ['HOME'], dst)
if os.path.exists(dest):
sys.stdout.write('Skipping %s\n' % dst)
else:
sys.stdout.write('Installing %s\n' % dst)
if not os.path.exists(os.path.dirname(dest)):
os.makedirs(os.path.dirname(dest))
Popen(['ln', '-s', source, dest]).wait()
files = [
('bash_aliases', '.bash_aliases'),
('vimrc', '.vimrc'),
('inputrc', '.inputrc'),
('screenrc', '.screenrc'),
('ir_black.vim', '.vim/colors/ir_black.vim'),
('gitignore', '.gitignore'),
]
for s, d in files:
install_file(s, d)