diff options
-rw-r--r-- | scripts/lib/wic/ksparser.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 8c3f80882c..10d0d7c115 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py | |||
@@ -92,6 +92,24 @@ def cannedpathtype(arg): | |||
92 | raise ArgumentTypeError("file not found: %s" % arg) | 92 | raise ArgumentTypeError("file not found: %s" % arg) |
93 | return result | 93 | return result |
94 | 94 | ||
95 | def systemidtype(arg): | ||
96 | """ | ||
97 | Custom type for ArgumentParser | ||
98 | Checks if the argument sutisfies system id requirements, | ||
99 | i.e. if it's one byte long integer > 0 | ||
100 | """ | ||
101 | error = "Invalid system type: %s. must be hex "\ | ||
102 | "between 0x1 and 0xFF" % arg | ||
103 | try: | ||
104 | result = int(arg, 16) | ||
105 | except ValueError: | ||
106 | raise ArgumentTypeError(error) | ||
107 | |||
108 | if result <= 0 or result > 0xff: | ||
109 | raise ArgumentTypeError(error) | ||
110 | |||
111 | return arg | ||
112 | |||
95 | class KickStart(object): | 113 | class KickStart(object): |
96 | """"Kickstart parser implementation.""" | 114 | """"Kickstart parser implementation.""" |
97 | 115 | ||
@@ -121,6 +139,7 @@ class KickStart(object): | |||
121 | part.add_argument('--size', type=sizetype, default=0) | 139 | part.add_argument('--size', type=sizetype, default=0) |
122 | part.add_argument('--source') | 140 | part.add_argument('--source') |
123 | part.add_argument('--sourceparams') | 141 | part.add_argument('--sourceparams') |
142 | part.add_argument('--system-id', type=systemidtype) | ||
124 | part.add_argument('--use-uuid', action='store_true') | 143 | part.add_argument('--use-uuid', action='store_true') |
125 | part.add_argument('--uuid') | 144 | part.add_argument('--uuid') |
126 | 145 | ||