vagrant-windows-update 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b2bca4595670ddeb5e08add150fea22c6aa0700
|
|
4
|
+
data.tar.gz: f725f87e1f42c7a16d2ce2a470f7b30910382dac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d52c4a301cb8d1cb46bb0521e200d7a4140167803f402a3323dd12c458c8b835e6308eea9712e6c94a3e5bbe341cf7afaeb07a1271513d193c4d5b549ff6ef5
|
|
7
|
+
data.tar.gz: 1915066fa60a3f950830f0ae03a8b24ef8be4079531022b204ae8c6414531994f8ab69362dac5dc7ebde740fa3200a98ba626784920c966ef4bc10878800f8dd
|
|
@@ -20,6 +20,7 @@ $ErrorActionPreference = 'Stop'
|
|
|
20
20
|
trap {
|
|
21
21
|
Write-Output "ERROR: $_"
|
|
22
22
|
Write-Output (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1')
|
|
23
|
+
Write-Output (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$','ERROR EXCEPTION: $1')
|
|
23
24
|
Exit 1
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -61,10 +62,14 @@ function Wait-Condition {
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
function ExitWhenRebootRequired {
|
|
65
|
+
function ExitWhenRebootRequired([bool]$forceReboot=$false) {
|
|
66
|
+
$rebootRequired = $forceReboot
|
|
67
|
+
|
|
65
68
|
# check for pending Windows Updates.
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
if (!$rebootRequired) {
|
|
70
|
+
$systemInformation = New-Object -ComObject 'Microsoft.Update.SystemInfo'
|
|
71
|
+
$rebootRequired = $rebootRequired -or $systemInformation.RebootRequired
|
|
72
|
+
}
|
|
68
73
|
|
|
69
74
|
# check for pending Windows Features.
|
|
70
75
|
if (!$rebootRequired) {
|
|
@@ -74,8 +79,10 @@ function ExitWhenRebootRequired {
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
if ($rebootRequired) {
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
if (!$forceReboot) {
|
|
83
|
+
Write-Output 'Pending Reboot detected. Waiting for the Windows Modules Installer to exit...'
|
|
84
|
+
Wait-Condition {(Get-Process -ErrorAction SilentlyContinue TiWorker,TrustedInstaller | Measure-Object).Count -eq 0}
|
|
85
|
+
}
|
|
79
86
|
Write-Output 'Rebooting...'
|
|
80
87
|
Exit 0
|
|
81
88
|
}
|
|
@@ -131,9 +138,7 @@ if ($searchResult.Updates.Count) {
|
|
|
131
138
|
$updateInstaller = $updateSession.CreateUpdateInstaller()
|
|
132
139
|
$updateInstaller.Updates = $updatesToInstall
|
|
133
140
|
$installResult = $updateInstaller.Install()
|
|
134
|
-
|
|
135
|
-
ExitWhenRebootRequired
|
|
136
|
-
}
|
|
141
|
+
ExitWhenRebootRequired $true
|
|
137
142
|
}
|
|
138
143
|
} else {
|
|
139
144
|
Write-Output 'No Windows updates found'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-windows-update
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rui Lopes
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|