Skip to content

Commit 639dfa2

Browse files
committed
feat: update to v11
1 parent 5a7020b commit 639dfa2

File tree

1 file changed

+28
-68
lines changed

1 file changed

+28
-68
lines changed

glpi-start.sh

Lines changed: 28 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,18 @@
11
#!/bin/bash
22
LOGS="install_glpi.log"
3-
cat <<EOF > $LOGS
3+
cat <<EOF >$LOGS
44
55
====================================================
66
## VARIAVEIS
77
88
====================================================
99
EOF
1010
## Setup PHP
11-
echo "Remove old PHP..."
12-
13-
yum -y remove \
14-
php-cli \
15-
mod_php \
16-
php-common
17-
18-
echo "Install ..."
19-
20-
yum -y install \
21-
mod_php \
22-
php-cli \
23-
php-mysqlnd
24-
25-
yum -y install \
26-
php-pear-CAS \
27-
wget \
28-
php-json \
29-
php-mbstring \
30-
php-mysqli \
31-
php-session \
32-
php-gd \
33-
php-curl \
34-
php-domxml \
35-
php-imap \
36-
php-ldap \
37-
php-openssl \
38-
php-opcache \
39-
php-apcu \
40-
php-xmlrpc \
41-
php-intl \
42-
php-zip \
43-
php-sodium \
44-
jq \
45-
openssl
46-
47-
48-
# Setup PHP Ini
11+
12+
# Setup PHP Ini
4913
echo "Setting 99-glpi.ini..."
5014

51-
cat <<EOF > /etc/php.d/99-glpi.ini
15+
cat <<EOF >/etc/php.d/99-glpi.ini
5216
memory_limit = 64M ;
5317
file_uploads = on ;
5418
max_execution_time = 600 ;
@@ -58,20 +22,19 @@ session.auto_start = off ;
5822
session.use_trans_sid = 0 ;
5923
EOF
6024

61-
cat <<EOF > /etc/php.d/99-apcu.ini
25+
cat <<EOF >/etc/php.d/99-apcu.ini
6226
apc.enable_cli = 1 ;
6327
EOF
6428

65-
66-
6729
#Controle du choix de version ou prise de la latest
68-
[[ ! "$VERSION_GLPI" ]] \
69-
&& VERSION_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep tag_name | cut -d '"' -f 4)
30+
[[ ! "$VERSION_GLPI" ]] &&
31+
VERSION_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep tag_name | cut -d '"' -f 4)
7032

71-
if [[ -z "${TIMEZONE}" ]]; then echo "TIMEZONE is unset";
72-
else
73-
echo "date.timezone = \"$TIMEZONE\"" > /etc/php/8.3/apache2/conf.d/timezone.ini;
74-
echo "date.timezone = \"$TIMEZONE\"" > /etc/php/8.3/cli/conf.d/timezone.ini;
33+
if [[ -z "${TIMEZONE}" ]]; then
34+
echo "TIMEZONE is unset"
35+
else
36+
echo "date.timezone = \"$TIMEZONE\"" >/etc/php/8.3/apache2/conf.d/timezone.ini
37+
echo "date.timezone = \"$TIMEZONE\"" >/etc/php/8.3/cli/conf.d/timezone.ini
7538
fi
7639

7740
#Enable session.cookie_httponly
@@ -81,15 +44,13 @@ FOLDER_GLPI=glpi/
8144
FOLDER_WEB=/var/www/html/
8245

8346
#check if TLS_REQCERT is present
84-
if !(grep -q "TLS_REQCERT" /etc/ldap/ldap.conf)
85-
then
47+
if !(grep -q "TLS_REQCERT" /etc/ldap/ldap.conf); then
8648
echo "TLS_REQCERT isn't present"
87-
echo -e "TLS_REQCERT\tnever" >> /etc/ldap/ldap.conf
49+
echo -e "TLS_REQCERT\tnever" >>/etc/ldap/ldap.conf
8850
fi
8951

9052
#Téléchargement et extraction des sources de GLPI
91-
if [ "$(ls ${FOLDER_WEB}${FOLDER_GLPI}/bin)" ];
92-
then
53+
if [ "$(ls ${FOLDER_WEB}${FOLDER_GLPI}/bin)" ]; then
9354
echo "GLPI is already installed"
9455
else
9556
SRC_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/tags/${VERSION_GLPI} | jq .assets[0].browser_download_url | tr -d \")
@@ -110,36 +71,35 @@ LOCAL_GLPI_MAJOR_VERSION=$(echo $LOCAL_GLPI_VERSION | cut -d. -f1)
11071
LOCAL_GLPI_VERSION_NUM=${LOCAL_GLPI_VERSION//./}
11172

11273
## Target value is GLPI 1.0.7
113-
TARGET_GLPI_VERSION="10.0.19"
74+
TARGET_GLPI_VERSION="11.0.0"
11475
TARGET_GLPI_VERSION_NUM=${TARGET_GLPI_VERSION//./}
11576
TARGET_GLPI_MAJOR_VERSION=$(echo $TARGET_GLPI_VERSION | cut -d. -f1)
11677

11778
# Compare the numeric value of the version number to the target number
11879
if [[ $LOCAL_GLPI_VERSION_NUM -lt $TARGET_GLPI_VERSION_NUM || $LOCAL_GLPI_MAJOR_VERSION -lt $TARGET_GLPI_MAJOR_VERSION ]]; then
119-
echo -e "<VirtualHost *:80>\n\tDocumentRoot /var/www/html/glpi\n\n\t<Directory /var/www/html/glpi>\n\t\tAllowOverride All\n\t\tOrder Allow,Deny\n\t\tAllow from all\n\t</Directory>\n\n\tErrorLog /var/log/apache2/error-glpi.log\n\tLogLevel warn\n\tCustomLog /var/log/apache2/access-glpi.log combined\n</VirtualHost>" > /etc/apache2/sites-available/000-default.conf
80+
echo -e "<VirtualHost *:80>\n\tDocumentRoot /var/www/html/glpi\n\n\t<Directory /var/www/html/glpi>\n\t\tAllowOverride All\n\t\tOrder Allow,Deny\n\t\tAllow from all\n\t</Directory>\n\n\tErrorLog /var/log/apache2/error-glpi.log\n\tLogLevel warn\n\tCustomLog /var/log/apache2/access-glpi.log combined\n</VirtualHost>" >/etc/apache2/sites-available/000-default.conf
12081
else
121-
set +H
122-
echo -e "<VirtualHost *:80>\n\tDocumentRoot /var/www/html/glpi/public\n\n\t<Directory /var/www/html/glpi/public>\n\t\tRequire all granted\n\t\tRewriteEngine On\n\t\tRewriteCond %{REQUEST_FILENAME} !-f\n\t\n\t\tRewriteRule ^(.*)$ index.php [QSA,L]\n\t</Directory>\n\n\tErrorLog /var/log/apache2/error-glpi.log\n\tLogLevel warn\n\tCustomLog /var/log/apache2/access-glpi.log combined\n</VirtualHost>" > /etc/apache2/sites-available/000-default.conf
82+
set +H
83+
echo -e "<VirtualHost *:80>\n\tDocumentRoot /var/www/html/glpi/public\n\n\t<Directory /var/www/html/glpi/public>\n\t\tRequire all granted\n\t\tRewriteEngine On\n\t\tRewriteCond %{REQUEST_FILENAME} !-f\n\t\n\t\tRewriteRule ^(.*)$ index.php [QSA,L]\n\t</Directory>\n\n\tErrorLog /var/log/apache2/error-glpi.log\n\tLogLevel warn\n\tCustomLog /var/log/apache2/access-glpi.log combined\n</VirtualHost>" >/etc/apache2/sites-available/000-default.conf
12384
fi
12485
chown -R www-data:www-data /var/www/html/glpi/
12586
chmod -R u+rwx /var/www/html/glpi/
12687

127-
12888
/usr/bin/php /var/www/html/glpi/bin/console glpi:database:install \
129-
--reconfigure \
130-
--no-interaction \
131-
--force \
132-
--db-host=${MARIADB_DB_HOST} \
133-
--db-port=${MARIADB_DB_PORT} \
134-
--db-name=${MARIADB_DB_NAME} \
135-
--db-user=${MARIADB_DB_USER} \
136-
--db-password=${MARIADB_DB_PASSWORD}
89+
--reconfigure \
90+
--no-interaction \
91+
--force \
92+
--db-host=${MARIADB_DB_HOST} \
93+
--db-port=${MARIADB_DB_PORT} \
94+
--db-name=${MARIADB_DB_NAME} \
95+
--db-user=${MARIADB_DB_USER} \
96+
--db-password=${MARIADB_DB_PASSWORD}
13797

13898
# Enable time zones
13999
/usr/bin/php /var/www/html/glpi/bin/console migration:timestamps
140100
/usr/bin/php /var/www/html/glpi/bin/console database:enable_timezones
141101
#Add scheduled task by cron and enable
142-
echo "*/2 * * * * www-data /usr/bin/php /var/www/html/glpi/front/cron.php &>/dev/null" > /etc/cron.d/glpi
102+
echo "*/2 * * * * www-data /usr/bin/php /var/www/html/glpi/front/cron.php &>/dev/null" >/etc/cron.d/glpi
143103
#Start cron service
144104
service cron start
145105

0 commit comments

Comments
 (0)