[reagent/activator] fix options parsing issue

This commit is contained in:
Fabio Erculiani
2009-11-21 13:31:28 +01:00
parent 885ccde73c
commit ecca56ef5b
2 changed files with 16 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python2 -O
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayonlinux.org>
@@ -73,13 +74,6 @@ if (' '.join(options).find("--version") != -1) or (' '.join(options).find(" -V")
print_generic("activator: "+etpConst['entropyversion'])
raise SystemExit(0)
# print help
if len(options) < 1 or ' '.join(options).find("--help") != -1 or ' '.join(options).find(" -h") != -1:
print_menu(myopts)
if len(options) < 1:
print_error("not enough parameters")
raise SystemExit(1)
import re
opt_r = re.compile("^(\\-)([a-z]+)$")
for n in range(len(options)):
@@ -105,6 +99,13 @@ for opt in options:
_options.append(opt)
options = _options
# print help
if len(options) < 1 or ' '.join(options).find("--help") != -1 or ' '.join(options).find(" -h") != -1:
print_menu(myopts)
if len(options) < 1:
print_error("not enough parameters")
raise SystemExit(1)
rc = 1
if not entropyTools.is_root():
print_error("you must be root in order to run activator")

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python2 -O
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayonlinux.org>
@@ -116,13 +117,6 @@ if (' '.join(options).find("--version") != -1) or (' '.join(options).find(" -V")
print_generic("reagent: "+etpConst['entropyversion'])
raise SystemExit(0)
# print help
if len(options) < 1 or ' '.join(options).find("--help") != -1 or ' '.join(options).find(" -h") != -1:
print_menu(myopts)
if len(options) < 1:
print_error("not enough parameters")
raise SystemExit(1)
import re
opt_r = re.compile("^(\\-)([a-z]+)$")
for n in range(len(options)):
@@ -148,6 +142,13 @@ for opt in options:
_options.append(opt)
options = _options
# print help
if len(options) < 1 or ' '.join(options).find("--help") != -1 or ' '.join(options).find(" -h") != -1:
print_menu(myopts)
if len(options) < 1:
print_error("not enough parameters")
raise SystemExit(1)
rc = 1
if not entropyTools.is_root():
print_error("you must be root in order to run "+sys.argv[0])