rel,
{ baseurl, pkg, tag, ver, os, arch, formats }
) {
+ if (!Array.isArray(formats)) {
+ formats = [];
+ }
+ if (!tag) {
+ tag = '';
+ }
return fs.promises
.readFile(path.join(pkgdir, 'install.sh'), 'utf8')
.then(function (installTxt) {
.replace(/^#?WEBI_HOST=.*/m, "WEBI_HOST='" + baseurl + "'")
.replace(/^#?WEBI_OS=.*/m, "WEBI_OS='" + (os || '') + "'")
.replace(/^#?WEBI_ARCH=.*/m, "WEBI_ARCH='" + (arch || '') + "'")
- .replace(/^#?WEBI_TAG=.*/m, "WEBI_TAG='" + (tag || '') + "'")
+ .replace(/^#?WEBI_TAG=.*/m, "WEBI_TAG='" + tag + "'")
.replace(
/^#?WEBI_RELEASES=.*/m,
"WEBI_RELEASES='" +
rel.os +
'&arch=' +
rel.arch +
+ '&formats=' +
+ formats.join(',') +
'&pretty=true' +
"'"
)
/^#?WEBI_EXT=.*/m,
'WEBI_EXT=' + rel.ext.replace(/tar.*/, 'tar')
)
+ .replace(
+ /^#?WEBI_FORMATS=.*/m,
+ "WEBI_FORMATS='" + formats.join(',') + "'"
+ )
.replace(
/^#?WEBI_PKG_URL=.*/m,
"WEBI_PKG_URL='" + rel.download + "'"