Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (33 sloc) 1.01 kb
#/usr/bin/python
#coding=utf8
import os
import sys
def authenticate():
'''Prompt the user for the superuser password if required.'''
# The euid (effective user id) of the superuser is 0.
euid = os.geteuid()
if euid != 0:
args = ['sudo', '-E', sys.executable] + sys.argv[:] + [os.environ]
# Replaces the current running process with the sudo authentication.
os.execlpe('sudo', *args)
return True
def setup():
'''Install drake.'''
authenticate()
os.system('rm -rf ~/.drake')
os.system('cp -Rf ../drake/ ~/.drake')
os.system('chmod +x ~/.drake/drake.py')
os.system('ln -fs ~/.drake/drake.py /usr/bin/drake')
def remove():
'''Uninstall drake.'''
authenticate()
os.system('rm -rf ~/.drake')
os.system('rm -f /usr/bin/drake')
def main():
if len(sys.argv) > 1:
if sys.argv[1] == 'install':
setup()
elif sys.argv[1] == 'uninstall':
remove()
if __name__ == '__main__':
main()
Jump to Line
Something went wrong with that request. Please try again.