diff --git a/code/client/makepkginfo b/code/client/makepkginfo index 727906f2..f92d716a 100755 --- a/code/client/makepkginfo +++ b/code/client/makepkginfo @@ -193,6 +193,20 @@ def readfile(path): return "" +def readFileOrString(option_value): + """ + If option_value is a path to a file, + return contents of file. + + Otherwise, return the string. + """ + if os.path.exists(os.path.expanduser(option_value)): + string = readfile(option_value) + else: + string = option_value + + return string + def getiteminfo(itempath): """ Gets info for filesystem items passed to makecatalog item, to be used for @@ -311,9 +325,11 @@ def main(): String display name of the package. Note: overrides any display_name in the package itself''') 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). Note: overrides any description in the package itself''') p.add_option('--autoremove', action='store_true', help='''Optional flag. @@ -380,7 +396,7 @@ def main(): Can be specified multiple times to build an array of blocking applications.''') p.add_option('--notes', - metavar='[STRING|PATH]', + metavar='STRING|PATH', help='''Optional flag. Specifies administrator provided notes @@ -558,19 +574,20 @@ def main(): itemsize += int(os.lstat(filename).st_size) # convert to kbytes itemsize = int(itemsize/1024) - + else: print >> sys.stderr, "%s is not an installer package!" % item exit(-1) if options.description: - catinfo['description'] = options.description + catinfo['description'] = readFileOrString(options.description) + if options.displayname: catinfo['display_name'] = options.displayname - + catinfo['installer_item_size'] = int(itemsize/1024) catinfo['installer_item_hash'] = itemhash - + # try to generate the correct item location temppath = item location = "" @@ -689,11 +706,7 @@ def main(): catinfo['uninstall_script'] = scriptstring catinfo['uninstall_method'] = 'uninstall_script' if options.notes: - if os.path.exists(os.path.expanduser(options.notes)): - notesString = readfile(options.notes) - else: - notesString = options.notes - catinfo['notes'] = notesString + catinfo['notes'] = readFileOrString(options.notes) if options.autoremove: catinfo['autoremove'] = True if options.unattended_install: