• In diesem Bereich findet ihr Tutorials und Reviews. Die Forenrechte zur Erstellung neuer Themen sind hier eingeschränkt, da Problemdiskussionen bitte in den übrigen Forenbereichen auf Apfeltalk zu führen sind. Wer ein Tutorial oder Review einstellen möchte, kann im Unterforum "Einreichung neuer Tutorials" ein neues Thema erstellen. Die Moderatoren verschieben den Beitrag dann in den passenden Bereich.
  • Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Welches Bild soll mehr Schokolade bekommen? Hier geht es lang zur Abstimmung für den Monat März --> Klick

Software Update Server ohne Mac OS X Server

Registriert
01.02.07
Beiträge
2.097
Hier eine Anleitung, wie man einen Software Update Server (SUS) ohne Mac OS X Server aufsetzen kann. Da das SU-System auf offenen Standards basiert, kann diese Methode plattformunabhängig eingesetzt werden; es läuft also u.a. auch auf OSX Client und Linux. Die Anleitung ist leider nur für Anwender geeignet, die Erfahrung auf der Terminal-Ebene haben.

Was man braucht:

  • einen Webserver (bei OSX ist Apache enthalten)
  • ein Script von Andrew Wellington, das die Dateien herunterlädt und den Software-Katalog für das lokale Netz umschreibt
  • für das Script: die Korn-Shell ksh (diese ist in OSX enthalten, sollte sich aber auch in den gängigen Linux-Distributionen nachinstallieren lassen)
  • den Software Update Enabler, ebenfalls von Andrew Wellington
  • ca. 4 GB freien Speicher für die Update-Dateien
  • die Unix-Tools grep, sed, tr, wget und xargs. Unter OSX fehlt davon wget, ich habe es als Universal Binary angehängt.

Anleitung:

  1. Folgende Ordnerstrukrur anlegen (steht so auch im Script):

    Code:
     sumirror/
     |-- content
     |   |-- files
     `-- sumirror

    Den "content"-Ordner kann man im Script umbenennen, siehe Schritt 2.

    [*] Das Original-Script anpassen
    Ich habe die Stellen markiert, die man anpassen sollte.

    Code:
    #![COLOR="Red"]/usr/local/bin/ksh // <-- Unter OSX und den meisten Linux-Distributionen liegt das ksh-Binary in /bin/ksh.[/COLOR]
    #
    # LICENCE: 
    # Copyright (C) 2005 Andrew Wellington.
    # All rights reserved.
    #
    # Redistribution and use in source and binary forms, with or
    # without modification, are permitted provided that the following
    # conditions are met:
    # 1. Redistributions of source code must retain the above copyright
    # notice, this list of conditions and the following disclaimer.
    # 2. Redistributions in binary form must reproduce the above copyright
    # notice, this list of conditions and the following disclaimer in the
    # documentation and/or other materials provided with the distribution.
    #
    # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
    # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    #
    # README:
    # A script to download and mirror the Apple Software Updates
    # available for Mac OS X (10.4 "Tiger"), in conjunction with
    # Andrew Wellington's SUEnabler application, which allows an
    # administrator to set a different download location for the
    # update catalog and update packages.
    #
    # This script requires GNU wget, and requires the following
    # directory structure to operate (feel free to rename the
    # LOCALDIR and /sumirror/files/ paths below according to
    # your requirements:
    #
    # sumirror/
    # |-- content
    # |   |-- files
    # |   |   |-- [ All the various updater ]
    # |   |   `-- [ files supplied by Apple ]
    # |   |-- index.sucatalog
    # |   |-- sumirror.curlist
    # |   |-- sumirror.newlist
    # |   |-- sumirror.sucatalog
    # |   `-- sumirror.urllist
    # `-- sumirror
    #
    # If you have wget and have simply untarred this directory, you
    # should be able to run this software by typing ./sumirror
    #
    # It is assumed you'll be running a webserver (eg Apache) on the
    # server you're running this on.  Simply make a symlink to the
    # content directory as follows:
    # 
    # cd /path/to/webroot/
    # ln -s /path/to/sumirror/content sumirror
    # 
    # Then, open up your copy of Software Update Enabler and enter
    # your the following into it:
    #
    #   http://www.your-web-server/sumirror/
    #
    # You should then run the sumirror script periodically using
    # cron or launchd.  If you've read this far, I'll assume you
    # already know how to use these utilities and don't need help
    # from me.
    #
    # OBLIGATORY PLUG:
    # Software Update Enabler can be downloaded here:
    #
    #   http://www.wiretapped.net/~proton/suenabler/index.html
    
    SUMASTER="http://swscan.apple.com/content/catalogs/index-1.sucatalog"
    SUMASTERHOST="swcdn.apple.com"
    [COLOR="Red"]LOCALDIR="./content" //<-- wenn man das Download-Verzeichnis ändern will[/COLOR]
    GREP="`which grep`"
    SED="`which sed`"
    TR="`which tr`"
    WGET="`which wget`"
    XARGS="`which xargs`"
    
    # Download Apple's catalog file to our working directory
    
    echo "*** Downloading Software Updates Catalog..."
    $WGET -N -q -O $LOCALDIR/sumirror.sucatalog $SUMASTER
    
    # Strip it back to just the URLs of the files we need to mirror
    
    $GREP $SUMASTERHOST $LOCALDIR/sumirror.sucatalog | tr -d "\t" | $SED 's/[COLOR="Red"]\[/COLOR]<string[COLOR="red"]\[/COLOR]>//g;s/[COLOR="red"]\[/COLOR]<\/string[COLOR="red"]\[/COLOR]>//g' > $LOCALDIR/sumirror.urllist [COLOR="red"]// <-- Mit der Hilfe eines Freundes habe ich herausgefunden, dass man diese Backslashes unter Linux entfernen muss.[/COLOR]
    
    # Jump into the directory we want the files actually stored and download them using wget
    
    echo "*** Mirroring Software Update Packages..."
    cd $LOCALDIR/files
    $WGET -N -q -i ../sumirror.urllist
    cd ../..
    
    # Now, prepare an index.sucatalog file for the Software Update.app to download and refer to,
    # but now, instead of URLs at Apple's download site, replace them with our own (modify this
    # to suit your requirements).
    
    echo "*** Running Post-Mirroring Scripts..."
    $SED 's|<string>http://swcdn.*/\(.*\)</string>|<string>[COLOR="Red"]http://www.wiretapped.net/sumirror/files/[/COLOR]\1</string>|g' < $LOCALDIR/sumirror.sucatalog > $LOCALDIR/index.sucatalog [COLOR="red"]<-- Hier die URL zum "files"-Ordner auf dem lokalen Server eintragen.[/COLOR]
    
    # Apple may pull some updates if problems with them are discovered.  We therefore need to check
    # that no old files are present in the main download directory.  Prepare a sorted list of the
    # filenames Apple is telling us we should have, then prepare a list of what's actually there.
    # Compare them, then delete any that aren't on the new list.
    
    echo "*** Optimising Content Directories..."
    $SED 's|http://swcdn.*/\(.*\)|\1|g' < $LOCALDIR/sumirror.urllist | sort > $LOCALDIR/sumirror.newlist
    ls $LOCALDIR/files | xargs -n1 | sort > $LOCALDIR/sumirror.curlist
    cd $LOCALDIR/files
    $GREP -F -v -f ../sumirror.newlist ../sumirror.curlist | $XARGS -n 1 rm -f
    echo "*** Done!"

    Dieses Script muss man in den oberen "sumirror"-Ordner speichern und ausführbar machen.

    Code:
    chmod a+x sus.ksh

    [*]Das Script starten.
    Jetzt werden alle Dateien geladen und der Katalog für den lokalen Server angepasst. Der Download kann, abhängig von euerer Verbindung, etwas dauern. Es empfhielt sich daher, das Script in einer "screen"-Session auszuführen.


    [*]Den Webserver so einrichten, dass der "content"-Ordner freigegeben wird.
    In Apache geht das z.B. mit einem Alias:
    Code:
    Alias /sumirror "/usr/sumirror/content"
    Unter OSX bietet es sich an, den Ordner direkt im "Web-Sites"-Ordner im Benutzerverzeichnis anzulegen.
    Code:
     ~/Sites/sumirror/
     |-- content
     |   |-- files
     `-- sumirror

    [*]Den Webserver starten bzw. neu laden.
    Unter OSX in Systemeinstellungen -> Sharing -> Personal Web Sharing

    [*]Auf dem Client den neuen Update Server mit dem Software Update Enabler einstellen.
    Angenommen wir haben den Server auf OSX aufgesetzt, unser Domain-Name lautet "iMac" und unser Benutzername "user", dann müsste die URL lauten: "http://iMac/~user/sumirror/content"

    [*]Das Software-Update starten.
    Nun steht in der Titelleiste "Software-Aktualisierung (iMac)", es benutzt also den lokalen Update Server.

    [*]Das Script in einen Autostart-Dienst eintragen (bei Linux etwa die cronttab), damit neue Updates regelmäßig abgeholt werden.
 

Anhänge

  • wget.zip
    218,8 KB · Aufrufe: 574
Zuletzt bearbeitet:
  • Like
Reaktionen: quarx