summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorSimon Rettberg2013-05-28 16:03:01 +0200
committerSimon Rettberg2013-05-28 16:03:01 +0200
commitc31fc84435bf4f493306ddef619b55f8f2771c3c (patch)
treec8671b2bcd0a14976409eb103ceac4f83973b983 /data
parentbeauty operations :) (diff)
downloadtm-scripts-c31fc84435bf4f493306ddef619b55f8f2771c3c.tar.gz
tm-scripts-c31fc84435bf4f493306ddef619b55f8f2771c3c.tar.xz
tm-scripts-c31fc84435bf4f493306ddef619b55f8f2771c3c.zip
[WiP] Server Maintenance Scripts
Diffstat (limited to 'data')
-rwxr-xr-xdata/openslx-install (renamed from data/openslx-ng-install)22
-rw-r--r--data/openslx-update54
2 files changed, 73 insertions, 3 deletions
diff --git a/data/openslx-ng-install b/data/openslx-install
index 7b8715b7..8d1c04db 100755
--- a/data/openslx-ng-install
+++ b/data/openslx-install
@@ -202,6 +202,12 @@ if [ "x$1" != "x--test" ] && check_password "root" "openslx-ng"; then
done
fi
+if yesno "Soll die aktuellste stabile Version des MiniLinux nach der Einrichtung automatisch heruntergeladen werden?"; then
+ DOWNLOAD_ML=yes
+else
+ DOWNLOAD_ML=no
+fi
+
print ""
print "Beginne Installation"
@@ -269,11 +275,10 @@ HEREEND
# NFS Config
echo "$SLX_VM_PATH *(ro,async,insecure,no_root_squash,no_subtree_check)" > "/etc/exports"
# End NFS Config
- service samba restart
- service nfs-kernel-server restart
- # TODO: Persistent inbound blocking of tcp 139, udp 137,138 to speed up access from Windows Clients
update-rc.d samba defaults
update-rc.d nfs-kernel-server defaults
+ service samba restart
+ service nfs-kernel-server restart
else # external NFS Server for VM Images is used. Disable NFS + Samba
service samba stop
service nfs-kernel-server stop
@@ -282,6 +287,7 @@ else # external NFS Server for VM Images is used. Disable NFS + Samba
update-rc.d nfs-kernel-server disable "$LEVEL"
done
fi
+print "Dienste konfiguriert."
#
# ---- Create boottime system config ----
@@ -290,9 +296,19 @@ print ""
print "Schreibe Bootzeit-Konfiguration für MiniLinux"
cat > "/srv/openslx/www/config" << HEREEND
SLX_VM_NFS='$SLX_VM_NFS'
+SLX_HTTP_ADDR='http://$SLX_LOCAL_ADDR'
HEREEND
+if [[ "$DOWNLOAD_ML" == yes ]]; then
+ print ""
+ print "Lade aktuellste Version des MiniLinux herunter"
+ openslx-update
+fi
+print ""
+print "Das MiniLinux kann jederzeit manuell durch den Befehl openslx-update aktualisiert werden."
+
SLX_LAST_INVOCATION="$(date)"
save_defaults
+print ""
print "Einrichtung abgeschlossen."
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
+