mirror of https://github.com/cheat/cheat.git
install to $HOME/bin instead of /usr/local/bin, and create symlinks, instead of copying
This commit is contained in:
parent
15fd673a51
commit
67cb9c10d4
17
install
17
install
|
@ -1,12 +1,19 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from os.path import expanduser
|
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
home = os.path.expanduser('~')
|
||||||
|
bindir = os.path.join(home, '/bin/')
|
||||||
try:
|
try:
|
||||||
shutil.copy('./cheat', '/usr/local/bin/')
|
if not os.path.isdir(bindir):
|
||||||
shutil.copytree('./.cheat', expanduser('~') + '/.cheat')
|
os.path.mkdir(bindir)
|
||||||
print "cheat has been installed successfully."
|
os.symlink('./cheat', bindir)
|
||||||
|
os.symlink('./.cheat', os.path.join(home, '/.cheat'))
|
||||||
|
print("cheat has been installed successfully.")
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print >> sys.stderr, "This installer must be run as root."
|
sys.stderr.write("Something went wrong: %s\n" % e)
|
||||||
|
sys.stderr.write("Your installation may be incomplete!\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in New Issue