Browse Source

Support for webui_module configuration in the OTA manager

rfm69
Xose Pérez 6 years ago
parent
commit
b56e986e69
4 changed files with 21 additions and 16 deletions
  1. +1
    -1
      code/extra_scripts.py
  2. +2
    -2
      code/gulpfile.js
  3. +13
    -9
      code/ota.py
  4. +5
    -4
      code/package-lock.json

+ 1
- 1
code/extra_scripts.py View File

@ -63,7 +63,7 @@ def build_webui(source, target, env):
config = util.load_project_config() config = util.load_project_config()
kv = dict(config.items("env:" + env.get('PIOENV'))) kv = dict(config.items("env:" + env.get('PIOENV')))
if 'modules' in kv: if 'modules' in kv:
os.environ['MODULES'] = kv["modules"]
os.environ['WEBUI_MODULES'] = kv["modules"]
call(["gulp"]) call(["gulp"])
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------


+ 2
- 2
code/gulpfile.js View File

@ -113,8 +113,8 @@ gulp.task('buildfs_inline', function() {
light: false, light: false,
rfbridge: false rfbridge: false
}; };
var modules = 'MODULES' in process.env ? process.env.MODULES : false;
if (false === modules) {
var modules = 'WEBUI_MODULES' in process.env ? process.env.WEBUI_MODULES : false;
if (false === modules || "all" === modules) {
for (var i in remover_config) { for (var i in remover_config) {
remover_config[i] = true; remover_config[i] = true;
} }


+ 13
- 9
code/ota.py View File

@ -121,7 +121,7 @@ def get_empty_board():
""" """
Returns the empty structure of a board to flash 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 return board
def get_board_by_index(index): def get_board_by_index(index):
@ -230,8 +230,8 @@ def store(device, env):
def run(device, env): def run(device, env):
print("Building and flashing image over-the-air...") 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) subprocess.check_call(command, shell=True)
store(device, env) 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("-f", "--flash", help="flash device", default=0, action='count')
parser.add_argument("-o", "--flags", help="extra flags", default='') parser.add_argument("-o", "--flags", help="extra flags", default='')
parser.add_argument("-p", "--password", help="auth password", 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("-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("-y", "--yes", help="do not ask for confirmation", default=0, action='count')
parser.add_argument("hostnames", nargs='*', help="Hostnames to update") parser.add_argument("hostnames", nargs='*', help="Hostnames to update")
@ -288,6 +289,7 @@ if __name__ == '__main__':
if board: if board:
board['auth'] = args.password board['auth'] = args.password
board['flags'] = args.flags board['flags'] = args.flags
board['modules'] = args.modules
queue.append(board) queue.append(board)
# If no boards ask the user # If no boards ask the user
@ -296,6 +298,7 @@ if __name__ == '__main__':
if board: if board:
board['auth'] = args.password or input("Authorization key of the device to flash: ") 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['flags'] = args.flags or input("Extra flags for the build: ")
board['modules'] = args.modules or input("WebUI modules to build: ")
queue.append(board) queue.append(board)
# If still no boards quit # If still no boards quit
@ -313,12 +316,13 @@ if __name__ == '__main__':
# Summary # Summary
print() 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 response = True
if args.yes == 0: if args.yes == 0:


+ 5
- 4
code/package-lock.json View File

@ -1625,7 +1625,7 @@
}, },
"gulp-csslint": { "gulp-csslint": {
"version": "https://registry.npmjs.org/gulp-csslint/-/gulp-csslint-1.0.1.tgz", "version": "https://registry.npmjs.org/gulp-csslint/-/gulp-csslint-1.0.1.tgz",
"integrity": "sha1-ESqQj3rvmO/Ce3vQCAHxOne+y5M=",
"integrity": "sha512-Rec56+RpCGg7feK3d/S45oqgxyLV3end0ed+UjWFv6YziQae2Bp4DNSDobwEvJdfCAsOhOSExEEB+jcfMx430w==",
"dev": true, "dev": true,
"requires": { "requires": {
"csslint": "https://registry.npmjs.org/csslint/-/csslint-1.0.5.tgz", "csslint": "https://registry.npmjs.org/csslint/-/csslint-1.0.5.tgz",
@ -1648,7 +1648,7 @@
}, },
"plugin-error": { "plugin-error": {
"version": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", "version": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz",
"integrity": "sha1-dwFr2JGdCsN3/c3QMiMolTyleBw=",
"integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-colors": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", "ansi-colors": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",
@ -1704,8 +1704,9 @@
} }
}, },
"gulp-htmllint": { "gulp-htmllint": {
"version": "https://registry.npmjs.org/gulp-htmllint/-/gulp-htmllint-0.0.14.tgz",
"integrity": "sha1-fobrpgVmjfsVstLVAZX+VqdVhaI=",
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/gulp-htmllint/-/gulp-htmllint-0.0.14.tgz",
"integrity": "sha512-D5FfR2G4SUwxPd/ypE5glZSXXddl3bnGz9JlY3gS5e8AXSvYJco+baIWtpT8fq5aqyr5IELf2I+VgCe6b+yq1A==",
"dev": true, "dev": true,
"requires": { "requires": {
"gulp-util": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz", "gulp-util": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz",


Loading…
Cancel
Save