3 # TODO: migrate from shmatter to frontmarker
12 common_opt="${HOME}/.local/opt/foobar-v${WEBI_VERSION}"
13 new_opt="${HOME}/.local/opt/foobar-v${WEBI_VERSION}"
14 new_bin="${HOME}/.local/opt/foobar-v${WEBI_VERSION}/bin/foobar"
18 ln -s "$new_opt" "$common_opt"
20 # TODO get better output from pathman / output the path to add as return to webi bootstrap
21 webi_path_add "$common_opt/bin"
22 webi_path_add "$HOME/foobar/bin"
25 if [ -x "$new_opt/bin/foobar" ]; then
30 # Test for existing version
32 cur_go="$(command -v foobar)"
34 if [ -n "$cur_go" ]; then
35 cur_ver=$(foobar version | cut -d' ' -f3 | sed 's:foobar::')
36 if [ "$cur_ver" == "$(echo $WEBI_VERSION | sed 's:\.0::g')" ]; then
37 echo "foobar v$WEBI_VERSION already installed at $cur_go"
39 elif [ "$cur_go" != "$new_bin" ]; then
40 echo "WARN: possible conflict with foobar v$WEBI_VERSION at $cur_go"
45 # Note: this file is `source`d by the true installer and hence will have the webi functions
47 # because we created releases.js we can use webi_download()
48 # downloads foobar to ~/Downloads
51 # because this is tar or zip, we can webi_extract()
52 # extracts to the WEBI_TMP directory, raw (no --strip-prefix)
55 pushd "$WEBI_TMP" 2>&1 >/dev/null
56 echo Installing foobar v${WEBI_VERSION} as "$new_bin"
58 # simpler for single-binary commands
59 #mv ./example*/bin/example "$HOME/.local/bin"
61 # best for packages and toolchains
63 if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then
64 rsync -Krl ./foobar*/ "$new_opt/" 2>/dev/null
66 cp -Hr ./foobar*/* "$new_opt/" 2>/dev/null
67 cp -Hr ./foobar*/.* "$new_opt/" 2>/dev/null
79 echo "Installed 'foobar'"