diff options
author | Simon Rettberg | 2013-05-28 16:03:01 +0200 |
---|---|---|
committer | Simon Rettberg | 2013-05-28 16:03:01 +0200 |
commit | c31fc84435bf4f493306ddef619b55f8f2771c3c (patch) | |
tree | c8671b2bcd0a14976409eb103ceac4f83973b983 /data/openslx-update | |
parent | beauty operations :) (diff) | |
download | tm-scripts-c31fc84435bf4f493306ddef619b55f8f2771c3c.tar.gz tm-scripts-c31fc84435bf4f493306ddef619b55f8f2771c3c.tar.xz tm-scripts-c31fc84435bf4f493306ddef619b55f8f2771c3c.zip |
[WiP] Server Maintenance Scripts
Diffstat (limited to 'data/openslx-update')
-rw-r--r-- | data/openslx-update | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/data/openslx-update b/data/openslx-update new file mode 100644 index 00000000..4f8da0f5 --- /dev/null +++ b/data/openslx-update @@ -0,0 +1,54 @@ +#!/bin/bash + +function print () +{ + echo -e "\033[01;29m$@\033[00m" +} + +function error () +{ + echo -e "\033[01;31m$@\033[00m" + exit 1 +} + +function warning () +{ + echo -e "\033[01;33m$@\033[00m" +} + +MIRROR="http://mltk.boot.openslx.org" +REMOTEINDEX="/tmp/mlversion" +LOCALINDEX="/opt/openslx/local_version" +WWWTEMP="/srv/openslx/www-temp" + +LOCAL_STABLE=0 +LOCAL_TESTING=0 +if [ -s "$LOCALINDEX" ]; then + . "$LOCALINDEX" || error "Fehler beim laden der lokalen Versionsinfirmationen aus $LOCALINDEX" +fi + +print "" +print "Lade Liste aktuell verfügbarer Versionen..." +rm -f "$REMOTEINDEX" +wget -O "$REMOTEINDEX" "$MIRROR/index" || error "Konnte Liste verfügbarer Releases nicht herunterladen." +. "$REMOTEINDEX" || error "Liste verfügbarer Releases Fehlerhaft (konnte $REMOTEINDEX nicht sourcen)" + +mkdir -p "$WWWTEMP" +mv /srv/openslx/www/openslx-* "$WWWTEMP/" +for REL in ${!AVAILABLE_*}; do + BRANCH="${REL#AVAILABLE_}" + print "Remote has branch $BRANCH" + PXELINE="" + for FILE in ${!REL}; do + PXELINE="$PXELINE http://" + if [ -s "$WWWTEMP/openslx-$FILE" ]; then + mv "$WWWTEMP/openslx-$FILE" "/srv/openslx/www/" + continue + fi + wget -O "$WWWTEMP/openslx-$FILE" "$MIRROR/files/$FILE" || warning "Could not download $FILE" + done + EXTRA="${BRANCH}_EXTRA" + for FILE in ${!EXTRA}; do + done +done + |