build script can generate zip, maybe be run from linux

This commit is contained in:
Phallacy 2018-12-12 11:41:08 -08:00
parent 7ded4dee08
commit 98fa61a766

View File

@ -1,7 +1,8 @@
[CmdletBinding()] [CmdletBinding()]
param( param(
[switch]$InstallFFMPEG, [switch]$InstallFFMPEG,
[string]$InstallLocation = "$Env:AppData\JellyFin-Server\", [switch]$GenerateZip,
[string]$InstallLocation = "$Env:AppData/JellyFin-Server/",
[ValidateSet('Debug','Release')][string]$BuildType = 'Release', [ValidateSet('Debug','Release')][string]$BuildType = 'Release',
[ValidateSet('Quiet','Minimal', 'Normal')][string]$DotNetVerbosity = 'Minimal', [ValidateSet('Quiet','Minimal', 'Normal')][string]$DotNetVerbosity = 'Minimal',
[ValidateSet('win','win7', 'win8','win81','win10')][string]$WindowsVersion = 'win', [ValidateSet('win','win7', 'win8','win81','win10')][string]$WindowsVersion = 'win',
@ -20,7 +21,7 @@ function Build-JellyFin {
exit exit
} }
} }
dotnet publish -c $BuildType -r "$windowsversion-$Architecture" .\MediaBrowser.sln -o $InstallLocation -v $DotNetVerbosity dotnet publish -c $BuildType -r "$windowsversion-$Architecture" MediaBrowser.sln -o $InstallLocation -v $DotNetVerbosity
} }
function Install-FFMPEG { function Install-FFMPEG {
@ -34,26 +35,26 @@ function Install-FFMPEG {
Write-Warning "FFMPEG will not be installed" Write-Warning "FFMPEG will not be installed"
}elseif($Architecture -eq 'x64'){ }elseif($Architecture -eq 'x64'){
Write-Verbose "Downloading 64 bit FFMPEG" Write-Verbose "Downloading 64 bit FFMPEG"
Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.1-win64-static.zip -UseBasicParsing -OutFile $env:TEMP\fmmpeg.zip | Write-Verbose Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.1-win64-static.zip -UseBasicParsing -OutFile "$env:TEMP/fmmpeg.zip" | Write-Verbose
}else{ }else{
Write-Verbose "Downloading 32 bit FFMPEG" Write-Verbose "Downloading 32 bit FFMPEG"
Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.1-win32-static.zip -UseBasicParsing -OutFile $env:TEMP\fmmpeg.zip | Write-Verbose Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.1-win32-static.zip -UseBasicParsing -OutFile "$env:TEMP/fmmpeg.zip" | Write-Verbose
} }
Expand-Archive $env:TEMP\fmmpeg.zip -DestinationPath $env:TEMP\ffmpeg\ | Write-Verbose Expand-Archive "$env:TEMP/fmmpeg.zip" -DestinationPath "$env:TEMP/ffmpeg/" | Write-Verbose
if($Architecture -eq 'x64'){ if($Architecture -eq 'x64'){
Write-Verbose "Copying Binaries to Jellyfin location" Write-Verbose "Copying Binaries to Jellyfin location"
Get-ChildItem "$env:temp\ffmpeg\ffmpeg-4.1-win64-static\bin" | ForEach-Object { Get-ChildItem "$env:temp/ffmpeg/ffmpeg-4.1-win64-static/bin" | ForEach-Object {
Copy-Item $_.FullName -Destination $installLocation | Write-Verbose Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
} }
}else{ }else{
Write-Verbose "Copying Binaries to Jellyfin location" Write-Verbose "Copying Binaries to Jellyfin location"
Get-ChildItem "$env:temp\ffmpeg\ffmpeg-4.1-win32-static\bin" | ForEach-Object { Get-ChildItem "$env:temp/ffmpeg/ffmpeg-4.1-win32-static/bin" | ForEach-Object {
Copy-Item $_.FullName -Destination $installLocation | Write-Verbose Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
} }
} }
Remove-Item $env:TEMP\ffmpeg\ -Recurse -Force -ErrorAction Continue | Write-Verbose Remove-Item "$env:TEMP/ffmpeg/" -Recurse -Force -ErrorAction Continue | Write-Verbose
Remove-Item $env:TEMP\fmmpeg.zip -Force -ErrorAction Continue | Write-Verbose Remove-Item "$env:TEMP/fmmpeg.zip" -Force -ErrorAction Continue | Write-Verbose
} }
Write-Verbose "Starting Build Process: Selected Environment is $WindowsVersion-$Architecture" Write-Verbose "Starting Build Process: Selected Environment is $WindowsVersion-$Architecture"
Build-JellyFin Build-JellyFin
@ -61,4 +62,7 @@ if($InstallFFMPEG.IsPresent -or ($InstallFFMPEG -eq $true)){
Write-Verbose "Starting FFMPEG Install" Write-Verbose "Starting FFMPEG Install"
Install-FFMPEG $InstallLocation $Architecture Install-FFMPEG $InstallLocation $Architecture
} }
if($GenerateZip.IsPresent -or ($GenerateZip -eq $true)){
Compress-Archive -Path $InstallLocation -DestinationPath "$InstallLocation/jellyfin.zip" -Force
}
Write-Verbose "Finished" Write-Verbose "Finished"