fbt.ps1 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. Push-Location $PSScriptRoot
  2. $firmware_path = ""
  3. $firmware_name = ""
  4. if (('official', 'off', 'o').Contains($args[0])) {
  5. $firmware_path = "flipperzero-firmware_official"
  6. $firmware_name = "Official"
  7. }
  8. elseif (('unleashed', 'un', 'u').Contains($args[0])) {
  9. $firmware_path = "flipperzero-firmware_unleashed"
  10. $firmware_name = "Unleashed"
  11. }
  12. else {
  13. throw "Unable to recognize which firmware to use"
  14. }
  15. Write-Host "Using $firmware_name firmware to run FBT"
  16. if ((Test-Path -Path "$firmware_path\applications_user\totp") -ne $True) {
  17. $mklink_command = "mklink /D $firmware_path\applications_user\totp ..\..\totp"
  18. if (!(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
  19. Write-Host $PSScriptRoot
  20. Start-Process -FilePath 'cmd' -ArgumentList ( "/C", "cd $PSScriptRoot & $mklink_command") -Verb RunAs
  21. } else {
  22. Invoke-Expression -Command $mklink_command
  23. }
  24. }
  25. Push-Location $firmware_path
  26. ./fbt $args[1..($args.Length - 1)]
  27. Pop-Location
  28. Pop-Location