if [ -n "\$(command -v unzip)" ]; then
my_ext="zip,\$my_ext"
fi
+# for mac/linux 'exe' refers to the uncompressed binary without extension
+my_ext="exe,\$my_ext"
if [ -n "\$(command -v tar)" ]; then
my_ext="tar,\$my_ext"
fi
's390x'
];
var archMap = {
- amd64: /(amd.?64|x64|[_\-]64)/i,
- x86: /(86)(\b|_)/i,
+ //amd64: /(amd.?64|x64|[_\-]64)/i,
+ amd64: /(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)64(\b|_)/i,
+ //x86: /(86)(\b|_)/i,
+ x86: /(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)(86|32)(\b|_)/i,
ppc64le: /(\b|_)(ppc64le)/i,
ppc64: /(\b|_)(ppc64)(\b|_)/i,
arm64: /(\b|_)(arm64|arm)/i,
// pkg-v1.0.tar.gz => ['gz', 'tar', '0', 'pkg-v1']
// pkg-v1.0.tar => ['tar', '0' ,'pkg-v1']
// pkg-v1.0.zip => ['zip', '0', 'pkg-v1']
- var exts = (rel.name || rel.download).split('.').reverse().slice(0, 2);
- var ext;
+ var exts = (rel.name || rel.download).split('.');
+ if (1 === exts.length) {
+ // for bare releases in the format of foo-linux-amd64
+ rel.ext = 'exe';
+ }
+ exts = exts.reverse().slice(0, 2);
if ('tar' === exts[1]) {
rel.ext = exts.reverse().join('.');
} else if ('tgz' == exts[0]) {
} else {
rel.ext = exts[0];
}
+ if (/\-|linux|mac|os[_\-]?x|arm|amd|86|64|mip/i.test(rel.ext)) {
+ // for bare releases in the format of foo.linux-amd64
+ rel.ext = 'exe';
+ }
}
supported.formats[rel.ext] = true;
echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE"
unzip "$HOME/Downloads/$WEBI_PKG_FILE" > __unzip__.log
elif [ "exe" == "$WEBI_EXT" ]; then
- # do nothing (but don't leave an empty if block either)
- true
+ echo "Moving $HOME/Downloads/$WEBI_PKG_FILE"
+ mv "$HOME/Downloads/$WEBI_PKG_FILE" .
elif [ "xz" == "$WEBI_EXT" ]; then
echo "Inflating $HOME/Downloads/$WEBI_PKG_FILE"
unxz -c "$HOME/Downloads/$WEBI_PKG_FILE" > $(basename "$WEBI_PKG_FILE")
pkg_dst_cmd="${pkg_dst_cmd:-$HOME/.local/bin/$pkg_cmd_name}"
pkg_dst="$pkg_dst_cmd" # "$(dirname "$(dirname $pkg_dst_cmd)")"
- pkg_src_cmd="${pkg_src_cmd:-$HOME/.local/xbin/$pkg_cmd_name-$WEBI_VERSION}"
+ pkg_src_cmd="${pkg_src_cmd:-$HOME/.local/xbin/$pkg_cmd_name-v$WEBI_VERSION}"
pkg_src="$pkg_src_cmd" # "$(dirname "$(dirname $pkg_src_cmd)")"
else
pkg_dst="${pkg_dst:-$HOME/.local/opt/$pkg_cmd_name}"
{
New-Item -Path .local\bin -ItemType Directory
}
+if (!(Test-Path -Path .local\xbin))
+{
+ New-Item -Path .local\xbin -ItemType Directory
+}
Set-Content -Path .local\bin\webi.bat -Value "@echo off`r`npushd %USERPROFILE%`r`npowershell -ExecutionPolicy Bypass .local\bin\webi.ps1 %1`r`npopd"
if (!(Test-Path -Path .local\opt))
{
# Fetch <whatever>.ps1
# TODO detect formats
-# Invoke-WebRequest -UserAgent "Windows amd64" "$Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,tar" -OutFile ".\.local\tmp\$exename.install.ps1"
-echo "Downloading $Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,tar"
-& curl.exe -fsSL -A "$Env:WEBI_UA" "$Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,tar" -o .\.local\tmp\$exename.install.ps1
+$PKG_URL = "$Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,exe,tar"
+echo "Downloading $PKG_URL"
+# Invoke-WebRequest -UserAgent "Windows amd64" "$PKG_URL" -OutFile ".\.local\tmp\$exename.install.ps1"
+& curl.exe -fsSL -A "$Env:WEBI_UA" "$PKG_URL" -o .\.local\tmp\$exename.install.ps1
# Run <whatever>.ps1
powershell .\.local\tmp\$exename.install.ps1