Beispiel #1
0
def main():
    '''Used when calling removepackages.py directly from the command line.'''
    # command-line options
    parser = optparse.OptionParser()
    parser.set_usage('''Usage: %prog [options] package_id ...''')
    parser.add_option('--forcedeletebundles', '-f', action='store_true',
                      help='Delete bundles even if they aren\'t empty.')
    parser.add_option('--listfiles', '-l', action='store_true',
                      help='List the filesystem objects to be removed, '
                      'but do not actually remove them.')
    parser.add_option('--rebuildpkgdb', action='store_true',
                      help='Force a rebuild of the internal package database.')
    parser.add_option('--noremovereceipts', action='store_true',
                      help='''Do not remove receipts and boms from
                      /Library/Receipts and update internal package
                      database.''')
    parser.add_option('--noupdateapplepkgdb', action='store_true',
                      help='Do not update Apple\'s package database. '
                      'If --noremovereceipts is also given, this is implied')
    parser.add_option('--munkistatusoutput', '-m', action='store_true',
                      help='Output is formatted for use with MunkiStatus.')
    parser.add_option('--verbose', '-v', action='count', default=1,
                      help='More verbose output. May be specified multiple '
                      'times.')

    # Get our options and our package names
    options, pkgnames = parser.parse_args()

    # check to see if we're root
    if os.geteuid() != 0:
        munkicommon.display_error("You must run this as root!")
        exit(-1)

    # set the munkicommon globals
    munkicommon.munkistatusoutput = options.munkistatusoutput
    munkicommon.verbose = options.verbose

    if options.munkistatusoutput:
        pkgcount = len(pkgnames)
        munkistatus.message("Removing %s packages..." % pkgcount)
        munkistatus.detail("")

    retcode = removepackages(pkgnames,
                             forcedeletebundles=options.forcedeletebundles,
                             listfiles=options.listfiles,
                             rebuildpkgdb=options.rebuildpkgdb,
                             noremovereceipts=options.noremovereceipts,
                             noupdateapplepkgdb=options.noupdateapplepkgdb)
    if options.munkistatusoutput:
        munkistatus.quit()
    exit(retcode)
Beispiel #2
0
def main():
    '''Used when calling removepackages.py directly from the command line.'''
    # command-line options
    p = optparse.OptionParser()
    p.set_usage('''Usage: %prog [options] package_id ...''')
    p.add_option('--forcedeletebundles', '-f', action='store_true',
                    help='Delete bundles even if they aren\'t empty.')
    p.add_option('--listfiles', '-l', action='store_true',
                    help='''List the filesystem objects to be removed,
                    but do not actually remove them.''')
    p.add_option('--rebuildpkgdb', action='store_true',
                    help='Force a rebuild of the internal package database.')
    p.add_option('--noremovereceipts', action='store_true',
                    help='''Do not remove receipts and boms from
                    /Library/Receipts and update internal package
                    database.''')
    p.add_option('--noupdateapplepkgdb', action='store_true',
                    help='''Do not update Apple\'s package database.
                    If --noremovereceipts is also given, this is implied''')
    p.add_option('--munkistatusoutput', '-m', action='store_true',
                    help='Output is formatted for use with MunkiStatus.')
    p.add_option('--verbose', '-v', action='count', default=1,
                    help='''More verbose output. May be specified multiple
                    times.''')

    # Get our options and our package names
    options, pkgnames = p.parse_args()

    # check to see if we're root
    if os.geteuid() != 0:
        munkicommon.display_error("You must run this as root!")
        exit(-1)

    # set the munkicommon globals
    munkicommon.munkistatusoutput = options.munkistatusoutput
    munkicommon.verbose = options.verbose

    if options.munkistatusoutput:
        pkgcount = len(pkgnames)
        munkistatus.message("Removing %s packages..." % pkgcount)
        munkistatus.detail("")

    retcode = removepackages(pkgnames,
                             forcedeletebundles=options.forcedeletebundles,
                             listfiles=options.listfiles,
                             rebuildpkgdb=options.rebuildpkgdb,
                             noremovereceipts=options.noremovereceipts,
                             noupdateapplepkgdb=options.noupdateapplepkgdb)
    if options.munkistatusoutput:
        munkistatus.quit()
    exit(retcode)
Beispiel #3
0
def main():
    """Used when calling removepackages.py directly from the command line."""
    # command-line options
    parser = optparse.OptionParser()
    parser.set_usage("""Usage: %prog [options] package_id ...""")
    parser.add_option(
        "--forcedeletebundles", "-f", action="store_true", help="Delete bundles even if they aren't empty."
    )
    parser.add_option(
        "--listfiles",
        "-l",
        action="store_true",
        help="List the filesystem objects to be removed, " "but do not actually remove them.",
    )
    parser.add_option("--rebuildpkgdb", action="store_true", help="Force a rebuild of the internal package database.")
    parser.add_option(
        "--noremovereceipts",
        action="store_true",
        help="""Do not remove receipts and boms from
                      /Library/Receipts and update internal package
                      database.""",
    )
    parser.add_option(
        "--noupdateapplepkgdb",
        action="store_true",
        help="Do not update Apple's package database. " "If --noremovereceipts is also given, this is implied",
    )
    parser.add_option(
        "--munkistatusoutput", "-m", action="store_true", help="Output is formatted for use with MunkiStatus."
    )
    parser.add_option(
        "--verbose", "-v", action="count", default=1, help="More verbose output. May be specified multiple " "times."
    )

    # Get our options and our package names
    options, pkgnames = parser.parse_args()

    # check to see if we're root
    if os.geteuid() != 0:
        munkicommon.display_error("You must run this as root!")
        exit(-1)

    # set the munkicommon globals
    munkicommon.munkistatusoutput = options.munkistatusoutput
    munkicommon.verbose = options.verbose

    if options.munkistatusoutput:
        pkgcount = len(pkgnames)
        munkistatus.message("Removing %s packages..." % pkgcount)
        munkistatus.detail("")

    retcode = removepackages(
        pkgnames,
        forcedeletebundles=options.forcedeletebundles,
        listfiles=options.listfiles,
        rebuildpkgdb=options.rebuildpkgdb,
        noremovereceipts=options.noremovereceipts,
        noupdateapplepkgdb=options.noupdateapplepkgdb,
    )
    if options.munkistatusoutput:
        munkistatus.quit()
    exit(retcode)