From: AJ ONeal Date: Mon, 4 May 2020 10:11:44 +0000 (-0600) Subject: use new bootstrap + webinstall approach X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=624a263a91305e1a389e502555f3e66088f65812;p=webi-installers%2F.git use new bootstrap + webinstall approach --- diff --git a/_common/normalize.js b/_common/normalize.js index 88e3ce7..f2279d1 100644 --- a/_common/normalize.js +++ b/_common/normalize.js @@ -34,6 +34,9 @@ var archMap = { function normalize(all) { all.releases.forEach(function (rel) { + if (!rel.name) { + rel.name = rel.download.replace(/.*\//, ''); + } if (!rel.os) { rel.os = Object.keys(osMap).find(function (regKey) { diff --git a/golang/golang.bash b/golang/golang.bash index ad14c15..59ca0f4 100644 --- a/golang/golang.bash +++ b/golang/golang.bash @@ -10,22 +10,22 @@ # mkdir -p hello/ # pushd hello/ # ``` -#
+#
# # ```bash # cat << EOF >> main.go # package main -# +# # import ( # "fmt" # ) -# +# # func main () { # fmt.Println("Hello, World!") # } # EOF # ``` -#
+#
# # ```bash # go fmt ./... @@ -37,32 +37,6 @@ set -e set -u -# Use the script's first argument or the supplied WEBI_VERSION or '' -WEBI_VERSION=${1:-${WEBI_VERSION:-}} - -# Set a temporary directory, if not already set -WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-go.XXXXXXXX)"} - -################### -# Get WEBI vars # -################### - -# The WEBI bootstrap will define these -# but each script should be testable in its own right - -if [ -z "${WEBI_PKG_URL:-}" ]; then - release_tab="${WEBI_HOST}/api/releases/golang@${WEBI_VERSION:-}.csv?os=$(uname -s)&arch=$(uname -m)&ext=tar&limit=1" - WEBI_CSV=$(curl -fsSL "$release_tab" -H "User-Agent: $(uname -a)") - WEBI_CHANNEL=$(echo $WEBI_CSV | cut -d ',' -f 3) - if [ "error" == "$WEBI_CHANNEL" ]; then - echo "could not find release for go v${WEBI_VERSION}" - exit 1 - fi - WEBI_VERSION=$(echo $WEBI_CSV | cut -d ',' -f 1) - WEBI_PKG_URL=$(echo $WEBI_CSV | cut -d ',' -f 9) - WEBI_PKG_FILE="$WEBI_TMP/$(echo $WEBI_PKG_URL | sed s:.*/::)" -fi - ################### # Install go # ################### @@ -70,12 +44,11 @@ fi new_go_home="${HOME}/.local/opt/go-v${WEBI_VERSION}" new_go="${HOME}/.local/opt/go-v${WEBI_VERSION}/bin/go" -# Test for existing version +# Test for existing version set +e cur_go="$(command -v go)" set -e if [ -n "$cur_go" ]; then - # TODO this is still sometimes wrong (i.e. 1.14 = 1.14.0) cur_ver=$(go version | cut -d' ' -f3 | sed 's:go::') if [ "$cur_ver" == "$(echo $WEBI_VERSION | sed 's:\.0::g')" ]; then echo "go v$WEBI_VERSION already installed at $cur_go" @@ -85,31 +58,37 @@ if [ -n "$cur_go" ]; then fi fi -# TODO move download to the webi bootstrap -echo Downloading go v"${WEBI_VERSION}" from "${WEBI_PKG_URL}" -curl -fsSL "${WEBI_PKG_URL}" -o "${WEBI_PKG_FILE}" -pushd "${WEBI_TMP}" 2>&1 >/dev/null - echo Installing go v${WEBI_VERSION} as "$new_go" - tar xf "${WEBI_PKG_FILE}" - rm "${WEBI_PKG_FILE}" - - # simpler for single-binary commands - #mv ./example*/bin/example "$HOME/.local/bin" - - # best for packages and toolchains - rm -rf "$new_go_home" - if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then - rsync -Krl ./go*/ "$new_go_home/" 2>/dev/null - else - cp -Hr ./go*/* "$new_go_home/" 2>/dev/null - cp -Hr ./go*/.* "$new_go_home/" 2>/dev/null - fi - - # Install x go - $new_go_home/bin/go get golang.org/x/tools/cmd/goimports > /dev/null 2>/dev/null - $new_go_home/bin/go get golang.org/x/tools/cmd/gorename > /dev/null 2>/dev/null - $new_go_home/bin/go get golang.org/x/tools/cmd/gotype > /dev/null 2>/dev/null - $new_go_home/bin/go get golang.org/x/tools/cmd/stringer > /dev/null 2>/dev/null + +# Note: this file is `source`d by the true installer and hence will have the webi functions + +# because we created releases.js we can use webi_download() +# downloads go to ~/Downloads +webi_download + +# because this is tar or zip, we can webi_extract() +# extracts to the WEBI_TMP directory, raw (no --strip-prefix) +webi_extract + +pushd "$WEBI_TMP" 2>&1 >/dev/null + echo Installing go v${WEBI_VERSION} as "$new_go" + + # simpler for single-binary commands + #mv ./example*/bin/example "$HOME/.local/bin" + + # best for packages and toolchains + rm -rf "$new_go_home" + if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then + rsync -Krl ./go*/ "$new_go_home/" 2>/dev/null + else + cp -Hr ./go*/* "$new_go_home/" 2>/dev/null + cp -Hr ./go*/.* "$new_go_home/" 2>/dev/null + fi + + # Install x go + $new_go_home/bin/go get golang.org/x/tools/cmd/goimports > /dev/null 2>/dev/null + $new_go_home/bin/go get golang.org/x/tools/cmd/gorename > /dev/null 2>/dev/null + $new_go_home/bin/go get golang.org/x/tools/cmd/gotype > /dev/null 2>/dev/null + $new_go_home/bin/go get golang.org/x/tools/cmd/stringer > /dev/null 2>/dev/null popd 2>&1 >/dev/null ################### @@ -117,7 +96,8 @@ popd 2>&1 >/dev/null ################### # TODO get better output from pathman / output the path to add as return to webi bootstrap -pathman add "$new_go_home/bin" -pathman add "$HOME/go/bin" +webi_path_add "$new_go_home/bin" +webi_path_add "$HOME/go/bin" + echo "Installed 'go' (and go tools)" echo "" diff --git a/node/node.bash b/node/node.bash index 89cb7c1..0d2a917 100644 --- a/node/node.bash +++ b/node/node.bash @@ -12,7 +12,7 @@ # ``` #
#
-# +# # # # @@ -27,11 +27,11 @@ #
'use strict'
 #   var express = require('express');
 #   var app = express();
-#   
+#
 #   app.use('/', function (req, res, next) {
 #     res.end("Hello, World!");
 #   });
-#   
+#
 #   module.exports = app;
#
# server.js: @@ -51,84 +51,60 @@ set -e set -u -my_tmp=${WEBI_TMP:-$(mktemp -d node-install.XXXXXX)} -sudo_cmd=${WEBI_SUDO:-} +################## +# Install node # +################## -http_get() { - if [ -n "$(command -v curl)" ]; then - curl -fsSL $1 -o $2 || echo 'error downloading node' - elif [ -n "$(command -v wget)" ]; then - wget --quiet $1 -O $2 || echo 'error downloading node' - else - echo "'wget' and 'curl' are missing. Please run the following command and try again" - echo "" - echo " sudo apt-get install --yes curl wget" - exit 1 - fi -} +new_node_home="${HOME}/.local/opt/node-v${WEBI_VERSION}" +new_node="${HOME}/.local/opt/node-v${WEBI_VERSION}/bin/node" -WEBI_CSV=$(curl -fsSL "https://webinstall.dev/api/releases/node@${WEBI_VERSION:-}.csv?os=$(uname -s)&arch=$(uname -m)&ext=tar&limit=1" -H "User-Agent: $(uname -a)") -NODEJS_VER=$(echo $WEBI_CSV | cut -d ',' -f 1) -NODEJS_REMOTE=$(echo $WEBI_CSV | cut -d ',' -f 9) -NODEJS_LOCAL="$my_tmp/$(echo $NODEJS_REMOTE | sed s:.*/::)" -NODE_OS="$(echo $WEBI_CSV | cut -d ',' -f 5)" - -######### -# BEGIN # -######### - -# WEBI_ARCH uses only slightly different names from NODE_ARCH -NODE_OS="$(echo $WEBI_CSV | cut -d ',' -f 5)" -if [ "macos" == "$NODE_OS" ]; then - NODE_OS="darwin" +# Test for existing version +set +e +cur_node="$(command -v node)" +set -e +if [ -e "$new_node_home/bin/node" ]; then + # node of some version is already installed + if [ "v${WEBI_VERSION}" == "$("$new_node_home/bin/node" -v 2>/dev/null)" ]; then + echo node v${WEBI_VERSION} already installed at $new_node_home + exit 0 + fi fi -NODE_ARCH="$(echo $WEBI_CSV | cut -d ',' -f 6)" -if [ "amd64" == "$NODE_ARCH" ]; then - NODE_ARCH="x64" +if [ "$cur_node" != "$new_node" ]; then + echo "WARN: possible conflict with node v$WEBI_VERSION at $cur_node" fi -node_install_path=$HOME/.local/opt/node-v${NODEJS_VER} -mkdir -p $node_install_path +# Note: this file is `source`d by the true installer and hence will have the webi functions -if [ -e "$node_install_path/bin/node" ]; then - # node of some version is already installed - if [ "v${NODEJS_VER}" == "$($node_install_path/bin/node -v 2>/dev/null)" ]; then - echo node ${NODEJS_VER} already installed at $node_install_path - exit 0 - fi -fi +# because we created releases.js we can use webi_download() +# downloads node to ~/Downloads +webi_download -# TODO warn if existing node in path my take precedence +# because this is tar or zip, we can webi_extract() +# extracts to the WEBI_TMP directory, raw (no --strip-prefix) +webi_extract -echo "downloading node v${NODEJS_VER}..." -http_get ${NODEJS_REMOTE} ${NODEJS_LOCAL} || echo 'error downloading node' +pushd "$WEBI_TMP" 2>&1 >/dev/null + echo Installing node v${WEBI_VERSION} as "$new_node" -echo "installing node v${NODEJS_VER}..." -tar xf ${NODEJS_LOCAL} -C $my_tmp/ -# we know how it'll unpack -NODEJS_UNTAR=$my_tmp/node-v${NODEJS_VER}-${NODE_OS}-${NODE_ARCH} + # simpler for single-binary commands + #mv ./example*/bin/example "$HOME/.local/bin" -# this funny business is to allow something a non-/opt directory -# ( such as /usr/local ) to be an install target -rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} -if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then - echo $sudo_cmd rsync -Krl "${NODEJS_UNTAR}/" "$node_install_path/" - rsync -Krl "${NODEJS_UNTAR}/" "$node_install_path/" 2>/dev/null || $sudo_cmd rsync -Krl "${NODEJS_UNTAR}/" "$node_install_path/" -else - # due to symlink issues on Arch Linux, don't copy the share directory - rm -rf ${NODEJS_UNTAR}/share - echo $sudo_cmd cp -Hr "${NODEJS_UNTAR}/*" "$node_install_path/" - cp -Hr "${NODEJS_UNTAR}"/* "$node_install_path/" 2>/dev/null || $sudo_cmd cp -Hr "${NODEJS_UNTAR}"/* "$node_install_path/" -fi -rm -rf "${NODEJS_UNTAR}" -rm -rf "${my_tmp}" + # best for packages and toolchains + rm -rf "$new_node_home" + if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then + rsync -Krl ./node*/ "$new_node_home/" 2>/dev/null + else + cp -Hr ./node*/* "$new_node_home/" 2>/dev/null + cp -Hr ./node*/.* "$new_node_home/" 2>/dev/null + fi +popd 2>&1 >/dev/null -# By default, npm is stupid and uses any version of node in any path. Stop that. -# npm config set scripts-prepend-node-path true -"$node_install_path"/bin/node "$node_install_path"/bin/npm --scripts-prepend-node-path=true config set scripts-prepend-node-path true +################### +# Update PATH # +################### -####### -# END # -####### +# TODO get better output from pathman / output the path to add as return to webi bootstrap +webi_path_add "$new_node_home/bin" -pathman add $node_install_path/bin +echo "Installed 'node' and 'npm'" +echo "" diff --git a/pathman/pathman.bash b/pathman/pathman.bash index 09a8149..4b9e538 100644 --- a/pathman/pathman.bash +++ b/pathman/pathman.bash @@ -27,29 +27,29 @@ set -e set -u -# Get arch envs, etc -my_url="https://rootprojects.org/pathman/dist/$(uname -s)/$(uname -m)/pathman" -curl -fsSL "$my_url" -o pathman -echo "" -# Make executable -chmod +x ./pathman -# Move to ~/.local/bin -mkdir -p ~/.local/bin -mv ./pathman ~/.local/bin - # Test if in PATH set +e my_pathman=$(command -v pathman) set -e if [ -n "$my_pathman" ]; then + # TODO test pathman version + # if [ "$WEBI_VERSION" == "$(pathman version | cut -d ' ' -f2)" ]; then if [ "$my_pathman" != "$HOME/.local/bin/pathman" ]; then echo "a pathman installation (which make take precedence) exists at:" echo " $my_pathman" echo "" fi + echo "pathman already installed" + exit 0 fi +# TODO use webi_download via releases.js +webi_download "https://rootprojects.org/pathman/dist/$(uname -s)/$(uname -m)/pathman" "$HOME/.local/bin/pathman" + +# TODO use webi_extract +chmod +x "$HOME/.local/bin/pathman" + # add to ~/.local/bin to PATH even if pathman is elsewhere # TODO pathman needs silent option and debug output (quiet "already exists" output) -~/.local/bin/pathman add ~/.local/bin # > /dev/null 2> /dev/null +"$HOME/.local/bin/pathman" add ~/.local/bin # > /dev/null 2> /dev/null # TODO inform user to add to path, apart from pathman? diff --git a/rg/rg.bash b/rg/rg.bash index 7c2a825..afc1c19 100644 --- a/rg/rg.bash +++ b/rg/rg.bash @@ -21,39 +21,13 @@ set -e set -u -# Use the script's first argument or the supplied WEBI_VERSION or '' -WEBI_VERSION=${1:-${WEBI_VERSION:-}} - -# Set a temporary directory, if not already set -WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-ripgrep.XXXXXXXX)"} - -################### -# Get WEBI vars # -################### - -# The WEBI bootstrap will define these -# but each script should be testable in its own right - -if [ -z "${WEBI_PKG_URL:-}" ]; then - release_tab="${WEBI_HOST}/api/releases/ripgrep@${WEBI_VERSION:-}.csv?os=$(uname -s)&arch=$(uname -m)&ext=tar&limit=1" - WEBI_CSV=$(curl -fsSL "$release_tab" -H "User-Agent: $(uname -a)") - WEBI_CHANNEL=$(echo $WEBI_CSV | cut -d ',' -f 3) - if [ "error" == "$WEBI_CHANNEL" ]; then - echo "could not find release for ripgrep v${WEBI_VERSION}" - exit 1 - fi - WEBI_VERSION=$(echo $WEBI_CSV | cut -d ',' -f 1) - WEBI_PKG_URL=$(echo $WEBI_CSV | cut -d ',' -f 9) - WEBI_PKG_FILE="$WEBI_TMP/$(echo $WEBI_PKG_URL | sed s:.*/::)" -fi - ################### # Install ripgrep # ################### new_rg="${HOME}/.local/bin/rg" -# Test for existing version +# Test for existing version set +e cur_rg="$(command -v rg)" set -e @@ -67,14 +41,19 @@ if [ -n "$cur_rg" ]; then fi fi -# TODO move download to the webi bootstrap -echo Downloading ripgrep v"${WEBI_VERSION}" from "${WEBI_PKG_URL}" -curl -fsSL "${WEBI_PKG_URL}" -o "${WEBI_PKG_FILE}" -pushd "${WEBI_TMP}" 2>&1 >/dev/null - echo Installing ripgrep v${WEBI_VERSION} as "$new_rg" - tar xf "${WEBI_PKG_FILE}" - rm "${WEBI_PKG_FILE}" - mv ./ripgrep-*/rg "${HOME}/.local/bin/" +# Note: this file is `source`d by the true installer and hence will have the webi functions + +# because we created releases.js we can use webi_download() +# downloads ripgrep to ~/Downloads +webi_download + +# because this is tar or zip, we can webi_extract() +# extracts to the WEBI_TMP directory, raw (no --strip-prefix) +webi_extract + +pushd "$WEBI_TMP" 2>&1 >/dev/null + echo Installing ripgrep v${WEBI_VERSION} as "$new_rg" + mv ./ripgrep-*/rg "$HOME/.local/bin/" popd 2>&1 >/dev/null ################### @@ -82,7 +61,7 @@ popd 2>&1 >/dev/null ################### # TODO get better output from pathman / output the path to add as return to webi bootstrap -pathman add "$HOME/.local/bin/" +webi_path_add "$HOME/.local/bin" echo "Installed 'rg'" echo "" diff --git a/webi/bootstrap.bash b/webi/bootstrap.bash new file mode 100644 index 0000000..6c379a1 --- /dev/null +++ b/webi/bootstrap.bash @@ -0,0 +1,82 @@ +#!/bin/bash + +{ + +#WEBI_PKG= +#WEBI_HOST=https://webinstall.dev + +mkdir -p "$HOME/.local/bin" + +cat << EOF > "$HOME/.local/bin/webi" +#!/bin/bash + +set -e +set -u + +my_package="\${1:-}" +if [ -z "\$my_package" ]; then + echo "Usage: webi @" + echo "Example: webi node@latest" + exit 1 +fi + +## +## Detect acceptable package formats +## + +my_ext="" +set +e +if [ -n "\$(command -v git)" ]; then + my_ext="git,\$my_ext" +fi +if [ -n "\$(command -v tar)" ]; then + my_ext="tar,\$my_ext" +fi +if [ -n "\$(command -v unzip)" ]; then + my_ext="zip,\$my_ext" +fi +if [ -n "\$(command -v pkgutil)" ]; then + my_ext="pkg,\$my_ext" +fi +if [ -n "\$(command -v diskutil)" ]; then + # note: could also detect via hdiutil + my_ext="dmg,\$my_ext" +fi +my_ext="\$(echo "\$my_ext" | sed 's/,$//')" # nix trailing comma +set -e + +## +## Detect http client +## +set +e +export WEBI_CURL="\$(command -v curl)" +export WEBI_WGET="\$(command -v wget)" +set -e + +export WEBI_BOOT="\$(mktemp -d -t "\$my_package-bootstrap.XXXXXXXX")" +export WEBI_HOST="\${WEBI_HOST:-https://webinstall.dev}" +export WEBI_UA="\$(uname -a)" + +my_installer_url="\$WEBI_HOST/api/installers/\$my_package.bash?formats=\$my_ext" +if [ -n "\$WEBI_CURL" ]; then + curl -fsSL "\$my_installer_url" -H "User-Agent: curl \$WEBI_UA" \\ + -o "\$WEBI_BOOT/\$my_package-bootstrap.sh" +else + wget -q "\$my_installer_url" --user-agent="wget \$WEBI_UA" \\ + -O "\$WEBI_BOOT/\$my_package-bootstrap.sh" +fi + +pushd "\$WEBI_BOOT" 2>&1 > /dev/null + bash "\$my_package-bootstrap.sh" +popd 2>&1 > /dev/null + +rm -rf "\$WEBI_BOOT" +EOF + +chmod a+x "$HOME/.local/bin/webi" + +if [ -n "${WEBI_PKG:-}" ]; then + "$HOME/.local/bin/webi" "${WEBI_PKG}" +fi + +} diff --git a/webi/template.bash b/webi/template.bash new file mode 100644 index 0000000..8c42305 --- /dev/null +++ b/webi/template.bash @@ -0,0 +1,115 @@ +#!/bin/bash + +{ + +set -e +set -u + +#WEBI_PKG= +#WEBI_NAME= +# TODO should this be BASEURL instead? +#WEBI_HOST= +#WEBI_RELEASES= +#WEBI_CSV= +#WEBI_VERSION= +#WEBI_MAJOR= +#WEBI_MINOR= +#WEBI_PATCH= +# TODO not sure if BUILD is the best name for this +#WEBI_BUILD= +#WEBI_LTS= +#WEBI_CHANNEL= +#WEBI_EXT= +#WEBI_PKG_URL= +#WEBI_PKG_FILE= + +## +## Set up tmp, download, and install directories +## + +WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-go.XXXXXXXX)"} + +mkdir -p "$HOME/Downloads" +mkdir -p "$HOME/.local/bin" +mkdir -p "$HOME/.local/opt" + +## +## Detect http client +## +set +e +export WEBI_CURL="$(command -v curl)" +export WEBI_WGET="$(command -v wget)" +set -e + +webi_download() { + if [ -n "${1:-}" ]; then + my_url="$1" + else + my_url="$WEBI_PKG_URL" + echo "Downloading $WEBI_NAME v$WEBI_VERSION" + fi + if [ -n "${2:-}" ]; then + my_dl="$2" + else + my_dl="$WEBI_PKG_FILE" + fi + + if [ -n "$WEBI_WGET" ]; then + # wget has resumable downloads + wget -c "$my_url" --user-agent="wget $WEBI_UA" -O "$my_dl" + else + # BSD curl is non-resumable, hence we don't bother + curl -fSL "$my_url" -H "User-Agent: curl $WEBI_UA" -o "$my_dl" + fi +} + +webi_extract() { + pushd "$WEBI_TMP" 2>&1 >/dev/null + if [ "tar" == "$WEBI_EXT" ]; then + echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE" + tar xf "$HOME/Downloads/$WEBI_PKG_FILE" + elif [ "zip" == "$WEBI_EXT" ]; then + echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE" + unzip "$HOME/Downloads/$WEBI_PKG_FILE" + else + # do nothing + echo "Failed to extract $HOME/Downloads/$WEBI_PKG_FILE" + exit 1 + fi + popd 2>&1 >/dev/null +} + +webi_path_add() { + # make sure that we don't recursively install pathman with webi + my_path="$PATH" + export PATH="$HOME/.local/bin:$PATH" + set +e + my_pathman=$(command -v pathman) + set -e + export PATH="$my_path" + + # install pathman if not already installed + if [ -z "$my_pathman" ]; then + "$HOME/.local/bin/webi" pathman + "$HOME/.local/bin/pathman" add "$HOME/.local/bin" + export PATH="$HOME/.local/bin:$PATH" + fi + + pathman add "$1" +} + +## +## +## BEGIN user-submited script +## +## + +{{ installer }} + +## +## +## END user-submitted script +## +## + +} diff --git a/webi/webi.bash b/webi/webi.bash index 9ca3a88..d32a610 100644 --- a/webi/webi.bash +++ b/webi/webi.bash @@ -20,73 +20,8 @@ # webi rustlang # ``` -{ - -mkdir -p "$HOME/.local/bin" - -cat << EOF > "$HOME/.local/bin/webi" -#!/bin/bash - -set -e -set -u - -my_package="\${1:-}" -if [ -z "\$my_package" ]; then - echo "Usage: webi @" - echo "Example: webi node@latest" - exit 1 -fi - -## -## Detect acceptable package formats -## - -my_ext="" -set +e -if [ -n "\$(command -v git)" ]; then - my_ext="git,\${my_ext}" -fi -if [ -n "\$(command -v tar)" ]; then - my_ext="tar,\${my_ext}" -fi -if [ -n "\$(command -v unzip)" ]; then - my_ext="zip,\${my_ext}" -fi -if [ -n "\$(command -v pkgutil)" ]; then - my_ext="pkg,\${my_ext}" -fi -if [ -n "\$(command -v diskutil)" ]; then - # note: could also detect via hdiutil - my_ext="dmg,\${my_ext}" -fi -set -e - -## -## Detect http client -## -set +e -export WEBI_CURL="\$(command -v curl)" -export WEBI_WGET="\$(command -v wget)" -set -e - -export WEBI_BOOT="\$(mktemp -d -t "\$my_package-bootstrap.XXXXXXXX")" -export WEBI_UA="\$(uname -a)" - -if [ -n "\$WEBI_CURL" ]; then - curl -fsSL "https://webinstall.dev/\$my_package?ext=\$my_ext" -H "User-Agent: curl \$WEBI_UA" \\ - -o "\$WEBI_BOOT/\$my_package-bootstrap.sh" +if [ -f "$HOME/.local/bin/webi" ]; then + echo "Installed 'webi'" else - wget -q "https://webinstall.dev/\$my_package?ext=\$my_ext" --user-agent="wget \$WEBI_UA" \\ - -O "\$WEBI_BOOT/\$my_package-bootstrap.sh" + echo "Install any other package via https://webinstall.dev and webi will be installed as part of the bootstrap process" fi - -pushd "\$WEBI_BOOT" 2>&1 > /dev/null - bash "\$my_package-bootstrap.sh" -popd 2>&1 > /dev/null - -rm -rf "\$WEBI_BOOT" -EOF - -chmod a+x ~/.local/bin/webi - -}
Run a webserver