6 #WEBI_HOST=https://webinstall.dev
8 mkdir -p "$HOME/.local/bin"
10 cat << EOF > "$HOME/.local/bin/webi"
17 if [ -z "\$my_package" ]; then
18 echo "Usage: webi <package>@<version>"
19 echo "Example: webi node@latest"
24 ## Detect acceptable package formats
29 if [ -n "\$(command -v git)" ]; then
32 if [ -n "\$(command -v tar)" ]; then
35 if [ -n "\$(command -v unzip)" ]; then
38 if [ -n "\$(command -v pkgutil)" ]; then
41 # disable this check for the sake of building the macOS installer on Linux
42 #if [ -n "\$(command -v diskutil)" ]; then
43 # note: could also detect via hdiutil
46 my_ext="\$(echo "\$my_ext" | sed 's/,$//')" # nix trailing comma
53 export WEBI_CURL="\$(command -v curl)"
54 export WEBI_WGET="\$(command -v wget)"
57 export WEBI_BOOT="\$(mktemp -d -t "\$my_package-bootstrap.XXXXXXXX")"
58 export WEBI_HOST="\${WEBI_HOST:-https://webinstall.dev}"
59 export WEBI_UA="\$(uname -a)"
61 my_installer_url="\$WEBI_HOST/api/installers/\$my_package.bash?formats=\$my_ext"
62 if [ -n "\$WEBI_CURL" ]; then
63 curl -fsSL "\$my_installer_url" -H "User-Agent: curl \$WEBI_UA" \\
64 -o "\$WEBI_BOOT/\$my_package-bootstrap.sh"
66 wget -q "\$my_installer_url" --user-agent="wget \$WEBI_UA" \\
67 -O "\$WEBI_BOOT/\$my_package-bootstrap.sh"
70 pushd "\$WEBI_BOOT" 2>&1 > /dev/null
71 bash "\$my_package-bootstrap.sh"
77 chmod a+x "$HOME/.local/bin/webi"
79 if [ -n "${WEBI_PKG:-}" ]; then
80 "$HOME/.local/bin/webi" "${WEBI_PKG}"