From 67cb9c10d4f2d6c28b382da247b051289c5fbe0a Mon Sep 17 00:00:00 2001 From: nebukadnezzar Date: Mon, 12 Aug 2013 01:45:11 +0200 Subject: [PATCH] install to $HOME/bin instead of /usr/local/bin, and create symlinks, instead of copying --- install | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/install b/install index cf64c1f..c287924 100755 --- a/install +++ b/install @@ -1,12 +1,19 @@ #!/usr/bin/env python -from os.path import expanduser + +import os +import os.path import shutil import sys +home = os.path.expanduser('~') +bindir = os.path.join(home, '/bin/') try: - shutil.copy('./cheat', '/usr/local/bin/') - shutil.copytree('./.cheat', expanduser('~') + '/.cheat') - print "cheat has been installed successfully." + if not os.path.isdir(bindir): + os.path.mkdir(bindir) + os.symlink('./cheat', bindir) + os.symlink('./.cheat', os.path.join(home, '/.cheat')) + print("cheat has been installed successfully.") except IOError as e: - print >> sys.stderr, "This installer must be run as root." - sys.exit(1) + sys.stderr.write("Something went wrong: %s\n" % e) + sys.stderr.write("Your installation may be incomplete!\n") + sys.exit(1)