Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#40-idoit-install-incorrectly-detects-mariadb-version #42

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions idoit-install
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ function identifyOS {
elif [[ "$NAME" == "Debian GNU/Linux" && "$VERSION" == "8 (jessie)" ]]; then
abort "Error: This version of Debian GNU/Linux is not supported anymore. Please upgrade to Debian 12."
elif [[ "$NAME" == "Red Hat Enterprise Linux" && "$VERSION_ID" == 8* ]]; then

OS="rhel8"
APACHE_USER="apache"
APACHE_GROUP="apache"
Expand Down Expand Up @@ -359,6 +360,7 @@ function identifyOS {
MEMCACHED_UNIT="memcached"
PHP_FPM_UNIT="php-fpm"
elif [[ "$NAME" == "SLES" && "$VERSION" == 15* ]]; then

OS="sles15"
INSTALL_DIR="/srv/www/htdocs"
APACHE_USER="wwwrun"
Expand All @@ -375,6 +377,7 @@ function identifyOS {
elif [[ "$NAME" = "SLES" && "$VERSION_ID" == 12* ]]; then
abort "Error: SLES 12 is out-dated. It's not supported anymore. Please upgrade."
elif [[ "$NAME" == "openSUSE Leap" && "$VERSION" == 15* ]]; then

OS="opensuse15"
INSTALL_DIR="/srv/www/htdocs"
APACHE_USER="wwwrun"
Expand All @@ -392,6 +395,7 @@ function identifyOS {
abort "Error: openSUSE 12 is out-dated. It's not supported anymore. Please upgrade."
elif [[ "$NAME" == "Ubuntu" && "$VERSION_ID" == "22.04" ]]; then
export DEBIAN_FRONTEND="noninteractive"

OS="ubuntu2204"
APACHE_USER="www-data"
APACHE_GROUP="www-data"
Expand All @@ -406,6 +410,7 @@ function identifyOS {
PHP_FPM_UNIT="php8.1-fpm"
elif [[ "$NAME" == "Ubuntu" && "$VERSION_ID" == "20.04" ]]; then
export DEBIAN_FRONTEND="noninteractive"

OS="ubuntu2004"
APACHE_USER="www-data"
APACHE_GROUP="www-data"
Expand Down Expand Up @@ -1387,7 +1392,7 @@ EOF
"$a2_en_mod" rewrite || abort "Unable to enable Apache module rewrite"
log "Let every user read the logs"
chmod 755 /var/log/apache2 || abort "Unable to change permissions"
chmod 664 /var/log/apache2/* || abort "Unable to change permissions"
chmod 664 /var/log/apache2/ || abort "Unable to change permissions"
unitctl "restart" "$APACHE_UNIT"
;;
esac
Expand All @@ -1406,7 +1411,7 @@ function configureMariaDB {

# Check mariadb version
local mariadb_version=""
mariadb_version=$(mysql --version | head -n1 -c29 | tail -c 5)
mariadb_version=$(mysql --version | head -n1 | sed -e 's/.* Distrib \([0-9]*\.[0-9]*\)\.[0-9]*.*/\1/')

log "Prepare shutdown of MariaDB"
"$MARIADB_BIN" \
Expand Down Expand Up @@ -1505,15 +1510,17 @@ EOF
if [[ -d "/var/log/mysql" ]]; then
log "Let every user read the logs"
chmod 755 /var/log/mysql
chmod 664 /var/log/mysql/*
chmod 664 /var/log/mysql/
fi

unitctl "start" "$MARIADB_UNIT"
MichaelOv marked this conversation as resolved.
Show resolved Hide resolved
unitctl "start" "$MARIADB_UNIT"

}

function secureMariaDB {

local mariadb_version=""
mariadb_version=$(mysql --version | head -n1 -c29 | tail -c 5)
mariadb_version=$(mysql --version | head -n1 | sed -e 's/.* Distrib \([0-9]*\.[0-9]*\)\.[0-9]*.*/\1/')

echo -n -e \
"Please enter a new password for MariaDB's super user '${MARIADB_SUPERUSER_USERNAME}' [leave empty for '${MARIADB_SUPERUSER_PASSWORD}']: "
Expand Down Expand Up @@ -1762,7 +1769,7 @@ function installIDoit {
MARIADB_IDOIT_PASSWORD="$mariaDBidoitPassword"
fi

sudo -u ${APACHE_USER} ${prefix} ${console} install \
sudo -u "${APACHE_USER}" "${prefix}" "${console}" install \
-u "$MARIADB_SUPERUSER_USERNAME" \
-p "$MARIADB_SUPERUSER_PASSWORD" \
--host="$MARIADB_HOSTNAME" \
Expand Down Expand Up @@ -1793,7 +1800,7 @@ function create_tenant {
tenant_name="$tenantName"
fi

sudo -u ${APACHE_USER} ${prefix} ${console} tenant-create \
sudo -u "${APACHE_USER}" "${prefix}" "${console}" tenant-create \
-u "$MARIADB_SUPERUSER_USERNAME" \
-p "$MARIADB_SUPERUSER_PASSWORD" \
-U "$MARIADB_IDOIT_USERNAME" \
Expand Down
Loading