10 # TODO should this be BASEURL instead?
18 # TODO not sure if BUILD is the best name for this
27 ## Set up tmp, download, and install directories
30 WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-go.XXXXXXXX)"}
32 mkdir -p "$HOME/Downloads"
33 mkdir -p "$HOME/.local/bin"
34 mkdir -p "$HOME/.local/opt"
40 export WEBI_CURL="$(command -v curl)"
41 export WEBI_WGET="$(command -v wget)"
45 if [ -n "${1:-}" ]; then
48 my_url="$WEBI_PKG_URL"
49 echo "Downloading $WEBI_NAME v$WEBI_VERSION"
51 if [ -n "${2:-}" ]; then
54 my_dl="$WEBI_PKG_FILE"
57 if [ -n "$WEBI_WGET" ]; then
58 # wget has resumable downloads
59 wget -c "$my_url" --user-agent="wget $WEBI_UA" -O "$my_dl"
61 # BSD curl is non-resumable, hence we don't bother
62 curl -fSL "$my_url" -H "User-Agent: curl $WEBI_UA" -o "$my_dl"
67 pushd "$WEBI_TMP" 2>&1 >/dev/null
68 if [ "tar" == "$WEBI_EXT" ]; then
69 echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE"
70 tar xf "$HOME/Downloads/$WEBI_PKG_FILE"
71 elif [ "zip" == "$WEBI_EXT" ]; then
72 echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE"
73 unzip "$HOME/Downloads/$WEBI_PKG_FILE"
76 echo "Failed to extract $HOME/Downloads/$WEBI_PKG_FILE"
83 # make sure that we don't recursively install pathman with webi
85 export PATH="$HOME/.local/bin:$PATH"
87 my_pathman=$(command -v pathman)
89 export PATH="$my_path"
91 # install pathman if not already installed
92 if [ -z "$my_pathman" ]; then
93 "$HOME/.local/bin/webi" pathman
94 "$HOME/.local/bin/pathman" add "$HOME/.local/bin"
95 export PATH="$HOME/.local/bin:$PATH"
103 ## BEGIN user-submited script
111 ## END user-submitted script