vagrant-windows-update 0.0.4 → 0.0.5

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: 4b2bca4595670ddeb5e08add150fea22c6aa0700
4
- data.tar.gz: f725f87e1f42c7a16d2ce2a470f7b30910382dac
3
+ metadata.gz: 63e248d30d6a3fc4f3ba91cf9170c96d7ac45ae6
4
+ data.tar.gz: 5d7a309419c7a4b8065de1eda991c10303b26192
5
5
  SHA512:
6
- metadata.gz: 9d52c4a301cb8d1cb46bb0521e200d7a4140167803f402a3323dd12c458c8b835e6308eea9712e6c94a3e5bbe341cf7afaeb07a1271513d193c4d5b549ff6ef5
7
- data.tar.gz: 1915066fa60a3f950830f0ae03a8b24ef8be4079531022b204ae8c6414531994f8ab69362dac5dc7ebde740fa3200a98ba626784920c966ef4bc10878800f8dd
6
+ metadata.gz: 51292d0b6e50429280cfb57397fd93ba719e7440a069ee5c936ac617354d958785f13ea18cd8aa0b830037acf7bcfc7e91926e52ee13ecb0bc019109242a1632
7
+ data.tar.gz: acf3aef2ef012f164abb9c8bddf2d374b4a1270d844a46722457079ce5719571c2642a09e08ecc0645c63ae7b529015263a126a73a25d16b24f8650203ddba83
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module WindowsUpdate
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -94,52 +94,48 @@ $updateSession = New-Object -ComObject 'Microsoft.Update.Session'
94
94
  $updateSession.ClientApplicationID = 'vagrant-windows-update'
95
95
 
96
96
  Write-Output 'Searching for Windows updates...'
97
- $updateSearcher = $updateSession.CreateUpdateSearcher()
98
97
  $updatesToDownload = New-Object -ComObject 'Microsoft.Update.UpdateColl'
98
+ $updatesToInstall = New-Object -ComObject 'Microsoft.Update.UpdateColl'
99
+ $updateSearcher = $updateSession.CreateUpdateSearcher()
99
100
  $searchResult = $updateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0")
100
- if ($searchResult.Updates.Count) {
101
- for ($i = 0; $i -lt $searchResult.Updates.Count; ++$i) {
102
- $update = $searchResult.Updates.Item($i)
101
+ for ($i = 0; $i -lt $searchResult.Updates.Count; ++$i) {
102
+ $update = $searchResult.Updates.Item($i)
103
103
 
104
- if ($update.InstallationBehavior.CanRequestUserInput) {
105
- continue
106
- }
104
+ if ($update.InstallationBehavior.CanRequestUserInput) {
105
+ continue
106
+ }
107
107
 
108
- $updateDate = $update.LastDeploymentChangeTime.ToString('yyyy-MM-dd')
109
- $updateSize = ($update.MaxDownloadSize/1024/1024).ToString('0.##')
110
- Write-Output "Found Windows update ($updateDate; $updateSize MB): $($update.Title)"
108
+ if (!$update.AutoSelectOnWebSites) {
109
+ continue
110
+ }
111
111
 
112
- $update.AcceptEula() | Out-Null
112
+ $updateDate = $update.LastDeploymentChangeTime.ToString('yyyy-MM-dd')
113
+ $updateSize = ($update.MaxDownloadSize/1024/1024).ToString('0.##')
114
+ Write-Output "Found Windows update ($updateDate; $updateSize MB): $($update.Title)"
113
115
 
114
- if ($update.IsDownloaded) {
115
- continue
116
- }
116
+ $update.AcceptEula() | Out-Null
117
117
 
118
+ if (!$update.IsDownloaded) {
118
119
  $updatesToDownload.Add($update) | Out-Null
119
120
  }
120
121
 
121
- if ($updatesToDownload.Count) {
122
- Write-Output 'Downloading Windows updates...'
123
- $updateDownloader = $updateSession.CreateUpdateDownloader()
124
- $updateDownloader.Updates = $updatesToDownload
125
- $updateDownloader.Download() | Out-Null
126
- }
122
+ $updatesToInstall.Add($update) | Out-Null
123
+ }
127
124
 
128
- $updatesToInstall = New-Object -ComObject 'Microsoft.Update.UpdateColl'
129
- for ($i = 0; $i -lt $searchResult.Updates.Count; ++$i) {
130
- $update = $searchResult.Updates.Item($i)
131
- if ($update.IsDownloaded) {
132
- $updatesToInstall.Add($update) | Out-Null
133
- }
134
- }
125
+ if ($updatesToDownload.Count) {
126
+ Write-Output 'Downloading Windows updates...'
127
+ $updateDownloader = $updateSession.CreateUpdateDownloader()
128
+ $updateDownloader.Updates = $updatesToDownload
129
+ $updateDownloader.Download() | Out-Null
130
+ }
135
131
 
136
- if ($updatesToInstall.Count) {
137
- Write-Output 'Installing Windows updates...'
138
- $updateInstaller = $updateSession.CreateUpdateInstaller()
139
- $updateInstaller.Updates = $updatesToInstall
140
- $installResult = $updateInstaller.Install()
141
- ExitWhenRebootRequired $true
142
- }
143
- } else {
144
- Write-Output 'No Windows updates found'
132
+ if ($updatesToInstall.Count) {
133
+ Write-Output 'Installing Windows updates...'
134
+ $updateInstaller = $updateSession.CreateUpdateInstaller()
135
+ $updateInstaller.Updates = $updatesToInstall
136
+ $installResult = $updateInstaller.Install()
137
+ ExitWhenRebootRequired $true
138
+ Exit 0
145
139
  }
140
+
141
+ 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
4
+ version: 0.0.5
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-05-03 00:00:00.000000000 Z
11
+ date: 2017-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake