WSUS Offline Update Downloader für Linux

Antworten
Benutzeravatar
THE-AB
Administrator
Beiträge: 15
Registriert: So 10. Apr 2016, 15:40

WSUS Offline Update Downloader für Linux

Beitrag von THE-AB »

Auch unter Linux kann man Windows Updates mit dem Programm WSUS Offline Update Downloaden

2 nützliche Script gibt es, das eine als cron job zu nutzen für das Downloaden und das andere ist ein Autoupdate für das Programm selbest.

beide Datein in das Verzeichniss /wsusoffline/sh/ kopieren und ausführbar machen.

je nach dem von was man downloaden will oder ein iso erstellen, die jeweiligen Zeilen auskommentieren und den Datei pfad anpassen.
wsus-cron.sh

Code: Alles auswählen

#!/bin/bash
#########################################################################
###         WSUS Offline Update Downloader for Linux systems          ###
#########################################################################
(
#/media/wsusoffline/sh/DownloadUpdates.sh w60 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh w60-x64 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh w61 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh w61-x64 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh w62-x64 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh w63 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh w63-x64 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh w100 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh w100-x64 deu /makeiso /dotnet /msse /wddefs /wle
#/media/wsusoffline/sh/DownloadUpdates.sh ofc deu /makeiso /dotnet /msse /wddefs /wle
/media/wsusoffline/sh/DownloadUpdates.sh all-x86 deu /dotnet /msse /wddefs /wle
/media/wsusoffline/sh/DownloadUpdates.sh all-x64 deu /dotnet /msse /wddefs /wle
/media/wsusoffline/sh/DownloadUpdates.sh ofc deu /dotnet /msse /wddefs /wle
/media/wsusoffline/sh/DownloadUpdates.sh all-x86 enu /dotnet /msse /wddefs /wle
/media/wsusoffline/sh/DownloadUpdates.sh all-x64 enu /dotnet /msse /wddefs /wle
) | tee /var/log/wsus.log
exit
wsus-update.sh

Code: Alles auswählen

#!/bin/bash
 
#
# Author:       Carlos Pasqualini
# email:        carlos [at] carlospasqualini.com.ar
# Website:      http://www.carlospasqualini.com.ar/

#
# Rev: 3
#
# Contributors:
#   spfef
#   hbuhrmester
#
# License:      GPLv3+
#               ../doc/license.txt
#
# disable Debugging
#DEBUG=true
# enable Debugging
DEBUG=echo
#
# Go to script's path as a start:
cd "$(dirname "$0")"
BASEPATH=$(pwd)
if [ ! -d ../temp ]; then
   mkdir ../temp
fi
wget --timestamping --directory-prefix="../static" \
    "http://download.wsusoffline.net/StaticDownloadLink-recent.txt"

diff --strip-trailing-cr \
    "../static/StaticDownloadLink-this.txt" \
    "../static/StaticDownloadLink-recent.txt" > /dev/null

if (( $? == 0 )); then
    echo "The installed version of WSUS Offline Update is up-to-date."
    exit 0;
else
    URL=$(cat ../static/StaticDownloadLink-recent.txt)
    $DEBUG We need to update wsusoffline!
    cd ../temp/
    wget -q $URL
    HASH=$(echo $URL |sed 's/\.zip/_hashes.txt/')
    wget -q $HASH
    FILE=$(echo $URL |sed 's/http:\/\/download.wsusoffline.net\///')
    HASH=$(echo $FILE|sed 's/\.zip/_hashes.txt/')
    if [[ -f $FILE ]]; then
        SHA256=$(sha256sum ../temp/$FILE | awk '{print $1}')
            if [[ $(grep -c "$SHA256,$FILE" $HASH) -gt 0 ]]; then
                echo Download validated
                cd ../temp/
                if [[ -d wsusoffline ]]; then
                    rm -r wsusoffline
                fi
                unzip -q $FILE
                cd ..
                cp -av temp/wsusoffline/* .
                else
                        echo Download failed
                        if [[ -f ../temp/$FILE ]]; then
                                rm -v ../temp/$FILE
                        fi
                        if [[ -f ../temp/$HASH ]]; then
                                rm -v ../temp/$HASH
                        fi
                        if [[ -d ../temp/wsusoffline ]]; then
                                rm -r ../temp/wsusoffline/
                        fi
            fi
    fi
fi
cd $BASEPATH
# cleanup
if [ -d ../temp ]; then
   rm -rf ../temp
fi
# if you have to set file permissions uncomment some out
# find ../ -type d -print0 | xargs -0 chmod 755
# find ../ -type f -print0 | xargs -0 chmod 644
# chown -R nobody.nogroup ../
#
# make the shell scripts executabal again
find ../ -name '*.sh' -print0 | xargs -0 chmod +x
21.04.2016 Version 10.6.2
wsusoffline1062.zip
(1.95 MiB) 1468-mal heruntergeladen
http://www.wsusoffline.net
Antworten