1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-09 22:06:47 +00:00

Pimping tclcheck.py.

This commit is contained in:
Markus Birth 2017-12-27 00:35:00 +01:00
parent 42b499290c
commit 6afefd5c63
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A

View File

@ -9,28 +9,42 @@ import sys
import tcllib import tcllib
fc = tcllib.FotaCheck() fc = tcllib.FotaCheck()
fc.cltp = fc.CLTP.MOBILE
fc.serid = "3531510" fc.serid = "3531510"
#fc.osvs = "7.1.1" #fc.osvs = "7.1.1"
dp = tcllib.DefaultParser(__file__) dp = tcllib.DefaultParser(__file__)
dp.add_argument("prd", nargs="?", default="AAM481") dp.description = """
dp.add_argument("fvver", nargs="?", default="PRD-63117-011") Checks for the latest FULL updates for the specified PRD number or for an OTA from the
version specified as fvver.
"""
dp.add_argument("prd", nargs=1, help="CU Reference #, e.g. PRD-63117-011")
dp.add_argument("fvver", nargs="?", help="Firmware version to check for updates, e.g. AAM481", default="AAA000")
dp.add_argument("--mode", help="type of update to check for (auto, full, ota), defaults to auto", default="auto")
dp.add_argument("--type", help="type of check to run (auto, desktop, mobile), defaults to auto", default="auto")
args = dp.parse_args(sys.argv[1:]) args = dp.parse_args(sys.argv[1:])
if len(sys.argv) == 3: # python tclcheck.py $PRD $FV = OTA delta for $PRD from $FV def sel_mode(txtmode, autoval):
fc.curef = args.prd if txtmode == "auto":
fc.fv = args.fvver return autoval
fc.mode = fc.MODE.OTA elif txtmode == "ota":
elif len(sys.argv) == 2: # python tclcheck.py $PRD = FULL for $PRD return fc.MODE.OTA
fc.curef = args.prd return fc.MODE.FULL
fc.fv = "AAA000"
fc.mode = fc.MODE.FULL def sel_cltp(txtmode, autoval):
fc.cltp = fc.CLTP.DESKTOP if txtmode == "auto":
else: # python tclcheck.py = OTA for default PRD, FV return autoval
fc.curef = "PRD-63117-011" elif txtmode == "desktop":
fc.fv = "AAM481" return fc.CLTP.DESKTOP
fc.mode = fc.MODE.OTA return fc.CLTP.MOBILE
fc.curef = args.prd[0]
fc.fv = args.fvver
if args.fvver == "AAA000":
fc.mode = sel_mode(args.mode, fc.MODE.FULL)
fc.cltp = sel_cltp(args.type, fc.CLTP.DESKTOP)
else:
fc.mode = sel_mode(args.mode, fc.MODE.OTA)
fc.cltp = sel_cltp(args.type, fc.CLTP.MOBILE)
check_xml = fc.do_check() check_xml = fc.do_check()
print(fc.pretty_xml(check_xml)) print(fc.pretty_xml(check_xml))