mirror of
https://github.com/ilyakooo0/searx.git
synced 2024-11-29 10:42:18 +03:00
Utility scripts adapted to run on CentOS 7 (#2112)
This commit is contained in:
parent
0e5197123d
commit
1986b5ecac
@ -546,7 +546,7 @@ EOF
|
||||
eval "echo \"$(< "${TEMPLATES}/${SERVICE_SYSTEMD_UNIT}")\"" | prefix_stdout " "
|
||||
echo -e "\n.. END install systemd unit"
|
||||
|
||||
# for DIST_NAME in ubuntu-20.04 arch fedora; do
|
||||
# for DIST_NAME in ubuntu-20.04 arch fedora centos; do
|
||||
# (
|
||||
# DIST_ID=${DIST_NAME%-*}
|
||||
# DIST_VERS=${DIST_NAME#*-}
|
||||
|
54
utils/lib.sh
54
utils/lib.sh
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# shellcheck disable=SC2059,SC1117
|
||||
|
||||
# ubuntu, debian, arch, fedora ...
|
||||
# ubuntu, debian, arch, fedora, centos ...
|
||||
DIST_ID=$(source /etc/os-release; echo "$ID");
|
||||
# shellcheck disable=SC2034
|
||||
DIST_VERS=$(source /etc/os-release; echo "$VERSION_ID");
|
||||
@ -639,7 +639,7 @@ nginx_distro_setup() {
|
||||
NGINX_DEFAULT_SERVER=/etc/nginx/nginx.conf
|
||||
|
||||
# Including *location* directives from a dedicated config-folder into the
|
||||
# server directive is, what what fedora (already) does.
|
||||
# server directive is, what what fedora and centos (already) does.
|
||||
NGINX_APPS_ENABLED="/etc/nginx/default.d"
|
||||
|
||||
# We add a apps-available folder and linking configurations into the
|
||||
@ -654,7 +654,7 @@ nginx_distro_setup() {
|
||||
arch-*)
|
||||
NGINX_PACKAGES="nginx-mainline"
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
NGINX_PACKAGES="nginx"
|
||||
;;
|
||||
*)
|
||||
@ -668,7 +668,7 @@ install_nginx(){
|
||||
info_msg "installing nginx ..."
|
||||
pkg_install "${NGINX_PACKAGES}"
|
||||
case $DIST_ID-$DIST_VERS in
|
||||
arch-*|fedora-*)
|
||||
arch-*|fedora-*|centos-7)
|
||||
systemctl enable nginx
|
||||
systemctl start nginx
|
||||
;;
|
||||
@ -718,7 +718,7 @@ nginx_install_app() {
|
||||
nginx_include_apps_enabled() {
|
||||
|
||||
# Add the *NGINX_APPS_ENABLED* infrastruture to a nginx server block. Such
|
||||
# infrastruture is already known from fedora, including apps (location
|
||||
# infrastruture is already known from fedora and centos, including apps (location
|
||||
# directives) from the /etc/nginx/default.d folder into the *default* nginx
|
||||
# server.
|
||||
|
||||
@ -819,7 +819,7 @@ apache_distro_setup() {
|
||||
APACHE_MODULES="modules"
|
||||
APACHE_PACKAGES="apache"
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
APACHE_SITES_AVAILABLE="/etc/httpd/sites-available"
|
||||
APACHE_SITES_ENABLED="/etc/httpd/sites-enabled"
|
||||
APACHE_MODULES="modules"
|
||||
@ -837,7 +837,7 @@ install_apache(){
|
||||
info_msg "installing apache ..."
|
||||
pkg_install "$APACHE_PACKAGES"
|
||||
case $DIST_ID-$DIST_VERS in
|
||||
arch-*|fedora-*)
|
||||
arch-*|fedora-*|centos-7)
|
||||
if ! grep "IncludeOptional sites-enabled" "/etc/httpd/conf/httpd.conf"; then
|
||||
echo "IncludeOptional sites-enabled/*.conf" >> "/etc/httpd/conf/httpd.conf"
|
||||
fi
|
||||
@ -851,7 +851,7 @@ apache_is_installed() {
|
||||
case $DIST_ID-$DIST_VERS in
|
||||
ubuntu-*|debian-*) (command -v apachectl) &>/dev/null;;
|
||||
arch-*) (command -v httpd) &>/dev/null;;
|
||||
fedora-*) (command -v httpd) &>/dev/null;;
|
||||
fedora-*|centos-7) (command -v httpd) &>/dev/null;;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -864,7 +864,7 @@ apache_reload() {
|
||||
sudo -H apachectl configtest
|
||||
sudo -H systemctl force-reload apache2
|
||||
;;
|
||||
arch-*| fedora-*)
|
||||
arch-*|fedora-*|centos-7)
|
||||
sudo -H httpd -t
|
||||
sudo -H systemctl force-reload httpd
|
||||
;;
|
||||
@ -920,7 +920,7 @@ apache_enable_site() {
|
||||
rm -f "${APACHE_SITES_ENABLED}/${CONF}"
|
||||
ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
mkdir -p "${APACHE_SITES_ENABLED}"
|
||||
rm -f "${APACHE_SITES_ENABLED}/${CONF}"
|
||||
ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
|
||||
@ -944,7 +944,7 @@ apache_dissable_site() {
|
||||
arch-*)
|
||||
rm -f "${APACHE_SITES_ENABLED}/${CONF}"
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
rm -f "${APACHE_SITES_ENABLED}/${CONF}"
|
||||
;;
|
||||
esac
|
||||
@ -980,7 +980,7 @@ uWSGI_distro_setup() {
|
||||
uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
|
||||
uWSGI_PACKAGES="uwsgi"
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
# systemd --> /usr/lib/systemd/system/uwsgi.service
|
||||
# The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
|
||||
# - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
|
||||
@ -1002,7 +1002,7 @@ install_uwsgi(){
|
||||
info_msg "installing uwsgi ..."
|
||||
pkg_install "$uWSGI_PACKAGES"
|
||||
case $DIST_ID-$DIST_VERS in
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
# enable & start should be called once at uWSGI installation time
|
||||
systemctl enable uwsgi
|
||||
systemctl restart uwsgi
|
||||
@ -1032,7 +1032,7 @@ uWSGI_restart() {
|
||||
info_msg "[uWSGI:systemd-template] ${CONF} not installed (no need to restart)"
|
||||
fi
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
# in emperor mode, just touch the file to restart
|
||||
if uWSGI_app_enabled "${CONF}"; then
|
||||
touch "${uWSGI_APPS_ENABLED}/${CONF}"
|
||||
@ -1059,7 +1059,7 @@ uWSGI_prepare_app() {
|
||||
local APP="${1%.*}"
|
||||
|
||||
case $DIST_ID-$DIST_VERS in
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
# in emperor mode, the uwsgi user is the owner of the sockets
|
||||
info_msg "prepare (uwsgi:uwsgi) /run/uwsgi/app/${APP}"
|
||||
mkdir -p "/run/uwsgi/app/${APP}"
|
||||
@ -1135,7 +1135,7 @@ uWSGI_app_enabled() {
|
||||
systemctl -q is-enabled "uwsgi@${CONF%.*}"
|
||||
exit_val=$?
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
[[ -f "${uWSGI_APPS_ENABLED}/${CONF}" ]]
|
||||
exit_val=$?
|
||||
;;
|
||||
@ -1170,7 +1170,7 @@ uWSGI_enable_app() {
|
||||
systemctl enable "uwsgi@${CONF%.*}"
|
||||
info_msg "enabled uWSGI app: ${CONF} (restart required)"
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
mkdir -p "${uWSGI_APPS_ENABLED}"
|
||||
rm -f "${uWSGI_APPS_ENABLED}/${CONF}"
|
||||
ln -s "${uWSGI_APPS_AVAILABLE}/${CONF}" "${uWSGI_APPS_ENABLED}/${CONF}"
|
||||
@ -1202,7 +1202,7 @@ uWSGI_disable_app() {
|
||||
systemctl disable "uwsgi@${CONF%.*}"
|
||||
rm -f "${uWSGI_APPS_ENABLED}/${CONF}"
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
# in emperor mode, just remove the app.ini file
|
||||
rm -f "${uWSGI_APPS_ENABLED}/${CONF}"
|
||||
;;
|
||||
@ -1247,6 +1247,10 @@ pkg_install() {
|
||||
# shellcheck disable=SC2068
|
||||
dnf install -y $@
|
||||
;;
|
||||
centos)
|
||||
# shellcheck disable=SC2068
|
||||
yum install -y $@
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -1275,6 +1279,10 @@ pkg_remove() {
|
||||
# shellcheck disable=SC2068
|
||||
dnf remove -y $@
|
||||
;;
|
||||
centos)
|
||||
# shellcheck disable=SC2068
|
||||
yum remove -y $@
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -1295,6 +1303,10 @@ pkg_is_installed() {
|
||||
dnf list -q --installed "$1" &> /dev/null
|
||||
return $?
|
||||
;;
|
||||
centos)
|
||||
yum list -q --installed "$1" &> /dev/null
|
||||
return $?
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -1395,10 +1407,14 @@ LXC_BASE_PACKAGES_arch="bash git base-devel python python-virtualenv"
|
||||
# dnf packages
|
||||
LXC_BASE_PACKAGES_fedora="bash git @development-tools python virtualenv"
|
||||
|
||||
# yum packages
|
||||
LXC_BASE_PACKAGES_centos="bash git @development-tools python python-virtualenv"
|
||||
|
||||
case $DIST_ID in
|
||||
ubuntu|debian) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_debian}" ;;
|
||||
arch) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_arch}" ;;
|
||||
fedora) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_fedora}" ;;
|
||||
fedora) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_fedora}" ;;
|
||||
centos) LXC_BASE_PACKAGES="${LXC_BASE_PACKAGES_centos}" ;;
|
||||
*) err_msg "$DIST_ID-$DIST_VERS: pkg_install LXC_BASE_PACKAGES not yet implemented" ;;
|
||||
esac
|
||||
|
||||
|
@ -54,6 +54,13 @@ dnf install -y git curl wget hostname
|
||||
echo 'Set disable_coredump false' >> /etc/sudo.conf
|
||||
"
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
centos7_boilerplate="
|
||||
yum update -y
|
||||
yum install -y git curl wget hostname
|
||||
echo 'Set disable_coredump false' >> /etc/sudo.conf
|
||||
"
|
||||
|
||||
REMOTE_IMAGES=()
|
||||
CONTAINERS=()
|
||||
LOCAL_IMAGES=()
|
||||
|
@ -530,7 +530,7 @@ EOF
|
||||
eval "echo \"$(< "${TEMPLATES}/${SERVICE_SYSTEMD_UNIT}")\"" | prefix_stdout " "
|
||||
echo -e "\n.. END install systemd unit"
|
||||
|
||||
# for DIST_NAME in ubuntu-20.04 arch fedora; do
|
||||
# for DIST_NAME in ubuntu-20.04 arch fedora centos; do
|
||||
# (
|
||||
# DIST_ID=${DIST_NAME%-*}
|
||||
# DIST_VERS=${DIST_NAME#*-}
|
||||
|
@ -76,6 +76,19 @@ texlive-xetex-bin texlive-collection-fontsrecommended
|
||||
texlive-collection-latex dejavu-sans-fonts dejavu-serif-fonts
|
||||
dejavu-sans-mono-fonts"
|
||||
|
||||
# yum packages
|
||||
SEARX_PACKAGES_centos="\
|
||||
python36-virtualenv python36 python36-pip python36-lxml python-babel
|
||||
uwsgi uwsgi-plugin-python3
|
||||
git @development-tools libxml2
|
||||
ShellCheck"
|
||||
|
||||
BUILD_PACKAGES_centos="\
|
||||
firefox graphviz graphviz-gd ImageMagick librsvg2-tools
|
||||
texlive-xetex-bin texlive-collection-fontsrecommended
|
||||
texlive-collection-latex dejavu-sans-fonts dejavu-serif-fonts
|
||||
dejavu-sans-mono-fonts"
|
||||
|
||||
case $DIST_ID-$DIST_VERS in
|
||||
ubuntu-16.04|ubuntu-18.04)
|
||||
SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
|
||||
@ -99,6 +112,10 @@ case $DIST_ID-$DIST_VERS in
|
||||
SEARX_PACKAGES="${SEARX_PACKAGES_fedora}"
|
||||
BUILD_PACKAGES="${BUILD_PACKAGES_fedora}"
|
||||
;;
|
||||
centos-7)
|
||||
SEARX_PACKAGES="${SEARX_PACKAGES_centos}"
|
||||
BUILD_PACKAGES="${BUILD_PACKAGES_centos}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Apache Settings
|
||||
@ -714,7 +731,7 @@ EOF
|
||||
arch-*)
|
||||
systemctl --no-pager -l status "uwsgi@${SERVICE_NAME%.*}"
|
||||
;;
|
||||
fedora-*)
|
||||
fedora-*|centos-7)
|
||||
systemctl --no-pager -l status uwsgi
|
||||
;;
|
||||
esac
|
||||
@ -729,7 +746,7 @@ EOF
|
||||
case $DIST_ID-$DIST_VERS in
|
||||
ubuntu-*|debian-*) tail -f /var/log/uwsgi/app/searx.log ;;
|
||||
arch-*) journalctl -f -u "uwsgi@${SERVICE_NAME%.*}" ;;
|
||||
fedora-*) journalctl -f -u uwsgi ;;
|
||||
fedora-*|centos-7) journalctl -f -u uwsgi ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@ -790,22 +807,26 @@ rst-doc() {
|
||||
local debian="${SEARX_PACKAGES_debian}"
|
||||
local arch="${SEARX_PACKAGES_arch}"
|
||||
local fedora="${SEARX_PACKAGES_fedora}"
|
||||
local centos="${SEARX_PACKAGES_centos}"
|
||||
local debian_build="${BUILD_PACKAGES_debian}"
|
||||
local arch_build="${BUILD_PACKAGES_arch}"
|
||||
local fedora_build="${BUILD_PACKAGES_fedora}"
|
||||
local centos_build="${SEARX_PACKAGES_centos}"
|
||||
debian="$(echo "${debian}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
|
||||
arch="$(echo "${arch}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
|
||||
fedora="$(echo "${fedora}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
|
||||
centos="$(echo "${centos}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
|
||||
debian_build="$(echo "${debian_build}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
|
||||
arch_build="$(echo "${arch_build}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
|
||||
fedora_build="$(echo "${fedora_build}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
|
||||
centos_build="$(echo "${centos_build}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
|
||||
|
||||
eval "echo \"$(< "${REPO_ROOT}/docs/build-templates/searx.rst")\""
|
||||
|
||||
# I use ubuntu-20.04 here to demonstrate that versions are also suported,
|
||||
# normaly debian-* and ubuntu-* are most the same.
|
||||
|
||||
for DIST_NAME in ubuntu-20.04 arch fedora; do
|
||||
for DIST_NAME in ubuntu-20.04 arch fedora centos; do
|
||||
(
|
||||
DIST_ID=${DIST_NAME%-*}
|
||||
DIST_VERS=${DIST_NAME#*-}
|
||||
@ -850,7 +871,7 @@ EOF
|
||||
|
||||
EOF
|
||||
;;
|
||||
fedora-*) cat <<EOF
|
||||
fedora-*|centos-7) cat <<EOF
|
||||
|
||||
.. code:: bash
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user