4 # homepage: https://webinstall.dev
5 # tagline: webinstall.dev for the CLI
7 # for the people like us that are too lazy even to run <kbd>curl https://webinstall.dev/PACKAGE_NAME | bash</kbd>
25 mkdir -p "$HOME/.local/bin"
27 cat << EOF > "$HOME/.local/bin/webi"
34 if [ -z "\$my_package" ]; then
35 echo "Usage: webi <package>@<version>"
36 echo "Example: webi node@latest"
41 ## Detect acceptable package formats
46 if [ -n "\$(command -v git)" ]; then
47 my_ext="git,\${my_ext}"
49 if [ -n "\$(command -v tar)" ]; then
50 my_ext="tar,\${my_ext}"
52 if [ -n "\$(command -v unzip)" ]; then
53 my_ext="zip,\${my_ext}"
55 if [ -n "\$(command -v pkgutil)" ]; then
56 my_ext="pkg,\${my_ext}"
58 if [ -n "\$(command -v diskutil)" ]; then
59 # note: could also detect via hdiutil
60 my_ext="dmg,\${my_ext}"
68 export WEBI_CURL="\$(command -v curl)"
69 export WEBI_WGET="\$(command -v wget)"
72 export WEBI_BOOT="\$(mktemp -d -t "\$my_package-bootstrap.XXXXXXXX")"
73 export WEBI_UA="\$(uname -a)"
75 if [ -n "\$WEBI_CURL" ]; then
76 curl -fsSL "https://webinstall.dev/\$my_package?ext=\$my_ext" -H "User-Agent: curl \$WEBI_UA" \\
77 -o "\$WEBI_BOOT/\$my_package-bootstrap.sh"
79 wget -q "https://webinstall.dev/\$my_package?ext=\$my_ext" --user-agent="wget \$WEBI_UA" \\
80 -O "\$WEBI_BOOT/\$my_package-bootstrap.sh"
83 pushd "\$WEBI_BOOT" 2>&1 > /dev/null
84 bash "\$my_package-bootstrap.sh"
90 chmod a+x ~/.local/bin/webi