Files
vim-ale/gitea/install.bash
2020-06-07 21:24:49 -06:00

60 lines
1.6 KiB
Bash

# title: Gitea
# homepage: https://github.com/go-gitea/gitea
# tagline: a modern drop-in grep replacement
# description: |
# `gitea` is a clean, lightweight self-hosted Github alternative, forked from Gogs. Lighter and more user-friendly than Gitlab.
# examples: |
#
# ```bash
# gitea --version
# ```
set -e
set -u
###################
# Install gitea #
###################
new_gitea="${HOME}/.local/bin/gitea"
# Test for existing version
set +e
cur_gitea="$(command -v gitea)"
set -e
if [ -n "$cur_gitea" ]; then
cur_ver=$(gitea --version | head -n 1 | cut -d ' ' -f 3)
if [ "$cur_ver" == "$WEBI_VERSION" ]; then
echo "gitea v$WEBI_VERSION already installed at $cur_gitea"
exit 0
elif [ "$cur_gitea" != "$new_gitea" ]; then
echo "WARN: possible conflict with gitea v$WEBI_VERSION at $cur_gitea"
fi
fi
# 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 gitea 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 gitea v${WEBI_VERSION} as "$new_gitea"
mv ./gitea-* "$HOME/.local/bin/gitea"
chmod a+x "$HOME/.local/bin/gitea"
popd 2>&1 >/dev/null
###################
# Update PATH #
###################
# TODO get better output from pathman / output the path to add as return to webi bootstrap
webi_path_add "$HOME/.local/bin"
echo "Installed 'gitea'"
echo ""