10 common_opt="${HOME}/.local/opt/foobar-v${WEBI_VERSION}"
11 new_opt="${HOME}/.local/opt/foobar-v${WEBI_VERSION}"
12 new_bin="${HOME}/.local/opt/foobar-v${WEBI_VERSION}/bin/foobar"
16 ln -s "$new_opt" "$common_opt"
18 # TODO get better output from pathman / output the path to add as return to webi bootstrap
19 webi_path_add "$common_opt/bin"
20 webi_path_add "$HOME/foobar/bin"
23 if [ -x "$new_opt/bin/foobar" ]; then
28 # Test for existing version
30 cur_go="$(command -v foobar)"
32 if [ -n "$cur_go" ]; then
33 cur_ver=$(foobar version | cut -d' ' -f3 | sed 's:foobar::')
34 if [ "$cur_ver" == "$(echo $WEBI_VERSION | sed 's:\.0::g')" ]; then
35 echo "foobar v$WEBI_VERSION already installed at $cur_go"
37 elif [ "$cur_go" != "$new_bin" ]; then
38 echo "WARN: possible conflict with foobar v$WEBI_VERSION at $cur_go"
43 # Note: this file is `source`d by the true installer and hence will have the webi functions
45 # because we created releases.js we can use webi_download()
46 # downloads foobar to ~/Downloads
49 # because this is tar or zip, we can webi_extract()
50 # extracts to the WEBI_TMP directory, raw (no --strip-prefix)
53 pushd "$WEBI_TMP" 2>&1 >/dev/null
54 echo Installing foobar v${WEBI_VERSION} as "$new_bin"
56 # simpler for single-binary commands
57 #mv ./example*/bin/example "$HOME/.local/bin"
59 # best for packages and toolchains
61 if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then
62 rsync -Krl ./foobar*/ "$new_opt/" 2>/dev/null
64 cp -Hr ./foobar*/* "$new_opt/" 2>/dev/null
65 cp -Hr ./foobar*/.* "$new_opt/" 2>/dev/null
77 echo "Installed 'foobar'"