mirror of https://github.com/searxng/searxng.git
[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>
This commit is contained in:
parent
abd5eee392
commit
79b41478ac
|
@ -19,7 +19,8 @@
|
||||||
|
|
||||||
.. tabs::
|
.. tabs::
|
||||||
|
|
||||||
.. group-tab:: bash
|
.. group-tab:: os: linux / arch: amd64
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
@ -30,9 +31,9 @@
|
||||||
$ sudo -i -u \"${SERVICE_USER}\"
|
$ sudo -i -u \"${SERVICE_USER}\"
|
||||||
(${SERVICE_USER}) $ echo 'source $GO_ENV' >> ~/.profile
|
(${SERVICE_USER}) $ echo 'source $GO_ENV' >> ~/.profile
|
||||||
(${SERVICE_USER}) $ mkdir ${SERVICE_HOME}/local
|
(${SERVICE_USER}) $ mkdir ${SERVICE_HOME}/local
|
||||||
(${SERVICE_USER}) $ wget --progress=bar -O \"${GO_TAR}\" \\
|
(${SERVICE_USER}) $ wget --progress=bar -O \"${GO_VERSION}.linux-amd64.tar.gz\" \\
|
||||||
\"${GO_PKG_URL}\"
|
\"${GO_DL_URL}/${GO_VERSION}.linux-amd64.tar.gz\"
|
||||||
(${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local -xzf \"${GO_TAR}\"
|
(${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local -xzf \"${GO_VERSION}.linux-amd64.tar.gz\"
|
||||||
(${SERVICE_USER}) $ which go
|
(${SERVICE_USER}) $ which go
|
||||||
${SERVICE_HOME}/local/go/bin/go
|
${SERVICE_HOME}/local/go/bin/go
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
|
|
||||||
.. tabs::
|
.. tabs::
|
||||||
|
|
||||||
.. group-tab:: bash
|
.. group-tab:: os: linux / arch: amd64
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
@ -30,9 +31,9 @@
|
||||||
$ sudo -i -u \"${SERVICE_USER}\"
|
$ sudo -i -u \"${SERVICE_USER}\"
|
||||||
(${SERVICE_USER}) $ echo 'source $GO_ENV' >> ~/.profile
|
(${SERVICE_USER}) $ echo 'source $GO_ENV' >> ~/.profile
|
||||||
(${SERVICE_USER}) $ mkdir ${SERVICE_HOME}/local
|
(${SERVICE_USER}) $ mkdir ${SERVICE_HOME}/local
|
||||||
(${SERVICE_USER}) $ wget --progress=bar -O \"${GO_TAR}\" \\
|
(${SERVICE_USER}) $ wget --progress=bar -O \"${GO_VERSION}.linux-amd64.tar.gz\" \\
|
||||||
\"${GO_PKG_URL}\"
|
\"${GO_DL_URL}/${GO_VERSION}.linux-amd64.tar.gz\"
|
||||||
(${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local -xzf \"${GO_TAR}\"
|
(${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local -xzf \"${GO_VERSION}.linux-amd64.tar.gz\"
|
||||||
(${SERVICE_USER}) $ which go
|
(${SERVICE_USER}) $ which go
|
||||||
${SERVICE_HOME}/local/go/bin/go
|
${SERVICE_HOME}/local/go/bin/go
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
# shellcheck source=utils/lib.sh
|
# shellcheck source=utils/lib.sh
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/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
|
# shellcheck source=utils/lib_install.sh
|
||||||
source "${REPO_ROOT}/utils/lib_install.sh"
|
source "${REPO_ROOT}/utils/lib_install.sh"
|
||||||
|
|
||||||
|
@ -43,8 +45,6 @@ SERVICE_GROUP="${SERVICE_USER}"
|
||||||
|
|
||||||
GO_ENV="${SERVICE_HOME}/.go_env"
|
GO_ENV="${SERVICE_HOME}/.go_env"
|
||||||
GO_VERSION="go1.17.2"
|
GO_VERSION="go1.17.2"
|
||||||
GO_PKG_URL="https://golang.org/dl/${GO_VERSION}.linux-amd64.tar.gz"
|
|
||||||
GO_TAR=$(basename "$GO_PKG_URL")
|
|
||||||
|
|
||||||
APACHE_FILTRON_SITE="searxng.conf"
|
APACHE_FILTRON_SITE="searxng.conf"
|
||||||
NGINX_FILTRON_SITE="searxng.conf"
|
NGINX_FILTRON_SITE="searxng.conf"
|
||||||
|
@ -218,7 +218,7 @@ install_all() {
|
||||||
rst_title "Install $SERVICE_NAME (service)"
|
rst_title "Install $SERVICE_NAME (service)"
|
||||||
assert_user
|
assert_user
|
||||||
wait_key
|
wait_key
|
||||||
install_go "${GO_PKG_URL}" "${GO_TAR}" "${SERVICE_USER}"
|
go.golang "${GO_VERSION}" "${SERVICE_USER}"
|
||||||
wait_key
|
wait_key
|
||||||
install_filtron
|
install_filtron
|
||||||
install_rules
|
install_rules
|
||||||
|
@ -301,9 +301,7 @@ install_check() {
|
||||||
}
|
}
|
||||||
|
|
||||||
go_version(){
|
go_version(){
|
||||||
sudo -i -u "$SERVICE_USER" <<EOF
|
go.version "${SERVICE_USER}"
|
||||||
go version | cut -d' ' -f 3
|
|
||||||
EOF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_all() {
|
remove_all() {
|
||||||
|
@ -338,12 +336,6 @@ EOF
|
||||||
export SERVICE_HOME
|
export SERVICE_HOME
|
||||||
echo "export SERVICE_HOME=$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"
|
tee_stderr <<EOF | sudo -i -u "$SERVICE_USER"
|
||||||
grep -qFs -- 'source $GO_ENV' ~/.profile || echo 'source $GO_ENV' >> ~/.profile
|
grep -qFs -- 'source $GO_ENV' ~/.profile || echo 'source $GO_ENV' >> ~/.profile
|
||||||
EOF
|
EOF
|
||||||
|
@ -353,22 +345,16 @@ filtron_is_installed() {
|
||||||
[[ -f $SERVICE_HOME/go-apps/bin/filtron ]]
|
[[ -f $SERVICE_HOME/go-apps/bin/filtron ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
_svcpr=" ${_Yellow}|${SERVICE_USER}|${_creset} "
|
|
||||||
|
|
||||||
install_filtron() {
|
install_filtron() {
|
||||||
rst_title "Install filtron in user's ~/go-apps" section
|
rst_title "Install filtron in user's ~/go-apps" section
|
||||||
echo
|
echo
|
||||||
tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" 2>&1 | prefix_stdout "$_svcpr"
|
go.install github.com/asciimoo/filtron@latest "${SERVICE_USER}"
|
||||||
go install -v github.com/asciimoo/filtron@latest
|
|
||||||
EOF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_filtron() {
|
update_filtron() {
|
||||||
rst_title "Update filtron" section
|
rst_title "Update filtron" section
|
||||||
echo
|
echo
|
||||||
tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" 2>&1 | prefix_stdout "$_svcpr"
|
go.install github.com/asciimoo/filtron@latest "${SERVICE_USER}"
|
||||||
go install -v github.com/asciimoo/filtron@latest
|
|
||||||
EOF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_rules() {
|
install_rules() {
|
||||||
|
|
35
utils/lib.sh
35
utils/lib.sh
|
@ -504,7 +504,6 @@ install_template() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
service_is_available() {
|
service_is_available() {
|
||||||
|
|
||||||
# usage: service_is_available <URL>
|
# usage: service_is_available <URL>
|
||||||
|
@ -825,40 +824,6 @@ EOF
|
||||||
build_msg GH-PAGES "deployed"
|
build_msg GH-PAGES "deployed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# golang
|
|
||||||
# ------
|
|
||||||
|
|
||||||
go_is_available() {
|
|
||||||
|
|
||||||
# usage: go_is_available $SERVICE_USER && echo "go is installed!"
|
|
||||||
|
|
||||||
sudo -i -u "${1}" which go &>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
install_go() {
|
|
||||||
|
|
||||||
# usage: install_go "${GO_PKG_URL}" "${GO_TAR}" "${SERVICE_USER}"
|
|
||||||
|
|
||||||
local _svcpr=" ${_Yellow}|${3}|${_creset} "
|
|
||||||
|
|
||||||
rst_title "Install Go in user's HOME" section
|
|
||||||
|
|
||||||
rst_para "download and install go binary .."
|
|
||||||
cache_download "${1}" "${2}"
|
|
||||||
|
|
||||||
tee_stderr 0.1 <<EOF | sudo -i -u "${3}" | prefix_stdout "$_svcpr"
|
|
||||||
echo \$PATH
|
|
||||||
echo \$GOPATH
|
|
||||||
mkdir -p \$HOME/local
|
|
||||||
rm -rf \$HOME/local/go
|
|
||||||
tar -C \$HOME/local -xzf ${CACHE}/${2}
|
|
||||||
EOF
|
|
||||||
sudo -i -u "${3}" <<EOF | prefix_stdout
|
|
||||||
! which go >/dev/null && echo "ERROR - Go Installation not found in PATH!?!"
|
|
||||||
which go >/dev/null && go version && echo "congratulations -- Go installation OK :)"
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# system accounts
|
# system accounts
|
||||||
# ---------------
|
# ---------------
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
# shellcheck source=utils/lib.sh
|
# shellcheck source=utils/lib.sh
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/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
|
# shellcheck source=utils/lib_install.sh
|
||||||
source "${REPO_ROOT}/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_ENV="${SERVICE_HOME}/.go_env"
|
||||||
GO_VERSION="go1.17.2"
|
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
|
# shellcheck disable=SC2034
|
||||||
CONFIG_FILES=()
|
CONFIG_FILES=()
|
||||||
|
@ -234,7 +234,7 @@ install_all() {
|
||||||
rst_title "Install $SERVICE_NAME (service)"
|
rst_title "Install $SERVICE_NAME (service)"
|
||||||
assert_user
|
assert_user
|
||||||
wait_key
|
wait_key
|
||||||
install_go "${GO_PKG_URL}" "${GO_TAR}" "${SERVICE_USER}"
|
go.golang "${GO_VERSION}" "${SERVICE_USER}"
|
||||||
wait_key
|
wait_key
|
||||||
install_morty
|
install_morty
|
||||||
wait_key
|
wait_key
|
||||||
|
@ -306,9 +306,7 @@ install_check() {
|
||||||
}
|
}
|
||||||
|
|
||||||
go_version(){
|
go_version(){
|
||||||
sudo -i -u "$SERVICE_USER" <<EOF
|
go.version "${SERVICE_USER}"
|
||||||
go version | cut -d' ' -f 3
|
|
||||||
EOF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_all() {
|
remove_all() {
|
||||||
|
@ -338,12 +336,6 @@ EOF
|
||||||
export SERVICE_HOME
|
export SERVICE_HOME
|
||||||
echo "export SERVICE_HOME=$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"
|
tee_stderr <<EOF | sudo -i -u "$SERVICE_USER"
|
||||||
grep -qFs -- 'source $GO_ENV' ~/.profile || echo 'source $GO_ENV' >> ~/.profile
|
grep -qFs -- 'source $GO_ENV' ~/.profile || echo 'source $GO_ENV' >> ~/.profile
|
||||||
EOF
|
EOF
|
||||||
|
@ -353,22 +345,16 @@ morty_is_installed() {
|
||||||
[[ -f $SERVICE_HOME/go-apps/bin/morty ]]
|
[[ -f $SERVICE_HOME/go-apps/bin/morty ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
_svcpr=" ${_Yellow}|${SERVICE_USER}|${_creset} "
|
|
||||||
|
|
||||||
install_morty() {
|
install_morty() {
|
||||||
rst_title "Install morty in user's ~/go-apps" section
|
rst_title "Install morty in user's ~/go-apps" section
|
||||||
echo
|
echo
|
||||||
tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" 2>&1 | prefix_stdout "$_svcpr"
|
go.install github.com/asciimoo/morty@latest "${SERVICE_USER}"
|
||||||
go install -v github.com/asciimoo/morty@latest
|
|
||||||
EOF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_morty() {
|
update_morty() {
|
||||||
rst_title "Update morty" section
|
rst_title "Update morty" section
|
||||||
echo
|
echo
|
||||||
tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" 2>&1 | prefix_stdout "$_svcpr"
|
go.install github.com/asciimoo/morty@latest "${SERVICE_USER}"
|
||||||
go install -v github.com/asciimoo/morty@latest
|
|
||||||
EOF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_service_env_debug() {
|
set_service_env_debug() {
|
||||||
|
|
Loading…
Reference in New Issue