#!/usr/bin/env python ''' Created on Jul 9, 2009 @author: warren sudo checkinstall --maintainer 'warren-picfs@warrenfalk.com' --requires 'python-fuse' ./install.py ''' import os import sys def main(): if os.getuid() != 0: print "" print "" print " ************************" print " ** WARNING: NOT ROOT! **" print " ************************" print "" print "" if ("--nocheckinstall" in sys.argv) or (not checkinstall_is_installed()) or ("checkinstall" in os.environ.get("LD_PRELOAD", "")): makedirs("/usr/lib/python2.6/dist-packages/") os.rename("./src/picfs.py", "/usr/lib/python2.6/dist-packages/picfs.py") link("../lib/python2.6/dist-packages/picfs.py", "/usr/bin/picfs") else: command = "sudo checkinstall --maintainer 'warren-picfs@warrenfalk.com' --requires 'python-fuse' %s --nocheckinstall" % sys.argv[0] print command os.system(command) def makedirs(path): if not os.path.isdir(path): os.makedirs(path) def link(frm, to): os.symlink(frm, to) def checkinstall_is_installed(): return 0 == os.system('which checkinstall > /dev/null') if __name__ == '__main__': main()