6 #WEBI_HOST=https://webinstall.dev
9 mkdir -p "$HOME/.local/bin"
11 cat << EOF > "$HOME/.local/bin/webi"
20 if [ -z "\$my_package" ]; then
21 echo "Usage: webi <package>@<version>"
22 echo "Example: webi node@latest"
27 ## Detect acceptable package formats
32 # NOTE: the order here is least favorable to most favorable
33 if [ -n "\$(command -v pkgutil)" ]; then
36 # disable this check for the sake of building the macOS installer on Linux
37 #if [ -n "\$(command -v diskutil)" ]; then
38 # note: could also detect via hdiutil
41 if [ -n "\$(command -v git)" ]; then
44 if [ -n "\$(command -v unxz)" ]; then
47 if [ -n "\$(command -v unzip)" ]; then
50 if [ -n "\$(command -v tar)" ]; then
53 my_ext="\$(echo "\$my_ext" | sed 's/,$//')" # nix trailing comma
60 export WEBI_CURL="\$(command -v curl)"
61 export WEBI_WGET="\$(command -v wget)"
64 export WEBI_BOOT="\$(mktemp -d -t "\$my_package-bootstrap.XXXXXXXX")"
65 export WEBI_HOST="\${WEBI_HOST:-https://webinstall.dev}"
66 export WEBI_UA="\$(uname -a)"
68 my_installer_url="\$WEBI_HOST/api/installers/\$my_package.bash?formats=\$my_ext"
70 if [ -n "\$WEBI_CURL" ]; then
71 curl -fsSL "\$my_installer_url" -H "User-Agent: curl \$WEBI_UA" \\
72 -o "\$WEBI_BOOT/\$my_package-bootstrap.sh"
74 wget -q "\$my_installer_url" --user-agent="wget \$WEBI_UA" \\
75 -O "\$WEBI_BOOT/\$my_package-bootstrap.sh"
77 if ! [ \$? -eq 0 ]; then
78 echo "error fetching '\$my_installer_url'"
83 pushd "\$WEBI_BOOT" 2>&1 > /dev/null
84 bash "\$my_package-bootstrap.sh"
92 chmod a+x "$HOME/.local/bin/webi"
94 if [ -n "${WEBI_PKG:-}" ]; then
95 "$HOME/.local/bin/webi" "${WEBI_PKG}"