files/install-files

34 lines
886 B
Python
Executable File

#!/usr/bin/env python3
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'),
('inputrc', '.inputrc'),
('screenrc', '.screenrc'),
('gitignore', '.gitignore'),
('colordiffrc', '.colordiffrc'),
('rvmrc', '.rvmrc'),
('toprc', '.toprc'),
]
for s, d in files:
install_file(s, d)