def factory_default(targets="*", do_reboot=True): e = xt_func.sudo(["cp -r", const.MIDWARE_DIR+"factory_default/"+targets, const.CFG_DIR]) if not e[0]: return e if do_reboot: xt_func.reboot("Reboot now") return (True, [N_("Reboot now")]) return (True, [])
def firmware_downgrade(fwdownfile): ret = True emsg = [] e = xt_func.sudo(["apply_downgrade ",fwdownfile]) xt_func.sudo(["rm -rf",fwdownfile]) # firmeare downgrade failed return error message if not e[0]: ret = False emsg.append(e[1]) return (ret, emsg) #reboot command xt_func.reboot("reboot after firmware downgrade") return (ret, emsg)
def firmware_update(updatekey, fwupfile): ret = True emsg = [] e = xt_func.sudo(["apply_update ",fwupfile," ",updatekey]) xt_func.sudo(["rm -rf",fwupfile]) # firmeare update failed return error message if not e[0]: ret = False emsg.append(e[1]) return (ret, emsg) #reboot command xt_func.reboot("reboot after firmware update") return (ret, emsg)
def reboot(): xt_func.reboot("reboot by webUI") return (True, [N_("Reboot now")])