summaryrefslogtreecommitdiff
path: root/utils/lib_redis.sh
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2022-05-27 18:43:14 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2022-07-30 13:39:35 +0200
commit782f73540e2d383ea122716507ccd9582918ab51 (patch)
tree2cca6c47e63cdf383883a2a47ac8329e629bb40d /utils/lib_redis.sh
parent81bba4486916dbca4467a7e8c8b839a7c55c2a09 (diff)
downloadsearxng-782f73540e2d383ea122716507ccd9582918ab51.tar.gz
searxng-782f73540e2d383ea122716507ccd9582918ab51.zip
[utils/searxng.sh] implement new script to install SearXNG
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/lib_redis.sh')
-rwxr-xr-xutils/lib_redis.sh27
1 files changed, 17 insertions, 10 deletions
diff --git a/utils/lib_redis.sh b/utils/lib_redis.sh
index 5eaa1770f..ba1435a86 100755
--- a/utils/lib_redis.sh
+++ b/utils/lib_redis.sh
@@ -42,6 +42,8 @@ REDIS_GIT_URL="https://github.com/redis/redis.git"
REDIS_GIT_TAG="${REDIS_GIT_TAG:-6.2.6}"
REDIS_USER="searxng-redis"
+REDIS_GROUP="searxng-redis"
+
REDIS_HOME="/usr/local/${REDIS_USER}"
REDIS_HOME_BIN="${REDIS_HOME}/.local/bin"
REDIS_ENV="${REDIS_HOME}/.redis_env"
@@ -113,7 +115,7 @@ redis.devpkg() {
case ${DIST_ID} in
ubuntu|debian)
- pkg_install git build-essential
+ pkg_install git build-essential gawk
;;
arch)
pkg_install git base-devel
@@ -139,15 +141,20 @@ redis.build() {
rst_title "get redis sources" section
redis.src "${CACHE}/redis"
- if ! required_commands gcc nm make gawk; then
- sudo -H "$0" redis.devpkg
+ if ! required_commands gcc nm make gawk ; then
+ info_msg "install development tools to get missing command(s) .."
+ if [[ -n ${SUDO_USER} ]]; then
+ sudo -H "$0" redis.devpkg
+ else
+ redis.devpkg
+ fi
fi
rst_title "compile redis sources" section
pushd "${CACHE}/redis" &>/dev/null
- if ask_yn "Do you run 'make distclean' first'?" Ny; then
+ if ask_yn "Do you run 'make distclean' first'?" Yn; then
$(bash.cmd) -c "make distclean" 2>&1 | prefix_stdout
fi
@@ -158,7 +165,7 @@ redis.build() {
popd &>/dev/null
- tee_stderr 0.1 <<EOF | $(bash.cmd) 2>&1 | prefix_stdout
+ tee_stderr 0.1 <<EOF | $(bash.cmd) 2>&1 | prefix_stdout
mkdir -p "$(redis._get_dist)"
cd "${CACHE}/redis/src"
cp ${REDIS_INSTALL_EXE[@]} "$(redis._get_dist)"
@@ -233,7 +240,7 @@ useradd --shell /bin/bash --system \
--home-dir "${REDIS_HOME}" \
--comment 'user that runs a redis instance' "${REDIS_USER}"
mkdir -p "${REDIS_HOME}"
-chown -R "${REDIS_USER}:${REDIS_USER}" "${REDIS_HOME}"
+chown -R "${REDIS_USER}:${REDIS_GROUP}" "${REDIS_HOME}"
groups "${REDIS_USER}"
EOF
@@ -248,7 +255,7 @@ EOF
redis.userdel() {
sudo_or_exit
drop_service_account "${REDIS_USER}"
- groupdel "${REDIS_USER}" 2>&1 | prefix_stdout || true
+ groupdel "${REDIS_GROUP}" 2>&1 | prefix_stdout || true
}
redis.addgrp() {
@@ -256,7 +263,7 @@ redis.addgrp() {
# usage: redis.addgrp <user>
[[ -z $1 ]] && die_caller 42 "missing argument <user>"
- sudo -H gpasswd -a "$1" "${REDIS_USER}"
+ sudo -H gpasswd -a "$1" "${REDIS_GROUP}"
}
redis.rmgrp() {
@@ -264,7 +271,7 @@ redis.rmgrp() {
# usage: redis.rmgrp <user>
[[ -z $1 ]] && die_caller 42 "missing argument <user>"
- sudo -H gpasswd -d "$1" "${REDIS_USER}"
+ sudo -H gpasswd -d "$1" "${REDIS_GROUP}"
}
@@ -278,7 +285,7 @@ redis._install_bin() {
(
set -e
for redis_exe in "${REDIS_INSTALL_EXE[@]}"; do
- install -v -o "${REDIS_USER}" -g "${REDIS_USER}" \
+ install -v -o "${REDIS_USER}" -g "${REDIS_GROUP}" \
"${src}/${redis_exe}" "${REDIS_HOME_BIN}"
done