Skip to content

Commit

Permalink
fix process check, scoop install & ffmpeg check
Browse files Browse the repository at this point in the history
  • Loading branch information
couleurm committed Feb 15, 2022
1 parent 4820ec2 commit 4e104bb
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions install/pre.ps1
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
if (Get-Command sm -Ea Ignore){
"@
@"
A Smoothie installation has been detected, what would you like to do?
Press R to Reinstall Smoothie (clean install)
Press V to update Smoothie to a newer version
Press U to uninstall Smoothie
"@

@"
function CheckProcesses{
if (Get-Process -Name sm,vspipe,ffmpeg -ErrorAction SilentlyContinue){
Write-Warning "One of the following processes are still running and may cause uninstallation issues, make sure these processes are not tied to Smoothie:"
Get-Process -Name sm,vspipe,ffmpeg -ErrorAction SilentlyContinue
}

}
switch (choice.exe /C RVU /N | Out-Null){
1{
CheckProcesses
scoop.cmd uninstall smoothie
scoop.cmd install smoothie
pause
exit
}
2{
CheckProcesses
scoop.cmd update smoothie
pause
exit
}
3{
CheckProcesses
scoop.cmd uninstall smoothie
pause
exit
Expand All @@ -28,6 +39,7 @@ switch (choice.exe /C RVU /N | Out-Null){
}

if (-Not(Get-Command scoop.cmd -Ea Ignore)){
Set-ExecutionPolicy Bypass -Scope Process -Force
Invoke-RestMethod -Uri http://get.scoop.sh | Invoke-Expression
}

Expand All @@ -39,8 +51,28 @@ if ('utils' -NotIn (scoop.cmd bucket list)){
scoop.cmd bucket add utils https://github.com/couleur-tweak-tips/utils
}

$IsFFmpegScoop = (Get-Command ffmpeg -Ea Ignore).Source -Like "*\shims\*"

if(Get-Command ffmpeg -Ea Ignore){

$IsFFmpeg5 = (ffmpeg -hide_banner -h filter=libplacebo)

if (-Not($IsFFmpeg5)){

if ($IsFFmpegScoop){
scoop.cmd update ffmpeg
}else{
Write-Warning @"
An FFmpeg installation was detected, but it is not version 5.0 or higher.
If you installed FFmpeg yourself, you can remove it and use the following command to install ffmpeg and add it to the path:
scoop.cmd install ffmpeg
"@

}

}

}else{
scoop.cmd install ffmpeg
}
Expand Down

0 comments on commit 4e104bb

Please sign in to comment.