Hello, I want to execute some command before doing sysupgrade, so I add some command before fs.exec('/sbin/sysupgrade', opts); to test, the function like
function handleSysupgradeConfirm(btn, keep, force, ev) {
// btn.firstChild.data = _('Flashing…');
btn.value = _('Flashing…');
L.require('ui').then(function(ui) {
ui.showModal(_('Flashing…'), [
E('p', { 'class': 'spinning' }, _('The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.'))
]);
});
var opts = [];
if (!keep.checked)
opts.push('-n');
if (force.checked)
opts.push('--force');
opts.push('/tmp/firmware.bin');
L.require('fs').then(function(fs) {
/* Currently the sysupgrade rpc call will not return, hence no promise handling */
fs.exec('/bin/echo', [ 'abc', '>', '/tmp/upgrade_status' ]);
//fs.exec('/sbin/sysupgrade', opts);
});
L.require('ui').then(function(ui) {
if (keep.checked)
ui.awaitReconnect(window.location.host);
else
ui.awaitReconnect('192.168.0.1', 'openwrt.lan');
});
}
I tried echo to file
fs.exec('/bin/echo', [ 'abc', '>', '/tmp/upgrade_status' ]);
but the command doesn't execute, and GUI not display any errors. Any ideas or what can I do to verify this issue? Sorry I am not familiar with js/luci...