From f7d8250e9d0d0e8e7a8d233a02228d7a56a5a276 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Thu, 20 Sep 2018 10:15:11 -0500 Subject: [PATCH] trivial: standalone: Check argument make sense with command --- contrib/standalone-installer/assets/header.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/standalone-installer/assets/header.py b/contrib/standalone-installer/assets/header.py index c70ecc4a2..058ee3896 100644 --- a/contrib/standalone-installer/assets/header.py +++ b/contrib/standalone-installer/assets/header.py @@ -220,13 +220,17 @@ def run_installation (directory, verbose, uninstall): if __name__ == '__main__': args = parse_args() if 'extract' in args.command: + if args.uninstall: + error ("Uninstall argument doesn't make sense with command %s" % args.command) if args.directory is None: error ("No directory specified") if not os.path.exists (args.directory): print ("Creating %s" % args.directory) os.makedirs (args.directory) unzip (args.directory) - elif 'install' in args.command: + else: + if args.directory: + error ("Directory argument %s doesn't make sense with command %s" % (args.directory, args.command)) if os.getuid() != 0: error ("This tool must be run as root") with tempfile.TemporaryDirectory (prefix='fwupd') as target: