forked from AutomationD/wimaging
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUpdate-BootAll.ps1
83 lines (64 loc) · 1.8 KB
/
Update-BootAll.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
. '.\inc\Config.ps1'
. '.\inc\Params.ps1'
. '.\inc\Functions.ps1'
# Main Program
if ($os -eq "windows-pe-x64")
{
# If working on 1-imaged boot.wim (winpe)
MountWim $wim_file $mount_dir $wim_image_name
AddDrivers $drivers_dir $mount_dir
# This will add additional PE packages
AddUpdates $update_dir $mount_dir
AddTools $tools_dir $mount_dir
# No Unmount
}
else
{
# If working on 2-imaged boot.wim
Write-Host "This will update both images, including boot and install. It will atempt to go through the following:"
while("y","n" -notcontains $answer)
{
$answer = Read-Host "AddDrivers, AddTools. Continue? (y/n)"
}
if ($answer -eq "n")
{
Write-Host "Cancelled."
exit 1
}
Write-Host "Working on the boot image" -foregroundcolor "green"
Write-Host "First index" -foreground "magenta"
$boot = $true
. '.\inc\Params.ps1'
. '.\inc\Functions.ps1'
MountWim $wim_file $mount_dir $wim_image_name_pe
AddDrivers $drivers_dir $mount_dir
UnmountWim $mount_dir
Write-Host "Second index" -foreground "magenta"
MountWim $wim_file $mount_dir $wim_image_name_setup
AddDrivers $drivers_dir $mount_dir
AddTools $tools_dir $mount_dir
#Write-Host "Working on the install image" -foregroundcolor "green"
#$boot = $false
#. '.\inc\Params.ps1'
#. '.\inc\Functions.ps1'
#MountWim $wim_file $mount_dir $wim_image_name
#AddDrivers $drivers_dir $mount_dir
#AddUpdates $update_dir $mount_dir
#AddTools $tools_dir $mount_dir
# No Unmount intentionally here
}
# Add Updates
# Commit only on successful update
if ($lastexitcode -ne 0)
{
Write-Host "Errors found, NOT committing any changes"
UnmountWim $mount_dir "n"
Write-Error "Wim was as not pushed"
}
else
{
Write-Host "No errors found, committing changes"
UnmountWim $mount_dir
Write-Host "Image still not pushed"
#PushWim $wim_file
}