mirror of
https://github.com/srlabs/blue-merle.git
synced 2024-12-22 13:55:00 -05:00
python: Added a --generate-only flag to not set the IMEI
We can probably set the IMEI through the gl_modem command. Currently, the Web interface times out when calling random-imei. I want to separate the steps so that each step does not take as long.
This commit is contained in:
parent
53bf156fd0
commit
11a8afd0a9
@ -17,6 +17,8 @@ class Modes(Enum):
|
|||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
ap.add_argument("-v", "--verbose", help="Enables verbose output",
|
ap.add_argument("-v", "--verbose", help="Enables verbose output",
|
||||||
action="store_true")
|
action="store_true")
|
||||||
|
ap.add_argument("-g", "--generate-only", help="Only generates an IMEI rather than setting it",
|
||||||
|
action="store_true")
|
||||||
modes = ap.add_mutually_exclusive_group()
|
modes = ap.add_mutually_exclusive_group()
|
||||||
modes.add_argument("-d", "--deterministic", help="Switches IMEI generation to deterministic mode", action="store_true")
|
modes.add_argument("-d", "--deterministic", help="Switches IMEI generation to deterministic mode", action="store_true")
|
||||||
modes.add_argument("-s", "--static", help="Sets user-defined IMEI",
|
modes.add_argument("-s", "--static", help="Sets user-defined IMEI",
|
||||||
@ -201,6 +203,7 @@ if __name__ == '__main__':
|
|||||||
imei = generate_imei(imei_prefix, imsi_d)
|
imei = generate_imei(imei_prefix, imsi_d)
|
||||||
if (verbose):
|
if (verbose):
|
||||||
print(f"Generated new IMEI: {imei}")
|
print(f"Generated new IMEI: {imei}")
|
||||||
|
if not args.generate_only:
|
||||||
if not set_imei(imei):
|
if not set_imei(imei):
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user