Page 3 of 6

Re: A complete rewrite of the Linux scripts

PostPosted: 13.07.2017, 06:47
by telnetuserid
This is great.
Watching this thread for another great stuff, such as support for curl as downloader tool in addition to wget and aria2.

Re: A complete rewrite of the Linux scripts

PostPosted: 14.07.2017, 17:44
by mani
Dear Hartmut
I had since Monday a none running cron task and found that the debian-10 updates must have changed something with either bash or cron.....or the wsusofline110 update (which I had to do manually on Sunday).....your beta-4 worked for a few days before without problems.

never the less with a small change in download-updates.bash I could solve the ignorance of the "export $TERM=xterm" in my cron script.

Line 208
+ if [[ "${TERM}" = "dumb" ]]; then
+ COLUMNS=80
+ LINES=24
+ else
if type -P tput > /dev/null; then
COLUMNS="$(tput cols)"
LINES="$(tput lines)"
else
COLUMNS=80
LINES=24
fi
+ fi
export COLUMNS
export LINES

I hope you find a better solution, because my bash knowledge is very basic.

BR
Mani

Re: A complete rewrite of the Linux scripts

PostPosted: 15.07.2017, 01:22
by hbuhrmester
It seems, that I didn't notice this before.

The two conditions can probably be combined: if the terminal is not a dumb terminal, then tput can be used to query the height and width.

If this fails, then the variables can be set with a parameter expansion that provides default values. This works, if the variables are unset or empty and may serve as a "catch all", if tput does not work as expected.

The code then looks like:

Code: Select all
# Try to get the height and width of the terminal window. These
# environment variables are usually available in interactive sessions,
# but they are not inherited by scripts.
#
# If the script is running within a terminal emulator window, then tput
# can be used to query its dimensions. This does not work within a cron
# job, though.
if [[ "${TERM}" != "dumb" ]] && type -P tput  > /dev/null; then
    COLUMNS="$(tput cols)" || true
    LINES="$(tput lines)"  || true
fi

# If the variables could not be set with tput, they will be set to
# default values.
COLUMNS="${COLUMNS:-80}"
LINES="${LINES:-24}"
export COLUMNS
export LINES

Re: A complete rewrite of the Linux scripts

PostPosted: 16.07.2017, 12:07
by mani
Thanks, worked

I found another (unimportant glitch)...or maybe I am the only one who runs it with cron?

first i have overseen that the preferences.bash is only a template in the original and have to be copied without the template addition in the file name to work.

The updates runs now automatically and starts the same download-updates.bash again...
in my case not ideal, because I am running all my updates from another bash script (edited get-all-updates.bash)
At least I will see a problem in the morning, because my logcheck script was not running and I am missing my daily WSUSoffline-Update email

I don't see an easy way to solve this problem and actually it is not necessary (or a waste of time), because the next night it will run fully and I am forced to check the logs ;-)

BR
Mani

Re: A complete rewrite of the Linux scripts

PostPosted: 17.07.2017, 03:37
by hbuhrmester
The updates runs now automatically and starts the same download-updates.bash again...
in my case not ideal, because I am running all my updates from another bash script (edited get-all-updates.bash)


The other commands in the script get-all-updates.bash should still be run, with the exception that the first script encounters an error. Then the rest of the script get-all-updates.bash will be stopped. This is controlled by the option errexit at the beginning of the file:

Code: Select all
# Stop this script, if one of download runs exits with an error code.
set -o errexit


It was inserted, because I wanted an easy way to stop all commands in this file. Now I can type Ctrl-C to stop one download run, and all remaining download runs are canceled as well. But you won't get any error message, if the option errexit stops a script. If you think, this is wrong, you could comment out this option.

Re: A complete rewrite of the Linux scripts

PostPosted: 17.07.2017, 13:00
by mani
I was mimicking the wsusoffline1101 update once again (changing StaticDownloadLink-this.txt) and this time it run through my whole update script without interruption.

After the next real update I will know for sure, if there is no error raising, which silently interrupts my script.

Thanks for your help

Re: A complete rewrite of the Linux scripts

PostPosted: 19.07.2017, 08:29
by lindesbs
Thanks for this working script.
But only one question still open for me: How to create the ISO files ?
That is one of the most used options, when using the Windows tool.

Re: A complete rewrite of the Linux scripts

PostPosted: 19.07.2017, 16:35
by Dalai
lindesbs wrote:That is one of the most used options, when using the Windows tool.

Really? Isn't it easier to just copy the wsusoffline\client directory to a USB flash drive and use that on the Windows target system?

Regards
Dalai

Re: A complete rewrite of the Linux scripts

PostPosted: 19.07.2017, 17:09
by boco
In my case, I service Virtual Machines, so, the ISO option is far more convenient than USB.

Not everyone uses WOU the same way. That's why I appreciate the choice to use ISO or USB. You need to do neither, simply copying the .\client subdirectory to the target machine (or hosting over SMB) is enough.

Re: A complete rewrite of the Linux scripts

PostPosted: 19.07.2017, 19:04
by lindesbs
OK /client directory is one solution. But i have downloaded the updates for Win10 32/64, Win Server 2012/2016 and Office Updates.
So, this directory will grow larger than 30GB.

I need bigger USB sticks