6 #WEBI_HOST=https://webinstall.dev
9 mkdir -p "$HOME/.local/bin"
11 cat << EOF > "$HOME/.local/bin/webi"
18 if [ -z "\$my_package" ]; then
19 echo "Usage: webi <package>@<version>"
20 echo "Example: webi node@latest"
25 ## Detect acceptable package formats
30 # NOTE: the order here is least favorable to most favorable
31 if [ -n "\$(command -v pkgutil)" ]; then
34 # disable this check for the sake of building the macOS installer on Linux
35 #if [ -n "\$(command -v diskutil)" ]; then
36 # note: could also detect via hdiutil
39 if [ -n "\$(command -v git)" ]; then
42 if [ -n "\$(command -v unzip)" ]; then
45 if [ -n "\$(command -v unzip)" ]; then
48 if [ -n "\$(command -v tar)" ]; then
51 my_ext="\$(echo "\$my_ext" | sed 's/,$//')" # nix trailing comma
58 export WEBI_CURL="\$(command -v curl)"
59 export WEBI_WGET="\$(command -v wget)"
62 export WEBI_BOOT="\$(mktemp -d -t "\$my_package-bootstrap.XXXXXXXX")"
63 export WEBI_HOST="\${WEBI_HOST:-https://webinstall.dev}"
64 export WEBI_UA="\$(uname -a)"
66 my_installer_url="\$WEBI_HOST/api/installers/\$my_package.bash?formats=\$my_ext"
68 if [ -n "\$WEBI_CURL" ]; then
69 curl -fsSL "\$my_installer_url" -H "User-Agent: curl \$WEBI_UA" \\
70 -o "\$WEBI_BOOT/\$my_package-bootstrap.sh"
72 wget -q "\$my_installer_url" --user-agent="wget \$WEBI_UA" \\
73 -O "\$WEBI_BOOT/\$my_package-bootstrap.sh"
75 if ! [ \$? -eq 0 ]; then
76 echo "error fetching '\$my_installer_url'"
81 pushd "\$WEBI_BOOT" 2>&1 > /dev/null
82 bash "\$my_package-bootstrap.sh"
88 chmod a+x "$HOME/.local/bin/webi"
90 if [ -n "${WEBI_PKG:-}" ]; then
91 "$HOME/.local/bin/webi" "${WEBI_PKG}"