-
Notifications
You must be signed in to change notification settings - Fork 2
/
bootstrap.bat
54 lines (45 loc) · 1.76 KB
/
bootstrap.bat
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
@@:: This prolog allows a PowerShell script to be embedded in a .CMD file.
@@:: Any non-PowerShell content must be preceeded by "@@"
@@setlocal
@@set POWERSHELL_BAT_ARGS=%*
@@if defined POWERSHELL_BAT_ARGS set POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%
@@PowerShell -noprofile -Command Invoke-Expression $('$args=@(^&{$args} %POWERSHELL_BAT_ARGS%);'+[String]::Join(';',$((Get-Content '%~f0') -notmatch '^^@@'))) & pause & goto :EOF
Set-ExecutionPolicy Bypass -Scope Process -Force
If ( -Not (Test-Path $(get-command choco).PATH) ) {
"chocolatey windows package manager not found, Installing ..."
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
ForEach ($binary in '7z','pandoc','pp') {
If ( get-command $binary -ErrorAction silentlycontinue ){
Invoke-Expression "`$$binary = `$(get-command $binary).Path"
} ElseIf ( Test-Path "$($PWD.PATH)\$($binary).exe" ) {
Invoke-Expression "`$$binary = `"$($PWD.PATH)\$binary.exe`""
}
}
"Checking for 7z ..."
If ( -Not $7z ) {
"7z command not found, Installing ..."
choco install 7zip.install -y
} Else {
"OK`: Found 7z - $7z"
}
"Checking for pp ..."
If ( -Not $pp ) {
"pp markdown preprocessor not found, downloading archive from https://cdsoft.fr/pp/pp-win.7z ..."
Invoke-WebRequest -Uri "https://cdsoft.fr/pp/pp-win.7z" -OutFile "c:\temp\pp-win.7z"
&7z x "c:\temp\pp-win.7z" `-o`"$($env:ChocolateyInstall)\bin`"
"removing intermediate archive"
If ( (Test-Path "c:\temp\pp-win.7z") ){
remove-item "c:\temp\pp-win.7z"
}
} Else {
"OK`: Found pp - $pp"
}
"Checking for pandoc ..."
If ( -Not $pandoc ) {
"pandoc command not found, Installing ..."
choco install pandoc -y
} Else {
"OK`: Found pandoc - $pandoc"
}
"Done!"