Files

27 lines
1.1 KiB
PowerShell

# Deploy Paravis GRUB menu + apps from D: staging to p1.
$src = 'C:\PF\ParavisGrub'
$dst = 'F:\efi\Paravis\Boot\grub2'
New-Item -ItemType Directory -Force "$dst\menu" | Out-Null
New-Item -ItemType Directory -Force "$dst\apps" | Out-Null
Copy-Item "$src\grub.cfg" "$dst\grub.cfg" -Force
Copy-Item "$src\menu\*.cfg" "$dst\menu\" -Force
Copy-Item "$src\apps\memtest86p.efi" "$dst\apps\memtest86p.efi" -Force
Remove-Item "$dst\apps\memtest86.efi" -Force -ErrorAction SilentlyContinue
'--- deployed tree:'
Get-ChildItem $dst -Recurse -File | Select-Object @{n='rel';e={$_.FullName.Replace("$dst\",'')}},Length | Sort-Object rel | Format-Table -AutoSize
'--- syntax check:'
$checker = 'C:\PF\grub2-a1ive\grub\grub-script-check.exe'
Get-ChildItem "$dst\grub.cfg", "$dst\menu\*.cfg" | ForEach-Object {
& $checker $_.FullName
if ($LASTEXITCODE -eq 0) { " OK $($_.Name)" } else { " FAIL $($_.Name)" }
}
'--- main menu head:'
Get-Content "$dst\grub.cfg" -TotalCount 6 | ForEach-Object { ' ' + $_ }
'--- submenu timeouts:'
Get-ChildItem "$dst\menu\*.cfg" | ForEach-Object { ' {0,-14} {1}' -f $_.Name, ((Get-Content $_.FullName -TotalCount 1)) }