Skip to content

Commit f0e5d55

Browse files
authored
Merge pull request #42 from i-doit/40-idoit-install-incorrectly-detects-mariadb-version
#40-idoit-install-incorrectly-detects-mariadb-version
2 parents 3c1010e + 95079c4 commit f0e5d55

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

idoit-install

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ function identifyOS {
330330
elif [[ "$NAME" == "Debian GNU/Linux" && "$VERSION" == "8 (jessie)" ]]; then
331331
abort "Error: This version of Debian GNU/Linux is not supported anymore. Please upgrade to Debian 12."
332332
elif [[ "$NAME" == "Red Hat Enterprise Linux" && "$VERSION_ID" == 8* ]]; then
333+
333334
OS="rhel8"
334335
APACHE_USER="apache"
335336
APACHE_GROUP="apache"
@@ -359,6 +360,7 @@ function identifyOS {
359360
MEMCACHED_UNIT="memcached"
360361
PHP_FPM_UNIT="php-fpm"
361362
elif [[ "$NAME" == "SLES" && "$VERSION" == 15* ]]; then
363+
362364
OS="sles15"
363365
INSTALL_DIR="/srv/www/htdocs"
364366
APACHE_USER="wwwrun"
@@ -375,6 +377,7 @@ function identifyOS {
375377
elif [[ "$NAME" = "SLES" && "$VERSION_ID" == 12* ]]; then
376378
abort "Error: SLES 12 is out-dated. It's not supported anymore. Please upgrade."
377379
elif [[ "$NAME" == "openSUSE Leap" && "$VERSION" == 15* ]]; then
380+
378381
OS="opensuse15"
379382
INSTALL_DIR="/srv/www/htdocs"
380383
APACHE_USER="wwwrun"
@@ -408,6 +411,7 @@ function identifyOS {
408411
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."
409412
elif [[ "$NAME" == "Ubuntu" && "$VERSION_ID" == "22.04" ]]; then
410413
export DEBIAN_FRONTEND="noninteractive"
414+
411415
OS="ubuntu2204"
412416
APACHE_USER="www-data"
413417
APACHE_GROUP="www-data"
@@ -422,6 +426,7 @@ function identifyOS {
422426
PHP_FPM_UNIT="php8.1-fpm"
423427
elif [[ "$NAME" == "Ubuntu" && "$VERSION_ID" == "20.04" ]]; then
424428
export DEBIAN_FRONTEND="noninteractive"
429+
425430
OS="ubuntu2004"
426431
APACHE_USER="www-data"
427432
APACHE_GROUP="www-data"
@@ -1428,7 +1433,7 @@ EOF
14281433
"$a2_en_mod" rewrite || abort "Unable to enable Apache module rewrite"
14291434
log "Let every user read the logs"
14301435
chmod 755 /var/log/apache2 || abort "Unable to change permissions"
1431-
chmod 664 /var/log/apache2/* || abort "Unable to change permissions"
1436+
chmod 664 /var/log/apache2/ || abort "Unable to change permissions"
14321437
unitctl "restart" "$APACHE_UNIT"
14331438
;;
14341439
esac
@@ -1447,7 +1452,7 @@ function configureMariaDB {
14471452

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

14521457
log "Prepare shutdown of MariaDB"
14531458
"$MARIADB_BIN" \
@@ -1546,15 +1551,17 @@ EOF
15461551
if [[ -d "/var/log/mysql" ]]; then
15471552
log "Let every user read the logs"
15481553
chmod 755 /var/log/mysql
1549-
chmod 664 /var/log/mysql/*
1554+
chmod 664 /var/log/mysql/
15501555
fi
15511556

1552-
unitctl "start" "$MARIADB_UNIT"
1557+
unitctl "start" "$MARIADB_UNIT"
1558+
15531559
}
15541560

15551561
function secureMariaDB {
1562+
15561563
local mariadb_version=""
1557-
mariadb_version=$(mysql --version | head -n1 -c29 | tail -c 5)
1564+
mariadb_version=$(mysql --version | head -n1 | sed -e 's/.* Distrib \([0-9]*\.[0-9]*\)\.[0-9]*.*/\1/')
15581565

15591566
echo -n -e \
15601567
"Please enter a new password for MariaDB's super user '${MARIADB_SUPERUSER_USERNAME}' [leave empty for '${MARIADB_SUPERUSER_PASSWORD}']: "
@@ -1803,7 +1810,7 @@ function installIDoit {
18031810
MARIADB_IDOIT_PASSWORD="$mariaDBidoitPassword"
18041811
fi
18051812

1806-
sudo -u ${APACHE_USER} ${prefix} ${console} install \
1813+
sudo -u "${APACHE_USER}" "${prefix}" "${console}" install \
18071814
-u "$MARIADB_SUPERUSER_USERNAME" \
18081815
-p "$MARIADB_SUPERUSER_PASSWORD" \
18091816
--host="$MARIADB_HOSTNAME" \
@@ -1834,7 +1841,7 @@ function create_tenant {
18341841
tenant_name="$tenantName"
18351842
fi
18361843

1837-
sudo -u ${APACHE_USER} ${prefix} ${console} tenant-create \
1844+
sudo -u "${APACHE_USER}" "${prefix}" "${console}" tenant-create \
18381845
-u "$MARIADB_SUPERUSER_USERNAME" \
18391846
-p "$MARIADB_SUPERUSER_PASSWORD" \
18401847
-U "$MARIADB_IDOIT_USERNAME" \

0 commit comments

Comments
 (0)