summaryrefslogtreecommitdiff
path: root/utils/morty.sh
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-11-16 18:03:34 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2021-11-16 20:44:53 +0100
commit79b41478ac7290453b73bf00c4cdcd84e588f051 (patch)
tree653d00f8b5661a667d892dc290c0a97ee8965a9a /utils/morty.sh
parentabd5eee3922b18a25ba59bb5a5d59a969ab5deb9 (diff)
downloadsearxng-79b41478ac7290453b73bf00c4cdcd84e588f051.tar.gz
searxng-79b41478ac7290453b73bf00c4cdcd84e588f051.zip
[fix] filtron & morty - install golang binary that fits to arch & os
Closes: https://github.com/searxng/searxng/issues/507 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/morty.sh')
-rwxr-xr-xutils/morty.sh26
1 files changed, 6 insertions, 20 deletions
diff --git a/utils/morty.sh b/utils/morty.sh
index c04df7a0c..c1f2bc968 100755
--- a/utils/morty.sh
+++ b/utils/morty.sh
@@ -3,6 +3,8 @@
# shellcheck source=utils/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
+# shellcheck source=utils/lib_go.sh
+source "${REPO_ROOT}/utils/lib_go.sh"
# shellcheck source=utils/lib_install.sh
source "${REPO_ROOT}/utils/lib_install.sh"
@@ -29,8 +31,6 @@ SERVICE_ENV_DEBUG=false
GO_ENV="${SERVICE_HOME}/.go_env"
GO_VERSION="go1.17.2"
-GO_PKG_URL="https://golang.org/dl/${GO_VERSION}.linux-amd64.tar.gz"
-GO_TAR=$(basename "$GO_PKG_URL")
# shellcheck disable=SC2034
CONFIG_FILES=()
@@ -234,7 +234,7 @@ install_all() {
rst_title "Install $SERVICE_NAME (service)"
assert_user
wait_key
- install_go "${GO_PKG_URL}" "${GO_TAR}" "${SERVICE_USER}"
+ go.golang "${GO_VERSION}" "${SERVICE_USER}"
wait_key
install_morty
wait_key
@@ -306,9 +306,7 @@ install_check() {
}
go_version(){
- sudo -i -u "$SERVICE_USER" <<EOF
-go version | cut -d' ' -f 3
-EOF
+ go.version "${SERVICE_USER}"
}
remove_all() {
@@ -338,12 +336,6 @@ EOF
export SERVICE_HOME
echo "export SERVICE_HOME=$SERVICE_HOME"
- cat > "$GO_ENV" <<EOF
-export GOPATH=\$HOME/go-apps
-export PATH=\$HOME/local/go/bin:\$GOPATH/bin:\$PATH
-EOF
- echo "Environment $GO_ENV has been setup."
-
tee_stderr <<EOF | sudo -i -u "$SERVICE_USER"
grep -qFs -- 'source $GO_ENV' ~/.profile || echo 'source $GO_ENV' >> ~/.profile
EOF
@@ -353,22 +345,16 @@ morty_is_installed() {
[[ -f $SERVICE_HOME/go-apps/bin/morty ]]
}
-_svcpr=" ${_Yellow}|${SERVICE_USER}|${_creset} "
-
install_morty() {
rst_title "Install morty in user's ~/go-apps" section
echo
- tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" 2>&1 | prefix_stdout "$_svcpr"
-go install -v github.com/asciimoo/morty@latest
-EOF
+ go.install github.com/asciimoo/morty@latest "${SERVICE_USER}"
}
update_morty() {
rst_title "Update morty" section
echo
- tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" 2>&1 | prefix_stdout "$_svcpr"
-go install -v github.com/asciimoo/morty@latest
-EOF
+ go.install github.com/asciimoo/morty@latest "${SERVICE_USER}"
}
set_service_env_debug() {