2019-09-25 05:27:35 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Builds the ZIP archive inside the Docker container
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o xtrace
|
|
|
|
|
|
|
|
# Version variables
|
|
|
|
NSSM_VERSION="nssm-2.24-101-g897c7ad"
|
2019-10-29 05:10:36 +00:00
|
|
|
NSSM_URL="http://files.evilt.win/nssm/${NSSM_VERSION}.zip"
|
2019-09-25 05:27:35 +00:00
|
|
|
FFMPEG_VERSION="ffmpeg-4.0.2-win32-static"
|
|
|
|
FFMPEG_URL="https://ffmpeg.zeranoe.com/builds/win32/static/${FFMPEG_VERSION}.zip"
|
|
|
|
|
|
|
|
# Move to source directory
|
|
|
|
pushd ${SOURCE_DIR}
|
|
|
|
|
|
|
|
# Clone down and build Web frontend
|
|
|
|
web_build_dir="$( mktemp -d )"
|
|
|
|
web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web"
|
|
|
|
git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/
|
|
|
|
pushd ${web_build_dir}
|
|
|
|
if [[ -n ${web_branch} ]]; then
|
|
|
|
checkout -b origin/${web_branch}
|
|
|
|
fi
|
|
|
|
yarn install
|
|
|
|
mkdir -p ${web_target}
|
|
|
|
mv dist/* ${web_target}/
|
|
|
|
popd
|
2019-09-25 05:36:20 +00:00
|
|
|
rm -rf ${web_build_dir}
|
2019-09-25 05:27:35 +00:00
|
|
|
|
|
|
|
# Get version
|
|
|
|
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
|
|
|
|
|
|
|
|
# Build binary
|
|
|
|
dotnet publish --configuration Release --self-contained --runtime win-x86 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
|
|
|
|
|
|
|
|
# Prepare addins
|
|
|
|
addin_build_dir="$( mktemp -d )"
|
|
|
|
wget ${NSSM_URL} -O ${addin_build_dir}/nssm.zip
|
|
|
|
wget ${FFMPEG_URL} -O ${addin_build_dir}/ffmpeg.zip
|
|
|
|
unzip ${addin_build_dir}/nssm.zip -d ${addin_build_dir}
|
|
|
|
cp ${addin_build_dir}/${NSSM_VERSION}/win64/nssm.exe /dist/jellyfin_${version}/nssm.exe
|
|
|
|
unzip ${addin_build_dir}/ffmpeg.zip -d ${addin_build_dir}
|
|
|
|
cp ${addin_build_dir}/${FFMPEG_VERSION}/bin/ffmpeg.exe /dist/jellyfin_${version}/ffmpeg.exe
|
|
|
|
cp ${addin_build_dir}/${FFMPEG_VERSION}/bin/ffprobe.exe /dist/jellyfin_${version}/ffprobe.exe
|
2019-09-25 05:36:20 +00:00
|
|
|
rm -rf ${addin_build_dir}
|
2019-09-25 05:27:35 +00:00
|
|
|
|
|
|
|
# Prepare scripts
|
|
|
|
cp ${SOURCE_DIR}/deployment/windows/legacy/install-jellyfin.ps1 /dist/jellyfin_${version}/install-jellyfin.ps1
|
|
|
|
cp ${SOURCE_DIR}/deployment/windows/legacy/install.bat /dist/jellyfin_${version}/install.bat
|
|
|
|
|
|
|
|
# Create zip package
|
|
|
|
pushd /dist
|
2019-09-29 04:33:31 +00:00
|
|
|
zip -r /jellyfin_${version}.portable.zip jellyfin_${version}
|
2019-09-25 05:27:35 +00:00
|
|
|
popd
|
|
|
|
rm -rf /dist/jellyfin_${version}
|
|
|
|
|
|
|
|
# Move the artifacts out
|
|
|
|
mkdir -p ${ARTIFACT_DIR}/
|
|
|
|
mv /jellyfin[-_]*.zip ${ARTIFACT_DIR}/
|
|
|
|
chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR}
|