|
|
@ -121,7 +121,7 @@ def get_empty_board(): |
|
|
|
""" |
|
|
|
Returns the empty structure of a board to flash |
|
|
|
""" |
|
|
|
board = {'board': '', 'ip': '', 'size': 0, 'auth': '', 'flags': ''} |
|
|
|
board = {'board': '', 'ip': '', 'size': 0, 'auth': '', 'flags': '', 'modules': ''} |
|
|
|
return board |
|
|
|
|
|
|
|
def get_board_by_index(index): |
|
|
@ -230,8 +230,8 @@ def store(device, env): |
|
|
|
|
|
|
|
def run(device, env): |
|
|
|
print("Building and flashing image over-the-air...") |
|
|
|
command = "export ESPURNA_IP=\"%s\"; export ESPURNA_BOARD=\"%s\"; export ESPURNA_AUTH=\"%s\"; export ESPURNA_FLAGS=\"%s\"; platformio run --silent --environment %s -t upload" |
|
|
|
command = command % (device['ip'], device['board'], device['auth'], device['flags'], env) |
|
|
|
command = "ESPURNA_IP=\"%s\" ESPURNA_BOARD=\"%s\" ESPURNA_AUTH=\"%s\" ESPURNA_FLAGS=\"%s\" WEBUI_MODULES=\"%s\" platformio run --environment %s -t upload" |
|
|
|
command = command % (device['ip'], device['board'], device['auth'], device['flags'], device['modules'], env) |
|
|
|
subprocess.check_call(command, shell=True) |
|
|
|
store(device, env) |
|
|
|
|
|
|
@ -245,6 +245,7 @@ if __name__ == '__main__': |
|
|
|
parser.add_argument("-f", "--flash", help="flash device", default=0, action='count') |
|
|
|
parser.add_argument("-o", "--flags", help="extra flags", default='') |
|
|
|
parser.add_argument("-p", "--password", help="auth password", default='') |
|
|
|
parser.add_argument("-m", "--modules", help="webui modules", default='') |
|
|
|
parser.add_argument("-s", "--sort", help="sort devices list by field", default='hostname') |
|
|
|
parser.add_argument("-y", "--yes", help="do not ask for confirmation", default=0, action='count') |
|
|
|
parser.add_argument("hostnames", nargs='*', help="Hostnames to update") |
|
|
@ -288,6 +289,7 @@ if __name__ == '__main__': |
|
|
|
if board: |
|
|
|
board['auth'] = args.password |
|
|
|
board['flags'] = args.flags |
|
|
|
board['modules'] = args.modules |
|
|
|
queue.append(board) |
|
|
|
|
|
|
|
# If no boards ask the user |
|
|
@ -296,6 +298,7 @@ if __name__ == '__main__': |
|
|
|
if board: |
|
|
|
board['auth'] = args.password or input("Authorization key of the device to flash: ") |
|
|
|
board['flags'] = args.flags or input("Extra flags for the build: ") |
|
|
|
board['modules'] = args.modules or input("WebUI modules to build: ") |
|
|
|
queue.append(board) |
|
|
|
|
|
|
|
# If still no boards quit |
|
|
@ -313,12 +316,13 @@ if __name__ == '__main__': |
|
|
|
|
|
|
|
# Summary |
|
|
|
print() |
|
|
|
print("HOST = %s" % boardname(board)) |
|
|
|
print("IP = %s" % board['ip']) |
|
|
|
print("BOARD = %s" % board['board']) |
|
|
|
print("AUTH = %s" % board['auth']) |
|
|
|
print("FLAGS = %s" % board['flags']) |
|
|
|
print("ENV = %s" % env) |
|
|
|
print("HOST = %s" % boardname(board)) |
|
|
|
print("IP = %s" % board['ip']) |
|
|
|
print("BOARD = %s" % board['board']) |
|
|
|
print("AUTH = %s" % board['auth']) |
|
|
|
print("FLAGS = %s" % board['flags']) |
|
|
|
print("MODULES = %s" % board['modules']) |
|
|
|
print("ENV = %s" % env) |
|
|
|
|
|
|
|
response = True |
|
|
|
if args.yes == 0: |
|
|
|