diff options
| author | Simon Rettberg | 2013-07-24 16:21:43 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2013-07-24 16:21:43 +0200 |
| commit | f4838022dcce62362518eab060d74f95008cc446 (patch) | |
| tree | 0f3911d98d029e4bdb2cedfae3d0a2b395805708 /data | |
| parent | Awesome mltk logo (diff) | |
| download | tm-scripts-f4838022dcce62362518eab060d74f95008cc446.tar.gz tm-scripts-f4838022dcce62362518eab060d74f95008cc446.tar.xz tm-scripts-f4838022dcce62362518eab060d74f95008cc446.zip | |
[demo server] update scripts to support ntp setup
Diffstat (limited to 'data')
| -rwxr-xr-x | data/openslx-install | 15 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/openslx-update | 47 |
2 files changed, 56 insertions, 6 deletions
diff --git a/data/openslx-install b/data/openslx-install index 8d1c04db..67a8fa3f 100755 --- a/data/openslx-install +++ b/data/openslx-install @@ -7,7 +7,7 @@ function print () function error () { - echo -e "\033[00;31m$@\033[00m" + echo -e "\033[01;31m$@\033[00m" exit 1 } @@ -181,7 +181,7 @@ while true; do if [[ "$RETVAL" == E* || "$RETVAL" == e* ]]; then while true; do getinput "Adresse und Pfad des externen NFS-Shares für VM-Images im Format Adresse:Pfad" SLX_VM_NFS - echo "$RETVAL" | grep -E '\S+:/\S+' && accept + echo "$RETVAL" | grep -E '^\S+:\S+$' > /dev/null && accept print "FEHLER: Ungültiges NFS-Share-Format: $RETVAL" done print "Externer VM-NFS-Share erreichbar unter $SLX_VM_NFS" @@ -191,6 +191,10 @@ while true; do print "Ungültige Auswahl '$RETVAL'" done # Done setting up VM NFS Server type + +getinput "Adresse oder IP des NTP-Servers, mit dem die Zeit syncronisiert werden soll" SLX_NTP_SERVER +SLX_NTP_SERVER="$RETVAL" + # # ---- Safety first: make user change root password if it is still the default ---- # @@ -297,8 +301,13 @@ 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' +SLX_NTP_SERVER='$SLX_NTP_SERVER' +SLX_BIOS_CLOCK='local' HEREEND +SLX_LAST_INVOCATION="$(date)" +save_defaults + if [[ "$DOWNLOAD_ML" == yes ]]; then print "" print "Lade aktuellste Version des MiniLinux herunter" @@ -307,8 +316,6 @@ 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 index 4f8da0f5..06d05554 100644..100755 --- a/data/openslx-update +++ b/data/openslx-update @@ -20,6 +20,9 @@ MIRROR="http://mltk.boot.openslx.org" REMOTEINDEX="/tmp/mlversion" LOCALINDEX="/opt/openslx/local_version" WWWTEMP="/srv/openslx/www-temp" +PXECONFIG="/srv/openslx/tftp/pxelinux.cfg/default" + +. "/opt/openslx/server-defaults" || error "Konnte Serverkonfiguration nicht laden. Wurde openslx-install ausgeführt?" LOCAL_STABLE=0 LOCAL_TESTING=0 @@ -33,22 +36,62 @@ 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)" +# Regenerate pxemenu +mkdir -p "/srv/openslx/tftp/pxelinux.cfg" +cp "/opt/openslx/templates/pxemenu-header" "$PXECONFIG" + mkdir -p "$WWWTEMP" mv /srv/openslx/www/openslx-* "$WWWTEMP/" for REL in ${!AVAILABLE_*}; do BRANCH="${REL#AVAILABLE_}" print "Remote has branch $BRANCH" PXELINE="" + KERNEL="" for FILE in ${!REL}; do - PXELINE="$PXELINE http://" + # Handle pxelinux.cfg + if [[ "$FILE" == kernel* ]]; then + KERNEL="KERNEL http://$SLX_LOCAL_ADDR/openslx-$FILE" + else + if [ -z "$PXELINE" ]; then + PXELINE="INITRD " + else + PXELINE+="," + fi + PXELINE+="http://$SLX_LOCAL_ADDR/openslx-$FILE" + fi + # If file is available locally, don't download again 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" + # Download + wget -O "/srv/openslx/www/openslx-$FILE" "$MIRROR/files/$FILE" || warning "Could not download $FILE" done + if [ -z "$PXELINE" -o -z "$KERNEL" ]; then + warning "Incomplete entry. KERNEL or INITRD missing." + continue + fi + # Append to pxeconfig + echo "# Branch $BRANCH" >> "$PXECONFIG" + echo "LABEL $BRANCH" >> "$PXECONFIG" + echo " MENU LABEL OpenSLX-NG $BRANCH [${!REL}]" >> "$PXECONFIG" + echo " $KERNEL" >> "$PXECONFIG" + echo " $PXELINE" >> "$PXECONFIG" + echo " IPAPPEND 3" >> "$PXECONFIG" + echo " APPEND slxconfig=http://$SLX_LOCAL_ADDR/config" >> "$PXECONFIG" + # Extra files (e.g. vmplayer in it's own sqfs that gets downloaded later) EXTRA="${BRANCH}_EXTRA" for FILE in ${!EXTRA}; do + # If file is available locally, don't download again + if [ -s "$WWWTEMP/openslx-$FILE" ]; then + mv "$WWWTEMP/openslx-$FILE" "/srv/openslx/www/" + continue + fi + # Download + wget -O "/srv/openslx/www/openslx-$FILE" "$MIRROR/files/$FILE" || warning "Could not download $FILE" done done +print "Done." +print "Old files left over:" +ls -alh "$WWWTEMP" |
