-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.ps1
More file actions
47 lines (41 loc) · 1.79 KB
/
make.ps1
File metadata and controls
47 lines (41 loc) · 1.79 KB
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
$beebasm_dir = "build\beebasm"
$beebasm = "$beebasm_dir\beebasm.exe"
$ssd_out = "butil.ssd"
$title = "Backup util"
$srcs = ("butil.bas", "bu_lib.asm", "!boot")
$asm_src = "bu_lib.asm"
[Security.Principal.WindowsBuiltInRole] $adminrole = "Administrator"
$isadmin = ([Security.Principal.WindowsPrincipal]`
[Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole($adminrole)
if (!(Test-Path $beebasm)) {
echo "Getting beebasm"
git submodule update --init
}
[DateTime]$ssd_out_stamp = if (!(Test-Path $ssd_out)) {0} else {(Get-Item $ssd_out).LastWriteTime}
$newer = $srcs.Where({Test-Path $_ -NewerThan $ssd_out_stamp}).Count
if ($newer -gt 0) {
echo "Checking for Microsoft Visual C++ 2010 redistibutable"
$vccount=(Get-WmiObject -Class Win32_Product -Filter "Name LIKE '%Visual C++ 2010%'").Count
if ($vccount -eq 0) {
echo "Downloading Microsoft Visual C++ 2010 redistibutable"
$tempdir=[IO.Path]::GetTempPath()
$vcredist_src="http://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe"
$vcredist_dst=Join-Path $tempdir "vcredist_x86_2010_sp1.exe"
Invoke-WebRequest $vcredist_src -Out $vcredist_dst
echo "Invoking Microsoft Visual C++ 2010 redistributable installer"
Start-Process $vcredist_dst -Wait
if (-Not $?) { break }
Remove-Item -Recurse $vcredist_dst
}
echo "Building '$ssd_out'"
cat butil.bas | % {
if (-not ($_ -match '^\s*$') -and -not ($_ -match '^\s*:: REM ')) {
"{0,6} {1}" -f $_.ReadCount, $_
}
} | Out-File -Encoding ascii butil.bbas
& "$beebasm" -i $asm_src -do $ssd_out -opt 3 -title "$title"
if (-not $?) { Remove-Item $ssd_out }
Remove-Item butil.bbas
} else {
echo "File '$ssd_out' is up to date."
}