Jason Oster schrieb:
On 06/16/2010 05:16 AM, Johannes Singer wrote:
Hello!
I needed the functionality of fully updating a computer via WSUS, a
functionality that has been asked for time and time again, but was never
implemented in a satisfactory way. So I went and found a nice tool
called WuInstall, and wrote an unattended script to use it.
Please see the attached script wuinstall.bat.
[snip]
With this you can update a computer to the latest state with the updates
coming from the WSUS-Server or from Windows Update (your choice), and it
runs until there are no more updates to install.
I believe, this functionality may be useful for other scripts too.
Any comments?
Regards,
Johannes
Hi Johannes!
This looks very useful for me. I was actually planning to look into a
way to pull updates from WSUS with Unattended, and this could be just
the thing.
One thing I'd like to ask, though. Can you supply a patch against
todo.pl, instead of the complete, modified file? That would be great
for me, so I can continue maintaining my personal repo with your
changes while following the trunk.
It will also be necessary if the committers decide to include the
changes in the official release.
Hi Jason!
Sorry, I totally forgot to add it.
Please see the attached file for the patch.
Regards,
Johannes
Index: todo.pl
===================================================================
--- todo.pl (Revision 3214)
+++ todo.pl (Arbeitskopie)
@@ -24,6 +24,7 @@
# Location of the "to do" logs.
my $log = "$c\\netinst\\logs\\todo.txt";
+my $fullcmd;
# Determine alternate letter for z: drive and store it in Z
# environment variable (unless it is already set).
unless (exists $ENV{'Z'}) {
@@ -381,7 +382,32 @@
}
$ret = $status;
+ }
+ elsif ($cmd =~ /^\.rerun-on\s+(\d+)\s+(.*)$/) {
+ my ($err_to_rerun, $new_cmd) = ($1, $2);
+ my $status = do_cmd ($new_cmd, 1);
+
+ if ($status == $err_to_rerun << 8) {
+ print "$new_cmd exited status $err_to_rerun; rerunning.\n";
+ push_todo($fullcmd);
+ $status = 0;
+ }
+
+ $ret = $status;
}
+ elsif ($cmd =~ /^\.reboot-rerun-on\s+(\d+)\s+(.*)$/) {
+ my ($err_to_reboot, $new_cmd) = ($1, $2);
+ my $status = do_cmd ($new_cmd, 1);
+
+ if ($status == $err_to_reboot << 8) {
+ print "$new_cmd exited status $err_to_reboot; rebooting and
rerunning.\n";
+ push_todo($fullcmd);
+ do_cmd ('.reboot');
+ die 'Internal error';
+ }
+
+ $ret = $status;
+ }
elsif ($cmd =~ /^\.missing-ok\s+(.*)$/) {
my $new_cmd = $1;
my $status = do_cmd ($new_cmd, 1);
@@ -505,8 +531,8 @@
# Disable running ourselves after reboot.
run_at_logon ();
- while (defined (my $cmd = pop_todo ())) {
- do_cmd ($cmd);
+ while (defined ($fullcmd = pop_todo ())) {
+ do_cmd ($fullcmd);
}
}
else {
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
unattended-devel mailing list
unattended-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unattended-devel