Benutzer-Werkzeuge

Webseiten-Werkzeuge


 [[anwenderwiki:linbo:postsync_scripte:postsynconstart]] 

Postsync (without Sync) on Start Hack

Wenn man z.B. aus Geschwindigkeitsgründen ein „Sync+Start“ vermeiden will, aber auf ein „postsync“-Skript nicht verzichten will, kann man folgendes tun:

Achtung.

Veränderungen am Kern von Linbo. Jegliche Handlung auf eigene Gewähr und vermutlich ohne support durch die Entwickler. Funktioniert nur mit Linbo 2.3.14 und vielleicht mit neueren.

You have been warned.

  • Kopiere die Datei /var/cache/linuxmuster-linbo/linbofs64/usr/bin/linbo_cmd z.B. nach:
    # cp /var/cache/linuxmuster-linbo/linbofs64/usr/bin/linbo_cmd /var/linbo/my_linbo_cmd
  • Editiere die Kopie /var/linbo/my_linbo_cmd und suche die Zeilen
    start(){
    ...
     # sets machine password on server
     invoke_macct
     # kill torrents if any 
     killalltorrents
    ...
  • Füge nach invoke_macct die Zeilen ein:
     # do a postsync on start, if configured with PostsyncOnStart=yes in next line after baseimage=${image}.cloop line                                                                      
     # does NOT do all the windows/linux stuff: restore bcd,gpt,registry and newdev.dll-patching,                                                                                           
     image="$(cat /mnt/.linbo)"
     postsync="$image.cloop.postsync"
     local RET=""
     RET="$(grep -i "baseimage[[:space:]]*=[[:space:]]*${image}.cloop" -A 1 /start.conf | grep -i ^postsynconstart | tail -1 | awk -F= '{ print $2 }' | awk '{ print $1 }' | tr A-Z a-z)"
     if [ "x$RET" = "xyes" ]; then
         echo "do a postsync anyway"
         # source postsync script  
         [ -s "/cache/$postsync" ] && . "/cache/$postsync"
         sync; sync; sleep 1
     fi
  • Füge in die Datei /usr/share/linuxmuster-linbo/update-linbofs.sh an der folgenden Stelle (ca. Zeile 100) die „postsynconstart“ und nachfolgende Zeile ein:
    ...
     # copy default start.conf
     cp -f $LINBODIR/start.conf .
     #postsynconstart                                 
     cp /var/linbo/my_linbo_cmd $linbofscachedir/usr/bin/linbo_cmd
     # pack default linbofs${suffix}.lz again 
     find . | cpio --quiet -o -H newc | lzma -zcv > "$linbofs" ; RC="$?"
     [ $RC -ne 0 ] && bailout "failed!"
    ...
  • Das ganze hat zur Folge, dass bei jedem update-linbofs die eigene my_linbo_cmd als neue linbo_cmd ins LINBO kopiert wird. D.h. eigentlich ist diese Aktion nur einmal notwendig. Danach würde das linbo_cmd aus dem bestehenden Image nicht verändert (außer linuxmuster-linbo wird neu heruntergeladen). Also kann die letzte Änderung von update-linbofs.sh nach dem ersten update-linbofs wieder herausgenommen werden.

Was dann?

  • Füge in deine start.conf.<hwk> direkt nach der Zeile baseimage=meinimage.cloop die Zeile
    PostSyncOnStart = yes

    ein.

  • Passe dein postsync-Skript so an, dass ein postsync ohne Sync auch Sinn ergibt.
  • Führe einmal update-linbofs aus.
  • Starte einen Client und lasse ihn nicht autostarten.
  • Teste per # grep -i postsynconstart /usr/bin/linbo_cmd, ob der Hack funktioniert hat
  • Starte den Client auf dem client per # linbo_wrapper start:1 und beobachte den Output. Alles was dein Postsync-Skript als output erzeugt, sollte kurz vor dem STart sichtbar werden.
  • Viel Spaß…
Achtung: Bei jedem upgrade von linuxmuster-linbo geht die Änderung an update-linbofs.sh verloren, ebenso möglicherweise der Patch selbst an linbo_cmd. Wenn bei einem upgrade von LINBO ein neues linbo_cmd mit dem obigen Patch inkompatibel wird, muss man wieder ran….
 [[anwenderwiki:linbo:postsync_scripte:postsynconstart]] anwenderwiki/linbo/postsync_scripte/postsynconstart.txt · Zuletzt geändert: 2016/12/19 15:28 von 127.0.0.1