Skip to content

Commit

Permalink
Merge pull request #42 from i-doit/40-idoit-install-incorrectly-detec…
Browse files Browse the repository at this point in the history
…ts-mariadb-version

#40-idoit-install-incorrectly-detects-mariadb-version
  • Loading branch information
MichaelOv authored Sep 18, 2024
2 parents 3c1010e + 95079c4 commit f0e5d55
Showing 1 changed file with 14 additions and 7 deletions.
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 Down Expand Up @@ -408,6 +411,7 @@ function identifyOS {
abort "Error: Ubuntu 24.04 is using PHP 8.3 which is actually not supported by i-doit. See https://kb.i-doit.com/en/installation/system-requirements.html. \nPlease use Ubuntu 22.04 or install i-doit manually with PHP 8.2."
elif [[ "$NAME" == "Ubuntu" && "$VERSION_ID" == "22.04" ]]; then
export DEBIAN_FRONTEND="noninteractive"

OS="ubuntu2204"
APACHE_USER="www-data"
APACHE_GROUP="www-data"
Expand All @@ -422,6 +426,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 @@ -1428,7 +1433,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 @@ -1447,7 +1452,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 @@ -1546,15 +1551,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"
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 @@ -1803,7 +1810,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 @@ -1834,7 +1841,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

0 comments on commit f0e5d55

Please sign in to comment.