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 if [ -n "\$(command -v git)" ]; then
33 if [ -n "\$(command -v tar)" ]; then
36 if [ -n "\$(command -v unzip)" ]; then
39 if [ -n "\$(command -v pkgutil)" ]; then
42 # disable this check for the sake of building the macOS installer on Linux
43 #if [ -n "\$(command -v diskutil)" ]; then
44 # note: could also detect via hdiutil
47 my_ext="\$(echo "\$my_ext" | sed 's/,$//')" # nix trailing comma
54 export WEBI_CURL="\$(command -v curl)"
55 export WEBI_WGET="\$(command -v wget)"
58 export WEBI_BOOT="\$(mktemp -d -t "\$my_package-bootstrap.XXXXXXXX")"
59 export WEBI_HOST="\${WEBI_HOST:-https://webinstall.dev}"
60 export WEBI_UA="\$(uname -a)"
62 my_installer_url="\$WEBI_HOST/api/installers/\$my_package.bash?formats=\$my_ext"
64 if [ -n "\$WEBI_CURL" ]; then
65 curl -fsSL "\$my_installer_url" -H "User-Agent: curl \$WEBI_UA" \\
66 -o "\$WEBI_BOOT/\$my_package-bootstrap.sh"
68 wget -q "\$my_installer_url" --user-agent="wget \$WEBI_UA" \\
69 -O "\$WEBI_BOOT/\$my_package-bootstrap.sh"
71 if ! [ \$? -eq 0 ]; then
72 echo "error fetching '\$my_installer_url'"
77 pushd "\$WEBI_BOOT" 2>&1 > /dev/null
78 bash "\$my_package-bootstrap.sh"
84 chmod a+x "$HOME/.local/bin/webi"
86 if [ -n "${WEBI_PKG:-}" ]; then
87 "$HOME/.local/bin/webi" "${WEBI_PKG}"