-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
create-module.ps1
54 lines (49 loc) · 1.62 KB
/
create-module.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
$MODULE_NAME = "open-webview.zip"
$TOOLS = "tools.tar"
$ROOT_DIR = Get-Location
$OVERLAY_DIR = "overlays"
$TOOLS_DIR = "common/tools"
function Compress {
param (
[string]$type,
[string]$output,
[string[]]$input
)
Write-Host "Compressing $output..."
& 7z.exe a -t$type -r $output $input | Out-Null
}
Write-Host "Deleting old files..."
if (Test-Path $MODULE_NAME) {
Remove-Item -Force $MODULE_NAME
}
if (Test-Path "$TOOLS_DIR\$($TOOLS).xz") {
Remove-Item -Force "$TOOLS_DIR\$($TOOLS).xz"
}
Get-ChildItem -Path "$OVERLAY_DIR" -Filter "*.zip" | Remove-Item -Force
Write-Host "Old files deleted!"
Write-Host "Zipping tools..."
Set-Location -Path "$TOOLS_DIR/tools"
Compress -type tar -output $TOOLS -input (Get-ChildItem -Name)
Compress -type xz -output "${TOOLS}.xz" -input $TOOLS
Remove-Item -Force $TOOLS
Move-Item -Path "${TOOLS}.xz" -Destination "$TOOLS_DIR" -Force
Set-Location -Path $ROOT_DIR
Write-Host "Tools zipped!"
Write-Host "Zipping overlays..."
Set-Location -Path $OVERLAY_DIR
$overlays = @{
"mulch-overlay28.zip" = "./extracted/mulch-overlay28/*"
"mulch-overlay29.zip" = "./extracted/mulch-overlay29/*"
"vanadium-overlay29.zip" = "./extracted/vanadium-overlay29/*"
}
foreach ($zip_name in $overlays.Keys) {
Compress -type zip -output $zip_name -input $overlays[$zip_name]
}
Set-Location -Path $ROOT_DIR
Write-Host "Overlays zipped!"
Write-Host "Creating module zip..."
& 7z.exe a -tzip -r $MODULE_NAME * `
"-xr!.git*" "-xr!img" "-xr!common/tools/tools" `
"-xr!overlays/extracted" "-x!*.md" "-x!create-module.*" | Out-Null
Write-Host "Module zip created!"
Write-Host "Done!"