1
0

validate-user-data.ps1 522 B

123456789101112131415
  1. param(
  2. [Parameter(Mandatory = $true)]
  3. [string]$Path
  4. )
  5. $ErrorActionPreference = 'Stop'
  6. $content = [IO.File]::ReadAllText($Path)
  7. $runcmdCount = [regex]::Matches($content, '(?m)^runcmd:\s*$').Count
  8. $launcherPattern = [regex]::Escape('for d in /boot/firmware /boot; do [ -f "$d/waouw-activate.sh" ] && exec bash "$d/waouw-activate.sh"; done; echo waouw-activate.sh introuvable >&2; exit 1')
  9. $hasLauncher = $content -match $launcherPattern
  10. if ($runcmdCount -ne 1 -or -not $hasLauncher) {
  11. exit 9
  12. }