Skip to content
Snippets Groups Projects
Commit ba8f61c8 authored by echicken's avatar echicken :chicken:
Browse files

Fixed bug in last commit (url_suffix 'master')

Crappy argument parsing.  Command line parameters are now:
-release=sbbs317 -defaults
If -release omitted, 'master' archive will be fetched.
If -defaults specified, installation will proceed without prompts and all default values will be accepted.
parent 6c2814f1
No related branches found
No related tags found
No related merge requests found
const named_parameters = {};
if (argv.length > 0) {
argv.forEach(function (e) {
const m = /-?((\w+)(?:=("[^"]+"|[^\s"]+))?)(?:\s+|$)/.exec(e);
named_parameters[m[2]] = (m[3] ? m[3] : null);
});
}
load('http.js'); load('http.js');
function download(url, target) { function download(url, target) {
...@@ -66,12 +74,15 @@ function set_service_ini(section, obj) { ...@@ -66,12 +74,15 @@ function set_service_ini(section, obj) {
} }
function get_setting(text, value) { function get_setting(text, value) {
if (typeof named_parameters.defaults != 'undefined') return value;
const i = prompt(text + ' [' + value + ']'); const i = prompt(text + ' [' + value + ']');
return (i == '' ? value : i); return (i == '' ? value : i);
} }
function confirm_setting(text, value) { function confirm_setting(text, value) {
if (!value) { if (typeof named_parameters.defaults != 'undefined') {
return value;
} else if (!value) {
return !deny(text + ' [' + value + ']'); return !deny(text + ' [' + value + ']');
} else { } else {
return confirm(text + ' [' + value + ']'); return confirm(text + ' [' + value + ']');
...@@ -116,7 +127,7 @@ function remove_dir(dir) { ...@@ -116,7 +127,7 @@ function remove_dir(dir) {
rmdir(dir); rmdir(dir);
} }
const url_suffix = argc > 0 ? argv[0] : master; const url_suffix = named_parameters.release ? named_parameters.release : 'master';
const zip_url = 'https://codeload.github.com/echicken/synchronet-web-v4/zip/' + url_suffix; const zip_url = 'https://codeload.github.com/echicken/synchronet-web-v4/zip/' + url_suffix;
const download_target = system.temp_dir + 'webv4.zip'; const download_target = system.temp_dir + 'webv4.zip';
const extract_dir = fullpath(system.temp_dir); const extract_dir = fullpath(system.temp_dir);
...@@ -179,7 +190,7 @@ if (system.version_num < 31700) { ...@@ -179,7 +190,7 @@ if (system.version_num < 31700) {
write('\r\nIt is strongly recommended that you back up your BBS before proceeding.\r\n'); write('\r\nIt is strongly recommended that you back up your BBS before proceeding.\r\n');
write('\r\nIf this is a new intallation, you must also shut down your BBS now.\r\n\r\n'); write('\r\nIf this is a new intallation, you must also shut down your BBS now.\r\n\r\n');
if (deny('Proceed with installation/update')) { if (typeof named_parameters.defaults == 'undefined' && deny('Proceed with installation/update')) {
writeln('Install/update aborted. Exiting.'); writeln('Install/update aborted. Exiting.');
exit(); exit();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment