Пример #1
0
def installPackagesInDir(dirpath):
    # Check for the existence of OS-specific directory name?
    os_specific_dir = os.path.join(dirpath, util.getOsxVersionName())
    #print "Checking for directory %s" % os_specific_dir
    # If there's a specific subdirectory for this version of OS X, use it
    if os.path.exists(os_specific_dir):
        dirpath = os_specific_dir
    print "Attempting to run installer on %s" % dirpath
    for f in os.listdir(dirpath):
        if f.endswith('.dmg') and not f.startswith('.'):
            print "Found a dmg at: %s" % os.path.join(dirpath, f)
            result = munkilib.installer.copyAppFromDMG(os.path.join(dirpath, f)) 
            if result == -2:
                # Failed to find an app, let's try a package instead
                # FIXME: Right now, I don't think this works
                retcode, reboot = munkilib.installer.installall(dirpath)
Пример #2
0
def main(argv = sys.argv):
    # Get OS version
    print "OS X Version appears to be: %s" % util.getOsxVersionName()

    signal.signal(signal.SIGINT, signal_handler)

    # We install different things depending on whether or not
    # the script has been run as root.
    isRoot = (os.geteuid() == 0)

    if isRoot:
        print "##### RUNNING AS SUPERUSER #####"
        # Stuff to be done as superuser
        print "* Disabling Spotlight: ",
        disableSpotlight()
        print "[DONE]"

        # Install Apple updates
        print "* Installing Apple Updates: ",
        installAppleUpdates()
        #os.system("softwareupdate -i -a")
        print "[DONE]"

        # Install the apps
        print "* Installing other programs: ",
        print glob.glob(os.path.join(AUTOINSTDIR, "*"))
        for entry in glob.glob(os.path.join(AUTOINSTDIR, "*")):
            if os.path.isdir(entry):
                print "******"
                print entry
                print "******"
                installPackagesInDir(entry)
        print "[DONE]"

    else:
        # Stuff to be done as regular user
        # Install Gentoo Prefix
        print "##### Running as user TODO #####"
        print "* Bootstrapping Gentoo Prefix"
        #util.gentoo.bootstrapGentooPrefix(PORTAGEDIR)

        # Copy and install appropriate profiles
        util.profiles.setupProfiles(PROFILEDIR,PORTAGEDIR)
        return