Jump to content
Froxlor Forum
  • 0

Froxlor Update-Script


bedios

Question

Nachfolgend ein kleines Shell-Script um eine bereits vorhandene Froxlor Installation auf eine neue Version zu aktualisieren.

Das Script ist quick&dirty, aber vielleicht ist es f?r den einen oder anderen doch ganz n?tzlich. Kritik, Fehlerkorrekturen, Verbesserungsvorschl?ge zum Script, etc. bitte posten.

 

 

*** Die Verwendung dieses Scripts erfolgt auf eigene Gefahr. ***

 

 

#!/bin/bash

# installation path
froxlorpath="/var/www/froxlor/";

# are you using the aps feature?
aps=1; # yes = 1 / no = 0


cd /tmp
echo "Downloading latest froxlor version ..."
wget http://files.froxlor.org/releases/froxlor-latest.tar.gz -nv
wget http://files.froxlor.org/releases/froxlor-latest.tar.gz.md5 -nv

if [ -e /tmp/froxlor-latest.tar.gz ]; then
 if [ -e /tmp/froxlor-latest.tar.gz.md5 ]; then
   echo "MD5 hash comparison ..."
   MD5HASH=$(cat /tmp/froxlor-latest.tar.gz.md5 | cut -d " " -f1);
   FILEHASH=$(md5sum /tmp/froxlor-latest.tar.gz | cut -d " " -f1);

   if [ "$FILEHASH" == "$MD5HASH" ] ; then
     echo "MD5 hash ok!"
     echo "Extracting files ..."
     tar xf /tmp/froxlor-latest.tar.gz
     sleep 1

#      echo "Backup customer files and database ..."
#      /usr/sbin/yourBackupScript
#      sleep 1

     echo "Preparing to replace old froxlor files ..."
     mkdir /tmp/froxlorbackup

     if [ $aps -eq 1 ]; then
       echo "Backup aps packages ..."
       mkdir /tmp/froxlorbackup/temp
       mkdir /tmp/froxlorbackup/packages
       cp -f ${froxlorpath}temp/* /tmp/froxlorbackup/temp/
       cp -rf ${froxlorpath}packages/* /tmp/froxlorbackup/packages/
     fi

     echo "Backup froxlor settings ..."
     cp ${froxlorpath}lib/userdata.inc.php /tmp/froxlorbackup
     echo "Replacing old froxlor files ..."
     rm -r ${froxlorpath}*
     cp -r /tmp/froxlor/* ${froxlorpath}
     echo "Restoring settings ..."
     cp /tmp/froxlorbackup/userdata.inc.php ${froxlorpath}lib/
     chmod 644 ${froxlorpath}lib/userdata.inc.php

     if [ $aps -eq 1 ]; then
       echo "Restoring aps packages ..."
       mv /tmp/froxlorbackup/temp/* ${froxlorpath}temp/
       mv /tmp/froxlorbackup/packages/* ${froxlorpath}packages/
     fi

     sleep 1

     echo "Cleaning up ..."
     rm -r /tmp/froxlor
     rm /tmp/froxlor-latest.tar.gz
     rm /tmp/froxlor-latest.tar.gz.md5
     rm -r /tmp/froxlorbackup/
     echo "Update done."
   else
     echo "MD5 filehash wrong!"
     rm /tmp/froxlor-latest.tar.gz
     rm /tmp/froxlor-latest.tar.gz.md5
   fi
 else
   echo "Downloading MD5 hash failed!"
 fi
else
 echo "Downloading froxlor failed!"
fi

 

*** Die Verwendung dieses Scripts erfolgt auf eigene Gefahr. ***

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...