You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							43 lines
						
					
					
						
							1.6 KiB
						
					
					
				
			
		
		
	
	
							43 lines
						
					
					
						
							1.6 KiB
						
					
					
				| #!/bin/bash
 | |
| 
 | |
| #Controle du choix de version ou prise de la latest
 | |
| [[ ! "$VERSION_GLPI" ]] \
 | |
| 	&& VERSION_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep tag_name | cut -d '"' -f 4)
 | |
| 
 | |
| SRC_GLPI="https://github.com/glpi-project/glpi/releases/download/${VERSION_GLPI}/glpi-${VERSION_GLPI}.tgz"
 | |
| TAR_GLPI=glpi-${VERSION_GLPI}.tgz
 | |
| FOLDER_GLPI=glpi/
 | |
| FOLDER_WEB=/var/www/html/
 | |
| 
 | |
| #check if TLS_REQCERT is present
 | |
| if !(grep -q "TLS_REQCERT" /etc/ldap/ldap.conf)
 | |
| then
 | |
| 	echo "TLS_REQCERT isn't present"
 | |
|         echo -e "TLS_REQCERT\tnever" >> /etc/ldap/ldap.conf
 | |
| fi
 | |
| 
 | |
| #Téléchargement et extraction des sources de GLPI
 | |
| if [ "$(ls ${FOLDER_WEB}${FOLDER_GLPI})" ];
 | |
| then
 | |
| 	echo "GLPI is already installed"
 | |
| else
 | |
| 	wget -P ${FOLDER_WEB} ${SRC_GLPI}
 | |
| 	tar -xzf ${FOLDER_WEB}${TAR_GLPI} -C ${FOLDER_WEB}
 | |
| 	rm -Rf ${FOLDER_WEB}${TAR_GLPI}
 | |
| 	chown -R www-data:www-data ${FOLDER_WEB}${FOLDER_GLPI}
 | |
| fi
 | |
| 
 | |
| #Modification du vhost par défaut
 | |
| 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
 | |
| 
 | |
| #Add scheduled task by cron and enable
 | |
| echo "*/2 * * * * www-data /usr/bin/php /var/www/html/glpi/front/cron.php &>/dev/null" >> /etc/cron.d/glpi
 | |
| #Start cron service
 | |
| service cron start
 | |
| 
 | |
| #Activation du module rewrite d'apache
 | |
| a2enmod rewrite && service apache2 restart && service apache2 stop
 | |
| 
 | |
| #Lancement du service apache au premier plan
 | |
| /usr/sbin/apache2ctl -D FOREGROUND
 |