Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Deletion of files from previous update that may disturb the script
- echo 'We delete all files in /tmp with \"glpi\" in it that may disturb the script'
- rm -RI /tmp/*glpi*
- # Settling of variables for the update
- read -p 'Enter the path of actual GLPI (example: /var/www/html/glpi):' glpi
- # Go in working directory
- #echo 'We go into a working directory'
- #cd /tmp
- # Save of in-prod glpi and database
- echo 'We save files and database'
- cp -R $glpi /tmp/glpibackup
- read -p 'Files saved. What is your GLPI database name ?' db
- read -p 'Who is your glpi database owner?' user
- read -s -p 'What is your glpi database owner password ?' passwd
- mysqldump -u $user -p$passwd $db > /tmp/$db'save'.sql
- echo 'OK'
- # Link download
- read -p 'Enter the direct download link:' link
- wget $link
- echo 'Downloaded'
- # extraction then deletion of archive
- echo 'Extraction then deletion of archive'
- tar -zxf glpi*.tgz -C /tmp
- rm /tmp/glpi*.tgz
- echo 'OK'
- # Deletion of files folder in new glpi
- echo 'Now we delete files folder of new GLPI'
- rm -RI /tmp/glpi/files
- echo 'OK'
- # Moving of old glpi into working directory + renaming
- echo 'We move in-prod glpi into the working folder'
- mv $glpi /tmp/glpi_old
- echo 'OK'
- # Cleaning of old glpi "files"
- echo 'We will now clean the files folder'
- rm -RI /tmp/glpi_old/files/_*/*
- # Copy of files that are in prod into new glpi
- echo 'Then we copy in-prod files folder and db config file into new glpi'
- cp -R /tmp/glpi_old/files /tmp/glpi/
- cp /tmp/glpi_old/config/config_db.php /tmp/glpi/config/
- echo 'OK'
- # Moving of new glpi into web folder
- echo 'We delete old glpi'
- rm -RI /tmp/glpi_old
- echo 'OK'
- echo 'We move new glpi into web folder'
- mv /tmp/glpi $glpi
- echo 'OK'
- # Settling of owner + rights
- echo 'We set the rights and owner'
- read -p 'Who is your web user ? (example: apache)' webuser
- read -p 'Who is your web group ? (example: apache)' webgroup
- chown -R $webuser:$webgroup $glpi
- chmod -R 770 $glpi
- find $glpi -type d -exec chmod 750 {} \;
- find $glpi -type f -exec chmod 740 {} \;
- echo 'OK'
- echo 'The update is almost done. Now connect into the web interface to continue. Goodbye'
Add Comment
Please, Sign In to add comment