Reorganization of options printed from usage statement

Option list has become quite large and required some type of
organizational structure.  This is an attempt to provide that.
This commit is contained in:
Heig Gregorian
2012-05-15 20:26:41 -07:00
parent b2a8066d6c
commit 343a43fdfe
+182 -169
View File
@@ -279,13 +279,175 @@ def main():
%prog --help for more information."""
p = optparse.OptionParser(usage=usage)
p.add_option('--verify-options-only', action="store_true", help=optparse.SUPPRESS_HELP)
p.add_option('--file', '-f', action="append",
p.add_option('--version', '-V', action='store_true',
help='Print the version of the munki tools and exit.')
default_options = optparse.OptionGroup(p, 'Default Options',"Options specified will override information derived from the package.")
default_options.add_option('--name',
metavar='NAME',
help='''Optional flag.
Name of the package.''')
default_options.add_option('--displayname',
metavar='DISPLAY_NAME',
help='''Optional flag.
Display name of the package.''')
default_options.add_option('--description',
metavar='STRING|PATH',
help='''Optional flag.
Description of the package.
Can be a PATH to a file (plain text or html).''')
default_options.add_option('--pkgvers',
metavar='PACKAGE_VERSION',
help='''Optional flag.
Version of the package.''')
default_options.add_option('--RestartAction',
metavar='ACTION',
help='''Optional flag.
Specify a 'RestartAction' for the package.
RequireRestart
RequireLogout
RecommendRestart''')
p.add_option_group(default_options)
bool_options = optparse.OptionGroup(p, 'Boolean Options')
bool_options.add_option('--autoremove', action='store_true',
help='''Optional flag.
Implies 'true' for 'autoremove' for the installer item.''')
bool_options.add_option('--unattended_install', '--unattended-install', action='store_true',
help='''Optional flag.
Implies 'true' for 'unattended_install' for the installer item.''')
bool_options.add_option('--unattended_uninstall', '--unattended-uninstall', action='store_true',
help='''Optional flag.
Implies 'true' for 'unattended_uninstall' for the installer item.''')
bool_options.add_option('--installer_choices_xml', '--installer-choices-xml', action='store_true',
help='''Optional flag (Apple metapackages only)
Generate installer choices.
Note: Requires Mac OS X 10.6.6 or later.''')
p.add_option_group(bool_options)
script_options = optparse.OptionGroup(p, 'Script Options')
script_options.add_option('--preinstall_script', '--preinstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an optional preinstall script to be run before
installation of the item. The script will be read and
embedded into the pkginfo.''')
script_options.add_option('--postinstall_script', '--postinstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an optional postinstall script to be run after
installation of the item. The script will be read and
embedded into the pkginfo.''')
script_options.add_option('--preuninstall_script', '--preuninstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an optional preuninstall script to be run before
removal of the item. The script will be read and
embedded into the pkginfo.''')
script_options.add_option('--postuninstall_script', '--postuninstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an optional postuninstall script to be run after
removal of the item. The script will be read and
embedded into the pkginfo.''')
script_options.add_option('--uninstall_script', '--uninstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an uninstall script to be run in order to
uninstall this item. The script will be read and
embedded into the pkginfo.''')
p.add_option_group(script_options)
dragdrop_options = optparse.OptionGroup(p, 'Drag-n-Drop Options')
dragdrop_options.add_option('--itemname', '-i', '--appname', '-a',
metavar='ITEM',
dest='item',
help='''Optional flag.
If the installer item is a disk image with a
drag-and-drop item, ITEMNAME is the name or
relative path of the item to be installed.
Useful if there is more than one item at the
root of the dmg.''')
dragdrop_options.add_option('--destinationpath', '-d',
metavar='PATH',
help='''Optional flag.
If the installer item is a disk image with a
drag-and-drop item, this is the path to which
the item should be copied. Defaults to
"/Applications".''')
dragdrop_options.add_option('-o', '--owner',
metavar='USER',
dest='user',
help='''Optional flag.
If the installer item is a disk image used with
the copy_from_dmg installer type, this sets the
owner of the item specified by the --item flag.
The owner may be either a UID or a symbolic name.
The owner will be set recursively on the item.''')
dragdrop_options.add_option('-g', '--group',
metavar='GROUP',
dest='group',
help='''Optional flag.
If the installer item is a disk image used with
the copy_from_dmg installer type, this sets the
group of the item specified by the --item flag.
The group may be either a GID or a symbolic name.
The group will be set recursively on the item.''')
dragdrop_options.add_option('-m', '--mode',
metavar='MODE',
dest='mode',
action='callback',
type='string',
callback=check_mode,
help='''Optional flag.
If the installer item is a disk used with
the copy_from_dmg installer type, this sets the
mode of the item specified by the --item flag.
The specified mode must be in symbolic form.
See the manpage for chmod(1) for more information.
The mode is applied recursively.''')
p.add_option_group(dragdrop_options)
adobe_options = optparse.OptionGroup(p, 'Adobe Options')
adobe_options.add_option('--uninstallerdmg', '-u',
help='''Optional flag.
If the installer item is a disk image containing an
Adobe CS4 Deployment Toolkit installation package or
Adobe CS3 deployment package, UNINSTALLERDMG is a path
to a disk image containing an AdobeUberUninstaller for
this item.''')
p.add_option_group(adobe_options)
additional_options = optparse.OptionGroup(p, 'Additional Options')
additional_options.add_option('--file', '-f', action="append",
metavar='PATH',
help='''Path to a filesystem item installed by this
package, typically an application. This generates an
"installs" item for the pkginfo, an item munki can
use to determine if this software has been installed.
Can be specified multiple times.''')
p.add_option('--pkgname', '-p',
additional_options.add_option('--pkgname', '-p',
help='''Optional flag.
-If the installer item is a disk image containing
@@ -302,208 +464,59 @@ def main():
If this flag is missing, the AdobeUber* files should
be at the top level of the mounted dmg.''')
p.add_option('--appdmg', action="store_true",
help='''Optional flag.
Causes makepkginfo to create a pkginfo item describing
an appdmg install instead of the newer copy_from_dmg
installer type. Meant for use with older munki
clients, as copy_from_dmg replaces appdmg in munki
0.6.0 and later.''')
p.add_option('--itemname', '-i', '--appname', '-a',
metavar='ITEM',
dest='item',
help='''Optional flag.
If the installer item is a disk image with a
drag-and-drop item, ITEMNAME is the name or
relative path of the item to be installed.
Useful if there is more than one item at the
root of the dmg.''')
p.add_option('--name',
help='''Optional flag.
String name of the package.
Note: Overrides discovered package name''')
p.add_option('--displayname',
help='''Optional flag.
String display name of the package.
Note: Overrides discovered package display_name''')
p.add_option('--description',
metavar='STRING|PATH',
help='''Optional flag.
String description of the package.
Can be a PATH to a file (plain text or html).''')
p.add_option('--pkgvers',
help='''Optional flag.
Specify version for package.
Note: Overrides discovered package version!''')
p.add_option('--autoremove', action='store_true',
help='''Optional flag.
Implies 'true' for 'autoremove' for the installer item.''')
p.add_option('--unattended_install', '--unattended-install', action='store_true',
help='''Optional flag.
Implies 'true' for 'unattended_install' for the installer item.''')
p.add_option('--unattended_uninstall', '--unattended-uninstall', action='store_true',
help='''Optional flag.
Implies 'true' for 'unattended_uninstall' for the installer item.''')
p.add_option('--minimum_os_version', '--minimum-os-version', '--min-os-ver',
additional_options.add_option('--minimum_os_version', '--minimum-os-version', '--min-os-ver',
metavar='VERSION',
help='''Optional flag.
Minimum OS version for the installer item.''')
p.add_option('--maximum_os_version', '--maximum-os-version', '--max-os-ver',
additional_options.add_option('--maximum_os_version', '--maximum-os-version', '--max-os-ver',
metavar='VERSION',
help='''Optional flag.
Maximum OS version for the installer item.''')
p.add_option('--installer_choices_xml', '--installer-choices-xml', action='store_true',
help='''Optional flag
Specify that installer choices should be generated.
Note: Requires Mac OS X 10.6.6 or later.''')
p.add_option('--force_install_after_date', '--force-install-after-date',
additional_options.add_option('--force_install_after_date', '--force-install-after-date',
metavar='yyyy-dd-hhThh:mm:ssZ',
help='''Optional flag.
Specify a date after which the package will be forcefully installed.
Example: '2011-08-03T13:00:00Z' equates to August 3rd 2011 at 1PM.''')
p.add_option('--RestartAction',
metavar='ACTION',
help='''Optional flag.
Specify a 'RestartAction' for the package.
RequireRestart
RequireLogout
RecommendRestart''')
p.add_option('--update_for', '--update-for', '-U', action="append",
metavar='PACKAGE',
additional_options.add_option('--update_for', '--update-for', '-U', action="append",
metavar='PACKAGE_NAME',
help='''Optional flag.
Specifies which package this is an update for.
Can be specified multiple times
to build an array of multiple packages.''')
p.add_option('--requires', '-r', action="append",
metavar='PACKAGE',
additional_options.add_option('--requires', '-r', action="append",
metavar='PACKAGE_NAME',
help='''Optional flag.
Specifies which package this package is requires.
Can be specified multiple times
to build an array of required packages.''')
p.add_option('--blocking_applications', '--blocking-applications', '-b', action="append",
metavar='APPLICATION',
additional_options.add_option('--blocking_applications', '--blocking-applications', '-b', action="append",
metavar='APPLICATION_NAME',
help='''Optional flag.
Specifies a blocking application that will prevent installation.
Can be specified multiple times
to build an array of blocking applications.''')
p.add_option('--notes',
additional_options.add_option('--catalog', '-c', action="append",
metavar='CATALOG_NAME',
help='''Optional flag.
Specifies in which catalog the item should appear. The
default is 'testing'. Can be specified multiple times
to add the item to multiple catalogs.''')
additional_options.add_option('--notes',
metavar='STRING|PATH',
help='''Optional flag.
Specifies administrator provided notes
to be inserted into the pkginfo.
Can be a PATH to a file.''')
p.add_option('--destinationpath', '-d',
help='''Optional flag.
If the installer item is a disk image with a
drag-and-drop item, this is the path to which
the item should be copied. Defaults to
"/Applications".''')
p.add_option('--uninstallerdmg', '-u',
help='''Optional flag.
If the installer item is a disk image containing an
Adobe CS4 Deployment Toolkit installation package or
Adobe CS3 deployment package, UNINSTALLERDMG is a path
to a disk image containing an AdobeUberUninstaller for
this item.''')
p.add_option('--postinstall_script', '--postinstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an optional postinstall script to be run after
installation of the item. The script will be read and
embedded into the pkginfo.''')
p.add_option('--preinstall_script', '--preinstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an optional preinstall script to be run before
installation of the item. The script will be read and
embedded into the pkginfo.''')
p.add_option('--postuninstall_script', '--postuninstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an optional postuninstall script to be run after
removal of the item. The script will be read and
embedded into the pkginfo.''')
p.add_option('--preuninstall_script', '--preuninstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an optional preuninstall script to be run before
removal of the item. The script will be read and
embedded into the pkginfo.''')
p.add_option('--uninstall_script', '--uninstall-script',
metavar='SCRIPT_PATH',
help='''Optional flag.
Path to an uninstall script to be run in order to
uninstall this item. The script will be read and
embedded into the pkginfo.''')
p.add_option('--catalog', '-c', action="append",
help='''Optional flag.
Specifies in which catalog the item should appear. The
default is 'testing'. Can be specified multiple times
to add the item to multiple catalogs.''')
p.add_option('-o', '--owner',
metavar='USER',
dest='user',
help='''Optional flag.
If the installer item is a disk image used with
the copy_from_dmg installer type, this sets the
owner of the item specified by the --item flag.
The owner may be either a UID or a symbolic name.
The owner will be set recursively on the item.''')
p.add_option('-g', '--group',
metavar='GROUP',
dest='group',
help='''Optional flag.
If the installer item is a disk image used with
the copy_from_dmg installer type, this sets the
group of the item specified by the --item flag.
The group may be either a GID or a symbolic name.
The group will be set recursively on the item.''')
p.add_option('-m', '--mode',
metavar='MODE',
dest='mode',
action='callback',
type='string',
callback=check_mode,
help='''Optional flag.
If the installer item is a disk used with
the copy_from_dmg installer type, this sets the
mode of the item specified by the --item flag.
The specified mode must be in symbolic form.
See the manpage for chmod(1) for more information.
The mode is applied recursively.''')
p.add_option('--version', '-V', action='store_true',
help='Print the version of the munki tools and exit.')
p.add_option_group(additional_options)
options, arguments = p.parse_args()