Merge remote-tracking branch 'upstream/master'

This commit is contained in:
BuildTools 2024-03-16 10:00:25 +00:00
commit 658c63714c
15 changed files with 377 additions and 364 deletions

View file

@ -67,10 +67,10 @@ body:
- type: textarea - type: textarea
attributes: attributes:
description: | description: |
Provide a full docker log, output of "docker logs linuxserver.io" Provide a full docker log, output of "docker logs plex"
label: Container logs label: Container logs
placeholder: | placeholder: |
Output of `docker logs linuxserver.io` Output of `docker logs plex`
render: bash render: bash
validations: validations:
required: true required: true

View file

@ -7,7 +7,7 @@ jobs:
external-trigger-master: external-trigger-master:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3.1.0 - uses: actions/checkout@v4.1.1
- name: External Trigger - name: External Trigger
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'

View file

@ -9,7 +9,7 @@ jobs:
external-trigger-scheduler: external-trigger-scheduler:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3.1.0 - uses: actions/checkout@v4.1.1
with: with:
fetch-depth: '0' fetch-depth: '0'

View file

@ -7,7 +7,7 @@ jobs:
package-trigger-master: package-trigger-master:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3.1.0 - uses: actions/checkout@v4.1.1
- name: Package Trigger - name: Package Trigger
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'

View file

@ -9,7 +9,7 @@ jobs:
package-trigger-scheduler: package-trigger-scheduler:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3.1.0 - uses: actions/checkout@v4.1.1
with: with:
fetch-depth: '0' fetch-depth: '0'

159
Jenkinsfile vendored
View file

@ -16,6 +16,7 @@ pipeline {
GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab') GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab')
GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0') GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0')
GITLAB_NAMESPACE=credentials('gitlab-namespace-id') GITLAB_NAMESPACE=credentials('gitlab-namespace-id')
DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat')
JSON_URL = 'https://plex.tv/api/downloads/5.json' JSON_URL = 'https://plex.tv/api/downloads/5.json'
JSON_PATH = '.computer.Linux.version' JSON_PATH = '.computer.Linux.version'
BUILD_VERSION_ARG = 'PLEX_RELEASE' BUILD_VERSION_ARG = 'PLEX_RELEASE'
@ -60,11 +61,16 @@ pipeline {
env.COMMIT_SHA = sh( env.COMMIT_SHA = sh(
script: '''git rev-parse HEAD''', script: '''git rev-parse HEAD''',
returnStdout: true).trim() returnStdout: true).trim()
env.GH_DEFAULT_BRANCH = sh(
script: '''git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||' ''',
returnStdout: true).trim()
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/' env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
env.PULL_REQUEST = env.CHANGE_ID env.PULL_REQUEST = env.CHANGE_ID
env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/call_issue_pr_tracker.yml ./.github/workflows/call_issues_cron.yml ./.github/workflows/permissions.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml' env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/call_issue_pr_tracker.yml ./.github/workflows/call_issues_cron.yml ./.github/workflows/permissions.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml'
} }
sh '''#! /bin/bash
echo "The default github branch detected as ${GH_DEFAULT_BRANCH}" '''
script{ script{
env.LS_RELEASE_NUMBER = sh( env.LS_RELEASE_NUMBER = sh(
script: '''echo ${LS_RELEASE} |sed 's/^.*-ls//g' ''', script: '''echo ${LS_RELEASE} |sed 's/^.*-ls//g' ''',
@ -122,7 +128,7 @@ pipeline {
steps{ steps{
script{ script{
env.EXT_RELEASE_CLEAN = sh( env.EXT_RELEASE_CLEAN = sh(
script: '''echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g' ''', script: '''echo ${EXT_RELEASE} | sed 's/[~,%@+;:/ ]//g' ''',
returnStdout: true).trim() returnStdout: true).trim()
def semver = env.EXT_RELEASE_CLEAN =~ /(\d+)\.(\d+)\.(\d+)/ def semver = env.EXT_RELEASE_CLEAN =~ /(\d+)\.(\d+)\.(\d+)/
@ -140,7 +146,7 @@ pipeline {
} }
if (env.SEMVER != null) { if (env.SEMVER != null) {
if (BRANCH_NAME != "master" && BRANCH_NAME != "main") { if (BRANCH_NAME != "${env.GH_DEFAULT_BRANCH}") {
env.SEMVER = "${env.SEMVER}-${BRANCH_NAME}" env.SEMVER = "${env.SEMVER}-${BRANCH_NAME}"
} }
println("SEMVER: ${env.SEMVER}") println("SEMVER: ${env.SEMVER}")
@ -241,9 +247,11 @@ pipeline {
-v ${WORKSPACE}:/mnt \ -v ${WORKSPACE}:/mnt \
-e AWS_ACCESS_KEY_ID=\"${S3_KEY}\" \ -e AWS_ACCESS_KEY_ID=\"${S3_KEY}\" \
-e AWS_SECRET_ACCESS_KEY=\"${S3_SECRET}\" \ -e AWS_SECRET_ACCESS_KEY=\"${S3_SECRET}\" \
ghcr.io/linuxserver/baseimage-alpine:3.17 s6-envdir -fn -- /var/run/s6/container_environment /bin/bash -c "\ ghcr.io/linuxserver/baseimage-alpine:3.19 s6-envdir -fn -- /var/run/s6/container_environment /bin/bash -c "\
apk add --no-cache py3-pip && \ apk add --no-cache python3 && \
pip install s3cmd && \ python3 -m venv /lsiopy && \
pip install --no-cache-dir -U pip && \
pip install --no-cache-dir s3cmd && \
s3cmd put --no-preserve --acl-public -m text/xml /mnt/shellcheck-result.xml s3://ci-tests.linuxserver.io/${IMAGE}/${META_TAG}/shellcheck-result.xml" || :''' s3cmd put --no-preserve --acl-public -m text/xml /mnt/shellcheck-result.xml s3://ci-tests.linuxserver.io/${IMAGE}/${META_TAG}/shellcheck-result.xml" || :'''
} }
} }
@ -262,8 +270,15 @@ pipeline {
set -e set -e
TEMPDIR=$(mktemp -d) TEMPDIR=$(mktemp -d)
docker pull ghcr.io/linuxserver/jenkins-builder:latest docker pull ghcr.io/linuxserver/jenkins-builder:latest
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest # Cloned repo paths for templating:
# Stage 1 - Jenkinsfile update # ${TEMPDIR}/docker-${CONTAINER_NAME}: Cloned branch master of ${LS_USER}/${LS_REPO} for running the jenkins builder on
# ${TEMPDIR}/repo/${LS_REPO}: Cloned branch master of ${LS_USER}/${LS_REPO} for commiting various templated file changes and pushing back to Github
# ${TEMPDIR}/docs/docker-documentation: Cloned docs repo for pushing docs updates to Github
# ${TEMPDIR}/unraid/docker-templates: Cloned docker-templates repo to check for logos
# ${TEMPDIR}/unraid/templates: Cloned templates repo for commiting unraid template changes and pushing back to Github
git clone --branch master --depth 1 https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/docker-${CONTAINER_NAME}
docker run --rm -v ${TEMPDIR}/docker-${CONTAINER_NAME}:/tmp -e LOCAL=true ghcr.io/linuxserver/jenkins-builder:latest
echo "Starting Stage 1 - Jenkinsfile update"
if [[ "$(md5sum Jenkinsfile | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile | awk '{ print $1 }')" ]]; then if [[ "$(md5sum Jenkinsfile | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile | awk '{ print $1 }')" ]]; then
mkdir -p ${TEMPDIR}/repo mkdir -p ${TEMPDIR}/repo
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO} git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
@ -272,15 +287,16 @@ pipeline {
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/
git add Jenkinsfile git add Jenkinsfile
git commit -m 'Bot Updating Templated Files' git commit -m 'Bot Updating Templated Files'
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master
echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
echo "Updating Jenkinsfile" echo "Updating Jenkinsfile and exiting build, new one will trigger based on commit"
rm -Rf ${TEMPDIR} rm -Rf ${TEMPDIR}
exit 0 exit 0
else else
echo "Jenkinsfile is up to date." echo "Jenkinsfile is up to date."
fi fi
# Stage 2 - Delete old templates echo "Starting Stage 2 - Delete old templates"
OLD_TEMPLATES=".github/ISSUE_TEMPLATE.md .github/ISSUE_TEMPLATE/issue.bug.md .github/ISSUE_TEMPLATE/issue.feature.md .github/workflows/call_invalid_helper.yml .github/workflows/stale.yml Dockerfile.armhf" OLD_TEMPLATES=".github/ISSUE_TEMPLATE.md .github/ISSUE_TEMPLATE/issue.bug.md .github/ISSUE_TEMPLATE/issue.feature.md .github/workflows/call_invalid_helper.yml .github/workflows/stale.yml Dockerfile.armhf"
for i in ${OLD_TEMPLATES}; do for i in ${OLD_TEMPLATES}; do
if [[ -f "${i}" ]]; then if [[ -f "${i}" ]]; then
@ -296,15 +312,16 @@ pipeline {
git rm "${i}" git rm "${i}"
done done
git commit -m 'Bot Updating Templated Files' git commit -m 'Bot Updating Templated Files'
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master
echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
echo "Deleting old and deprecated templates" echo "Deleting old/deprecated templates and exiting build, new one will trigger based on commit"
rm -Rf ${TEMPDIR} rm -Rf ${TEMPDIR}
exit 0 exit 0
else else
echo "No templates to delete" echo "No templates to delete"
fi fi
# Stage 3 - Update templates echo "Starting Stage 3 - Update templates"
CURRENTHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8) CURRENTHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
cd ${TEMPDIR}/docker-${CONTAINER_NAME} cd ${TEMPDIR}/docker-${CONTAINER_NAME}
NEWHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8) NEWHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
@ -325,19 +342,34 @@ pipeline {
fi fi
git add readme-vars.yml ${TEMPLATED_FILES} git add readme-vars.yml ${TEMPLATED_FILES}
git commit -m 'Bot Updating Templated Files' git commit -m 'Bot Updating Templated Files'
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master
echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
echo "Updating templates and exiting build, new one will trigger based on commit"
rm -Rf ${TEMPDIR}
exit 0
else else
echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
echo "No templates to update"
fi fi
echo "Starting Stage 4 - External repo updates: Docs, Unraid Template and Readme Sync to Docker Hub"
mkdir -p ${TEMPDIR}/docs mkdir -p ${TEMPDIR}/docs
git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/docs/docker-documentation git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/docs/docker-documentation
if [[ ("${BRANCH_NAME}" == "master") || ("${BRANCH_NAME}" == "main") ]] && [[ (! -f ${TEMPDIR}/docs/docker-documentation/docs/images/docker-${CONTAINER_NAME}.md) || ("$(md5sum ${TEMPDIR}/docs/docker-documentation/docs/images/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]] && [[ (! -f ${TEMPDIR}/docs/docker-documentation/docs/images/docker-${CONTAINER_NAME}.md) || ("$(md5sum ${TEMPDIR}/docs/docker-documentation/docs/images/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/docs/docker-documentation/docs/images/ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/docs/docker-documentation/docs/images/
cd ${TEMPDIR}/docs/docker-documentation cd ${TEMPDIR}/docs/docker-documentation
GH_DOCS_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||')
git add docs/images/docker-${CONTAINER_NAME}.md git add docs/images/docker-${CONTAINER_NAME}.md
echo "Updating docs repo"
git commit -m 'Bot Updating Documentation' git commit -m 'Bot Updating Documentation'
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} || \
(MAXWAIT="10" && echo "Push to docs failed, trying again in ${MAXWAIT} seconds" && \
sleep $((RANDOM % MAXWAIT)) && \
git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase && \
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH})
else
echo "Docs update not needed, skipping"
fi fi
mkdir -p ${TEMPDIR}/unraid mkdir -p ${TEMPDIR}/unraid
git clone https://github.com/linuxserver/docker-templates.git ${TEMPDIR}/unraid/docker-templates git clone https://github.com/linuxserver/docker-templates.git ${TEMPDIR}/unraid/docker-templates
@ -347,8 +379,10 @@ pipeline {
elif [[ -f ${TEMPDIR}/unraid/docker-templates/linuxserver.io/img/${CONTAINER_NAME}-icon.png ]]; then elif [[ -f ${TEMPDIR}/unraid/docker-templates/linuxserver.io/img/${CONTAINER_NAME}-icon.png ]]; then
sed -i "s|master/linuxserver.io/img/linuxserver-ls-logo.png|master/linuxserver.io/img/${CONTAINER_NAME}-icon.png|" ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml sed -i "s|master/linuxserver.io/img/linuxserver-ls-logo.png|master/linuxserver.io/img/${CONTAINER_NAME}-icon.png|" ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml
fi fi
if [[ ("${BRANCH_NAME}" == "master") || ("${BRANCH_NAME}" == "main") ]] && [[ (! -f ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml) || ("$(md5sum ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml | awk '{ print $1 }')") ]]; then if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]] && [[ (! -f ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml) || ("$(md5sum ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml | awk '{ print $1 }')") ]]; then
echo "Updating Unraid template"
cd ${TEMPDIR}/unraid/templates/ cd ${TEMPDIR}/unraid/templates/
GH_TEMPLATES_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||')
if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
echo "Image is on the ignore list, marking Unraid template as deprecated" echo "Image is on the ignore list, marking Unraid template as deprecated"
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
@ -360,7 +394,42 @@ pipeline {
git add unraid/${CONTAINER_NAME}.xml git add unraid/${CONTAINER_NAME}.xml
git commit -m 'Bot Updating Unraid Template' git commit -m 'Bot Updating Unraid Template'
fi fi
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git --all git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git ${GH_TEMPLATES_DEFAULT_BRANCH} --rebase
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git ${GH_TEMPLATES_DEFAULT_BRANCH} || \
(MAXWAIT="10" && echo "Push to unraid templates failed, trying again in ${MAXWAIT} seconds" && \
sleep $((RANDOM % MAXWAIT)) && \
git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git ${GH_TEMPLATES_DEFAULT_BRANCH} --rebase && \
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git ${GH_TEMPLATES_DEFAULT_BRANCH})
else
echo "No updates to Unraid template needed, skipping"
fi
if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]]; then
if [[ $(cat ${TEMPDIR}/docker-${CONTAINER_NAME}/README.md | wc -m) -gt 25000 ]]; then
echo "Readme is longer than 25,000 characters. Syncing the lite version to Docker Hub"
DH_README_SYNC_PATH="${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/README.lite"
else
echo "Syncing readme to Docker Hub"
DH_README_SYNC_PATH="${TEMPDIR}/docker-${CONTAINER_NAME}/README.md"
fi
if curl -s https://hub.docker.com/v2/namespaces/${DOCKERHUB_IMAGE%%/*}/repositories/${DOCKERHUB_IMAGE##*/}/tags | jq -r '.message' | grep -q 404; then
echo "Docker Hub endpoint doesn't exist. Creating endpoint first."
DH_TOKEN=$(curl -d '{"username":"linuxserverci", "password":"'${DOCKERHUB_TOKEN}'"}' -H "Content-Type: application/json" -X POST https://hub.docker.com/v2/users/login | jq -r '.token')
curl -s \
-H "Authorization: JWT ${DH_TOKEN}" \
-H "Content-Type: application/json" \
-X POST \
-d '{"name":"'${DOCKERHUB_IMAGE##*/}'", "namespace":"'${DOCKERHUB_IMAGE%%/*}'"}' \
https://hub.docker.com/v2/repositories/ || :
fi
DH_TOKEN=$(curl -d '{"username":"linuxserverci", "password":"'${DOCKERHUB_TOKEN}'"}' -H "Content-Type: application/json" -X POST https://hub.docker.com/v2/users/login | jq -r '.token')
curl -s \
-H "Authorization: JWT ${DH_TOKEN}" \
-H "Content-Type: application/json" \
-X PATCH \
-d "{\\"full_description\\":$(jq -Rsa . ${DH_README_SYNC_PATH})}" \
https://hub.docker.com/v2/repositories/${DOCKERHUB_IMAGE} || :
else
echo "Not the default Github branch. Skipping readme sync to Docker Hub."
fi fi
rm -Rf ${TEMPDIR}''' rm -Rf ${TEMPDIR}'''
script{ script{
@ -424,6 +493,8 @@ pipeline {
"merge_requests_access_level":"disabled",\ "merge_requests_access_level":"disabled",\
"repository_access_level":"enabled",\ "repository_access_level":"enabled",\
"visibility":"public"}' ''' "visibility":"public"}' '''
sh '''curl -H "Private-Token: ${GITLAB_TOKEN}" -X PUT "https://gitlab.com/api/v4/projects/Linuxserver.io%2F${LS_REPO}" \
-d "mirror=true&import_url=https://github.com/linuxserver/${LS_REPO}.git" '''
} }
} }
/* ############### /* ###############
@ -560,7 +631,8 @@ pipeline {
wait wait
git add package_versions.txt git add package_versions.txt
git commit -m 'Bot Updating Package Versions' git commit -m 'Bot Updating Package Versions'
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master
echo "true" > /tmp/packages-${COMMIT_SHA}-${BUILD_NUMBER} echo "true" > /tmp/packages-${COMMIT_SHA}-${BUILD_NUMBER}
echo "Package tag updated, stopping build process" echo "Package tag updated, stopping build process"
else else
@ -663,12 +735,6 @@ pipeline {
} }
steps { steps {
withCredentials([ withCredentials([
[
$class: 'UsernamePasswordMultiBinding',
credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207',
usernameVariable: 'DOCKERUSER',
passwordVariable: 'DOCKERPASS'
],
[ [
$class: 'UsernamePasswordMultiBinding', $class: 'UsernamePasswordMultiBinding',
credentialsId: 'Quay.io-Robot', credentialsId: 'Quay.io-Robot',
@ -679,7 +745,7 @@ pipeline {
retry(5) { retry(5) {
sh '''#! /bin/bash sh '''#! /bin/bash
set -e set -e
echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin
echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin
echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin
@ -710,12 +776,6 @@ pipeline {
} }
steps { steps {
withCredentials([ withCredentials([
[
$class: 'UsernamePasswordMultiBinding',
credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207',
usernameVariable: 'DOCKERUSER',
passwordVariable: 'DOCKERPASS'
],
[ [
$class: 'UsernamePasswordMultiBinding', $class: 'UsernamePasswordMultiBinding',
credentialsId: 'Quay.io-Robot', credentialsId: 'Quay.io-Robot',
@ -726,7 +786,7 @@ pipeline {
retry(5) { retry(5) {
sh '''#! /bin/bash sh '''#! /bin/bash
set -e set -e
echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin
echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin
echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin
@ -856,39 +916,6 @@ EOF
) ''' ) '''
} }
} }
// Use helper container to sync the current README on master to the dockerhub endpoint
stage('Sync-README') {
when {
environment name: 'CHANGE_ID', value: ''
environment name: 'EXIT_STATUS', value: ''
}
steps {
withCredentials([
[
$class: 'UsernamePasswordMultiBinding',
credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207',
usernameVariable: 'DOCKERUSER',
passwordVariable: 'DOCKERPASS'
]
]) {
sh '''#! /bin/bash
set -e
TEMPDIR=$(mktemp -d)
docker pull ghcr.io/linuxserver/jenkins-builder:latest
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH="${BRANCH_NAME}" -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
docker pull ghcr.io/linuxserver/readme-sync
docker run --rm=true \
-e DOCKERHUB_USERNAME=$DOCKERUSER \
-e DOCKERHUB_PASSWORD=$DOCKERPASS \
-e GIT_REPOSITORY=${LS_USER}/${LS_REPO} \
-e DOCKER_REPOSITORY=${IMAGE} \
-e GIT_BRANCH=master \
-v ${TEMPDIR}/docker-${CONTAINER_NAME}:/mnt \
ghcr.io/linuxserver/readme-sync bash -c 'node sync'
rm -Rf ${TEMPDIR} '''
}
}
}
// If this is a Pull request send the CI link as a comment on it // If this is a Pull request send the CI link as a comment on it
stage('Pull Request Comment') { stage('Pull Request Comment') {
when { when {

View file

@ -75,38 +75,43 @@ The architectures supported by this image are:
Webui can be found at `<your-ip>:32400/web` Webui can be found at `<your-ip>:32400/web`
** Note about updates, if there is no value set for the VERSION variable, then no updates will take place.** **note**: If there is no value set for the VERSION variable, then no updates will take place.
** For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from, to update restart the Docker container after logging in through the webui** **note**: For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from, to update restart the Docker container after logging in through the webui.
Valid settings for VERSION are:- Valid settings for VERSION are:-
`IMPORTANT NOTE:- YOU CANNOT UPDATE TO A PLEXPASS ONLY (BETA) VERSION IF YOU ARE NOT LOGGED IN WITH A PLEXPASS ACCOUNT` **info**: YOU CANNOT UPDATE TO A PLEXPASS ONLY (BETA) VERSION IF YOU ARE NOT LOGGED IN WITH A PLEXPASS ACCOUNT.
+ **`docker`**: Let Docker handle the Plex Version, we keep our Dockerhub Endpoint up to date with the latest public builds. This is the same as leaving this setting out of your create command. + **`docker`**: Let Docker handle the Plex Version, we keep our Dockerhub Endpoint up to date with the latest public builds. This is the same as leaving this setting out of your create command.
+ **`latest`**: will update plex to the latest version available that you are entitled to. + **`latest`**: will update plex to the latest version available that you are entitled to.
+ **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge but still want the latest public updates. + **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge but still want the latest public updates.
+ **`<specific-version>`**: will select a specific version (eg 0.9.12.4.1192-9a47d21) of plex to install, note you cannot use this to access plexpass versions if you do not have plexpass. + **`<specific-version>`**: will select a specific version (eg 0.9.12.4.1192-9a47d21) of plex to install, note you cannot use this to access plexpass versions if you do not have plexpass.
## Hardware Acceleration ### Hardware Acceleration
### Intel Many desktop applications need access to a GPU to function properly and even some Desktop Environments have compositor effects that will not function without a GPU. However this is not a hard requirement and all base images will function without a video device mounted into the container.
Hardware acceleration users for Intel Quicksync will need to mount their /dev/dri video device inside of the container by passing the following command when running or creating the container: #### Intel/ATI/AMD
``` To leverage hardware acceleration you will need to mount /dev/dri video device inside of the container.
```text
--device=/dev/dri:/dev/dri --device=/dev/dri:/dev/dri
``` ```
We will automatically ensure the abc user inside of the container has the proper permissions to access this device. We will automatically ensure the abc user inside of the container has the proper permissions to access this device.
### Nvidia #### Nvidia
Hardware acceleration users for Nvidia will need to install the container runtime provided by Nvidia on their host, instructions can be found here: Hardware acceleration users for Nvidia will need to install the container runtime provided by Nvidia on their host, instructions can be found here:
https://github.com/NVIDIA/nvidia-container-toolkit
https://github.com/NVIDIA/nvidia-docker We automatically add the necessary environment variable that will utilise all the features available on a GPU on the host. Once nvidia-container-toolkit is installed on your host you will need to re/create the docker container with the nvidia container runtime `--runtime=nvidia` and add an environment variable `-e NVIDIA_VISIBLE_DEVICES=all` (can also be set to a specific gpu's UUID, this can be discovered by running `nvidia-smi --query-gpu=gpu_name,gpu_uuid --format=csv` ). NVIDIA automatically mounts the GPU and drivers from your host into the container.
We automatically add the necessary environment variable that will utilise all the features available on a GPU on the host. Once nvidia-docker is installed on your host you will need to re/create the docker container with the nvidia container runtime `--runtime=nvidia` and add an environment variable `-e NVIDIA_VISIBLE_DEVICES=all` (can also be set to a specific gpu's UUID, this can be discovered by running `nvidia-smi --query-gpu=gpu_name,gpu_uuid --format=csv` ). NVIDIA automatically mounts the GPU and drivers from your host into the plex docker. #### Arm Devices
Best effort is made to install tools to allow mounting in /dev/dri on Arm devices. In most cases if /dev/dri exists on the host it should just work. If running a Raspberry Pi 4 be sure to enable `dtoverlay=vc4-fkms-v3d` in your usercfg.txt.
## Usage ## Usage
@ -116,7 +121,6 @@ To help you get started creating a container from this image you can either use
```yaml ```yaml
--- ---
version: "2.1"
services: services:
plex: plex:
image: lscr.io/linuxserver/plex:latest image: lscr.io/linuxserver/plex:latest
@ -265,7 +269,7 @@ We publish various [Docker Mods](https://github.com/linuxserver/docker-mods) to
## Updating Info ## Updating Info
Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (ie. nextcloud, plex), we do not recommend or support updating apps inside the container. Please consult the [Application Setup](#application-setup) section above to see if it is recommended for the image. Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (noted in the relevant readme.md), we do not recommend or support updating apps inside the container. Please consult the [Application Setup](#application-setup) section above to see if it is recommended for the image.
Below are the instructions for updating containers: Below are the instructions for updating containers:
@ -330,21 +334,6 @@ Below are the instructions for updating containers:
docker image prune docker image prune
``` ```
### Via Watchtower auto-updater (only use if you don't remember the original parameters)
* Pull the latest image at its tag and replace it with the same env variables in one run:
```bash
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower \
--run-once plex
```
* You can also remove the old dangling images: `docker image prune`
**warning**: We do not endorse the use of Watchtower as a solution to automated updates of existing Docker containers. In fact we generally discourage automated updates. However, this is a useful tool for one-time manual updates of containers where you have forgotten the original parameters. In the long term, we highly recommend using [Docker Compose](https://docs.linuxserver.io/general/docker-compose).
### Image Update Notifications - Diun (Docker Image Update Notifier) ### Image Update Notifications - Diun (Docker Image Update Notifier)
**tip**: We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported. **tip**: We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported.
@ -372,6 +361,8 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions ## Versions
* **12.02.24:** - Use universal hardware acceleration blurb
* **09.01.24:** - Set ownership on TranscoderTempDirectory when it's been saved in Preferences.
* **16.08.23:** - Install unrar from [linuxserver repo](https://github.com/linuxserver/docker-unrar). * **16.08.23:** - Install unrar from [linuxserver repo](https://github.com/linuxserver/docker-unrar).
* **03.07.23:** - Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf) * **03.07.23:** - Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)
* **16.10.22:** - Rebase to jammy. Update to s6v3. Remove opencl packages (bundled with plex). * **16.10.22:** - Rebase to jammy. Update to s6v3. Remove opencl packages (bundled with plex).

View file

@ -10,7 +10,7 @@ bsdutils 1:2.37.2-4ubuntu3 deb
ca-certificates 20230311ubuntu0.22.04.1 deb ca-certificates 20230311ubuntu0.22.04.1 deb
coreutils 8.32-4.1ubuntu1 deb coreutils 8.32-4.1ubuntu1 deb
cron 3.0pl1-137ubuntu3 deb cron 3.0pl1-137ubuntu3 deb
curl 7.81.0-1ubuntu1.14 deb curl 7.81.0-1ubuntu1.15 deb
dash 0.5.11+git20210903+057cd650a4ed-3build1 deb dash 0.5.11+git20210903+057cd650a4ed-3build1 deb
debconf 1.5.79ubuntu1 deb debconf 1.5.79ubuntu1 deb
debianutils 5.5-1ubuntu2 deb debianutils 5.5-1ubuntu2 deb
@ -51,7 +51,7 @@ libcap-ng0 0.7.9-2.2build3 deb
libcap2 1:2.44-1ubuntu0.22.04.1 deb libcap2 1:2.44-1ubuntu0.22.04.1 deb
libcom-err2 1.46.5-2ubuntu1.1 deb libcom-err2 1.46.5-2ubuntu1.1 deb
libcrypt1 1:4.4.27-1 deb libcrypt1 1:4.4.27-1 deb
libcurl4 7.81.0-1ubuntu1.14 deb libcurl4 7.81.0-1ubuntu1.15 deb
libdb5.3 5.3.28+dfsg1-0.8ubuntu3 deb libdb5.3 5.3.28+dfsg1-0.8ubuntu3 deb
libdebconfclient0 0.261ubuntu1 deb libdebconfclient0 0.261ubuntu1 deb
libext2fs2 1.46.5-2ubuntu1.1 deb libext2fs2 1.46.5-2ubuntu1.1 deb
@ -71,8 +71,8 @@ libkmod2 29-1ubuntu1 deb
libkrb5-3 1.19.2-2ubuntu0.2 deb libkrb5-3 1.19.2-2ubuntu0.2 deb
libkrb5support0 1.19.2-2ubuntu0.2 deb libkrb5support0 1.19.2-2ubuntu0.2 deb
libksba8 1.6.0-2ubuntu0.2 deb libksba8 1.6.0-2ubuntu0.2 deb
libldap-2.5-0 2.5.16+dfsg-0ubuntu0.22.04.1 deb libldap-2.5-0 2.5.16+dfsg-0ubuntu0.22.04.2 deb
libldap-common 2.5.16+dfsg-0ubuntu0.22.04.1 deb libldap-common 2.5.16+dfsg-0ubuntu0.22.04.2 deb
liblz4-1 1.9.3-2build2 deb liblz4-1 1.9.3-2build2 deb
liblzma5 5.2.5-2ubuntu1 deb liblzma5 5.2.5-2ubuntu1 deb
libmd0 1.0.4-1build1 deb libmd0 1.0.4-1build1 deb
@ -104,9 +104,9 @@ libsemanage-common 3.3-1build2 deb
libsemanage2 3.3-1build2 deb libsemanage2 3.3-1build2 deb
libsepol2 3.3-1build1 deb libsepol2 3.3-1build1 deb
libsmartcols1 2.37.2-4ubuntu3 deb libsmartcols1 2.37.2-4ubuntu3 deb
libsqlite3-0 3.37.2-2ubuntu0.1 deb libsqlite3-0 3.37.2-2ubuntu0.3 deb
libss2 1.46.5-2ubuntu1.1 deb libss2 1.46.5-2ubuntu1.1 deb
libssh-4 0.9.6-2ubuntu0.22.04.1 deb libssh-4 0.9.6-2ubuntu0.22.04.3 deb
libssl3 3.0.2-0ubuntu1.10 deb libssl3 3.0.2-0ubuntu1.10 deb
libstdc++6 12.1.0-2ubuntu1~22.04 deb libstdc++6 12.1.0-2ubuntu1~22.04 deb
libsystemd0 249.11-0ubuntu3.9 deb libsystemd0 249.11-0ubuntu3.9 deb
@ -114,12 +114,12 @@ libtasn1-6 4.18.0-4build1 deb
libtinfo6 6.3-2ubuntu0.1 deb libtinfo6 6.3-2ubuntu0.1 deb
libtirpc-common 1.3.2-2ubuntu0.1 deb libtirpc-common 1.3.2-2ubuntu0.1 deb
libtirpc3 1.3.2-2ubuntu0.1 deb libtirpc3 1.3.2-2ubuntu0.1 deb
libudev1 249.11-0ubuntu3.11 deb libudev1 249.11-0ubuntu3.12 deb
libunistring2 1.0-1 deb libunistring2 1.0-1 deb
libuuid1 2.37.2-4ubuntu3 deb libuuid1 2.37.2-4ubuntu3 deb
libxxhash0 0.8.1-1 deb libxxhash0 0.8.1-1 deb
libzstd1 1.4.8+dfsg-3build1 deb libzstd1 1.4.8+dfsg-3build1 deb
locales 2.35-0ubuntu3.4 deb locales 2.35-0ubuntu3.6 deb
login 1:4.8.1-2ubuntu2.1 deb login 1:4.8.1-2ubuntu2.1 deb
logsave 1.46.5-2ubuntu1.1 deb logsave 1.46.5-2ubuntu1.1 deb
lsb-base 11.1.0ubuntu4 deb lsb-base 11.1.0ubuntu4 deb
@ -129,22 +129,22 @@ ncurses-base 6.3-2ubuntu0.1 deb
ncurses-bin 6.3-2ubuntu0.1 deb ncurses-bin 6.3-2ubuntu0.1 deb
netcat 1.218-4ubuntu1 deb netcat 1.218-4ubuntu1 deb
netcat-openbsd 1.218-4ubuntu1 deb netcat-openbsd 1.218-4ubuntu1 deb
openssl 3.0.2-0ubuntu1.12 deb openssl 3.0.2-0ubuntu1.15 deb
passwd 1:4.8.1-2ubuntu2.1 deb passwd 1:4.8.1-2ubuntu2.1 deb
perl-base 5.34.0-3ubuntu1.2 deb perl-base 5.34.0-3ubuntu1.2 deb
pinentry-curses 1.1.1-1build2 deb pinentry-curses 1.1.1-1build2 deb
plexmediaserver 1.32.8.7639-fb6452ebf deb plexmediaserver 1.40.1.8227-c0dd5a73e deb
procps 2:3.3.17-6ubuntu2 deb procps 2:3.3.17-6ubuntu2 deb
publicsuffix 20211207.1025-1 deb publicsuffix 20211207.1025-1 deb
readline-common 8.1.2-1 deb readline-common 8.1.2-1 deb
sed 4.8-1ubuntu2 deb sed 4.8-1ubuntu2 deb
sensible-utils 0.0.17 deb sensible-utils 0.0.17 deb
systemd-hwe-hwdb 249.11.3 deb systemd-hwe-hwdb 249.11.5 deb
sysvinit-utils 3.01-1ubuntu1 deb sysvinit-utils 3.01-1ubuntu1 deb
tar 1.34+dfsg-1ubuntu0.1.22.04.1 deb tar 1.34+dfsg-1ubuntu0.1.22.04.1 deb
tzdata 2023c-0ubuntu0.22.04.2 deb tzdata 2024a-0ubuntu0.22.04 deb
ubuntu-keyring 2021.03.26 deb ubuntu-keyring 2021.03.26 deb
udev 249.11-0ubuntu3.11 deb udev 249.11-0ubuntu3.12 deb
usrmerge 25ubuntu2 deb usrmerge 25ubuntu2 deb
util-linux 2.37.2-4ubuntu3 deb util-linux 2.37.2-4ubuntu3 deb
wget 1.21.2-2ubuntu1 deb wget 1.21.2-2ubuntu1 deb

View file

@ -61,40 +61,24 @@ app_setup_block_enabled: true
app_setup_block: | app_setup_block: |
Webui can be found at `<your-ip>:32400/web` Webui can be found at `<your-ip>:32400/web`
** Note about updates, if there is no value set for the VERSION variable, then no updates will take place.** ?+note[Updates](|If there is no value set for the VERSION variable, then no updates will take place.|)
** For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from, to update restart the Docker container after logging in through the webui** ?+note[New users](|For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from, to update restart the Docker container after logging in through the webui.|)
Valid settings for VERSION are:- Valid settings for VERSION are:-
`IMPORTANT NOTE:- YOU CANNOT UPDATE TO A PLEXPASS ONLY (BETA) VERSION IF YOU ARE NOT LOGGED IN WITH A PLEXPASS ACCOUNT` ?+info[Plexpass](|YOU CANNOT UPDATE TO A PLEXPASS ONLY (BETA) VERSION IF YOU ARE NOT LOGGED IN WITH A PLEXPASS ACCOUNT.|)
+ **`docker`**: Let Docker handle the Plex Version, we keep our Dockerhub Endpoint up to date with the latest public builds. This is the same as leaving this setting out of your create command. + **`docker`**: Let Docker handle the Plex Version, we keep our Dockerhub Endpoint up to date with the latest public builds. This is the same as leaving this setting out of your create command.
+ **`latest`**: will update plex to the latest version available that you are entitled to. + **`latest`**: will update plex to the latest version available that you are entitled to.
+ **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge but still want the latest public updates. + **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge but still want the latest public updates.
+ **`<specific-version>`**: will select a specific version (eg 0.9.12.4.1192-9a47d21) of plex to install, note you cannot use this to access plexpass versions if you do not have plexpass. + **`<specific-version>`**: will select a specific version (eg 0.9.12.4.1192-9a47d21) of plex to install, note you cannot use this to access plexpass versions if you do not have plexpass.
## Hardware Acceleration readme_hwaccel: true
### Intel
Hardware acceleration users for Intel Quicksync will need to mount their /dev/dri video device inside of the container by passing the following command when running or creating the container:
```
--device=/dev/dri:/dev/dri
```
We will automatically ensure the abc user inside of the container has the proper permissions to access this device.
### Nvidia
Hardware acceleration users for Nvidia will need to install the container runtime provided by Nvidia on their host, instructions can be found here:
https://github.com/NVIDIA/nvidia-docker
We automatically add the necessary environment variable that will utilise all the features available on a GPU on the host. Once nvidia-docker is installed on your host you will need to re/create the docker container with the nvidia container runtime `--runtime=nvidia` and add an environment variable `-e NVIDIA_VISIBLE_DEVICES=all` (can also be set to a specific gpu's UUID, this can be discovered by running `nvidia-smi --query-gpu=gpu_name,gpu_uuid --format=csv` ). NVIDIA automatically mounts the GPU and drivers from your host into the plex docker.
# changelog # changelog
changelogs: changelogs:
- {date: "12.02.24:", desc: "Use universal hardware acceleration blurb"}
- {date: "09.01.24:", desc: "Set ownership on TranscoderTempDirectory when it's been saved in Preferences."}
- {date: "16.08.23:", desc: "Install unrar from [linuxserver repo](https://github.com/linuxserver/docker-unrar)."} - {date: "16.08.23:", desc: "Install unrar from [linuxserver repo](https://github.com/linuxserver/docker-unrar)."}
- {date: "03.07.23:", desc: "Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"} - {date: "03.07.23:", desc: "Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"}
- {date: "16.10.22:", desc: "Rebase to jammy. Update to s6v3. Remove opencl packages (bundled with plex)."} - {date: "16.10.22:", desc: "Rebase to jammy. Update to s6v3. Remove opencl packages (bundled with plex)."}

View file

@ -1,16 +0,0 @@
# default script for Plex Media Server
# the number of plugins that can run at the same time
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
# ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE
PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
# uncomment to set it to something else
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support"
# the user that PMS should run as, defaults to 'plex'
# note that if you change this you might need to move
# the Application Support directory to not lose your
# media library
PLEX_MEDIA_SERVER_USER=abc

View file

@ -1,17 +1,18 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# shellcheck shell=bash
# create folders # create folders
if [ ! -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" ]; then \ if [[ ! -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" ]]; then
mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}"
chown -R abc:abc /config lsiown -R abc:abc /config
fi fi
# check Library permissions # check Library permissions
PUID=${PUID:-911} PUID=${PUID:-911}
if [ ! "$(stat -c %u /config/Library)" = "$PUID" ]; then if [[ ! "$(stat -c %u /config/Library)" == "${PUID}" ]]; then
echo "Change in ownership detected, please be patient while we chown existing files" echo "Change in ownership detected, please be patient while we chown existing files"
echo "This could take some time" echo "This could take some time"
chown abc:abc -R \ lsiown abc:abc -R \
/config/Library /config/Library
fi fi
@ -20,7 +21,19 @@ if [[ -f "/config/Library/Application Support/Plex Media Server/plexmediaserver.
rm -f "/config/Library/Application Support/Plex Media Server/plexmediaserver.pid" rm -f "/config/Library/Application Support/Plex Media Server/plexmediaserver.pid"
fi fi
# set permissions on Plex Transcoder Temp Directory
PLEX_MEDIA_SERVER_PREFERENCES="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server/Preferences.xml"
if [[ -f "${PLEX_MEDIA_SERVER_PREFERENCES}" ]]; then
TranscoderTempDirectory='\bTranscoderTempDirectory="([^"]+)"'
while IFS= read -r line; do
if [[ ${line} =~ ${TranscoderTempDirectory} ]] && [[ -d "${BASH_REMATCH[1]}" ]]; then
echo "Setting permissions on ${BASH_REMATCH[1]}"
lsiown -R abc:abc "${BASH_REMATCH[1]}"
fi
done <"${PLEX_MEDIA_SERVER_PREFERENCES}"
fi
# permissions (non-recursive) on config root and folders # permissions (non-recursive) on config root and folders
chown abc:abc \ lsiown abc:abc \
/config \ /config \
/config/* /config/*

View file

@ -1,83 +1,89 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# shellcheck shell=bash
if grep -qs "PlexOnlineToken" "/config/Library/Application Support/Plex Media Server/Preferences.xml"; then PLEX_MEDIA_SERVER_PREFERENCES="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server/Preferences.xml"
if grep -qs "PlexOnlineToken" "${PLEX_MEDIA_SERVER_PREFERENCES}"; then
echo "**** Server already claimed ****" echo "**** Server already claimed ****"
exit 0 exit 0
elif [ -z "$PLEX_CLAIM" ]; then elif [[ -z "$PLEX_CLAIM" ]]; then
echo "**** Server is unclaimed, but no claim token has been set ****" echo "**** Server is unclaimed, but no claim token has been set ****"
exit 0 exit 0
fi fi
PREFNAME="/config/Library/Application Support/Plex Media Server/Preferences.xml"
if [ ! -f "${PREFNAME}" ]; then if [[ ! -f "${PLEX_MEDIA_SERVER_PREFERENCES}" ]]; then
UMASK_SET="${UMASK_SET:-022}" UMASK_SET="${UMASK_SET:-022}"
umask "$UMASK_SET" umask "$UMASK_SET"
echo "Temporarily starting Plex Media Server." echo "Temporarily starting Plex Media Server."
export PLEX_MEDIA_SERVER_INFO_MODEL=$(uname -m) PLEX_MEDIA_SERVER_INFO_MODEL=$(uname -m)
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(uname -r) export PLEX_MEDIA_SERVER_INFO_MODEL
PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(uname -r)
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION
s6-setuidgid abc /bin/bash -c \ s6-setuidgid abc /bin/bash -c \
'LD_LIBRARY_PATH=/usr/lib/plexmediaserver:/usr/lib/plexmediaserver/lib /usr/lib/plexmediaserver/Plex\ Media\ Server' & PID=$! 'LD_LIBRARY_PATH=/usr/lib/plexmediaserver:/usr/lib/plexmediaserver/lib /usr/lib/plexmediaserver/Plex\ Media\ Server' &
PID=$!
echo "Waiting for Plex to generate its config" echo "Waiting for Plex to generate its config"
DBNAME="/config/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-wal" DBNAME="/config/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-wal"
until [ -f "${DBNAME}" ]; do until [[ -f "${DBNAME}" ]]; do
sleep 1 sleep 1
done done
while true; do while true; do
echo "Waiting for database creation to complete..." echo "Waiting for database creation to complete..."
if [ -z "${COMPARE_MD5+x}" ]; then if [[ -z "${COMPARE_MD5+x}" ]]; then
COMPARE_MD5=$(md5sum "${DBNAME}"| cut -c1-8) COMPARE_MD5=$(md5sum "${DBNAME}" | cut -c1-8)
sleep 3 sleep 3
else else
sleep 3 sleep 3
CURRENT_MD5=$(md5sum "${DBNAME}"| cut -c1-8) CURRENT_MD5=$(md5sum "${DBNAME}" | cut -c1-8)
if [ "${CURRENT_MD5}" == "${COMPARE_MD5}" ]; then if [[ "${CURRENT_MD5}" == "${COMPARE_MD5}" ]]; then
break break
else else
COMPARE_MD5=$(md5sum "${DBNAME}"| cut -c1-8) COMPARE_MD5=$(md5sum "${DBNAME}" | cut -c1-8)
fi fi
fi fi
done done
until grep -qs "ProcessedMachineIdentifier" "${PREFNAME}"; do until grep -qs "ProcessedMachineIdentifier" "${PLEX_MEDIA_SERVER_PREFERENCES}"; do
sleep 1 sleep 1
done done
while true; do while true; do
echo "Waiting for pref file creation to complete..." echo "Waiting for pref file creation to complete..."
if [ -z "${PREF_COMPARE_MD5+x}" ]; then if [[ -z "${PREF_COMPARE_MD5+x}" ]]; then
PREF_COMPARE_MD5=$(md5sum "${PREFNAME}"| cut -c1-8) PREF_COMPARE_MD5=$(md5sum "${PLEX_MEDIA_SERVER_PREFERENCES}" | cut -c1-8)
sleep 3 sleep 3
else else
sleep 3 sleep 3
PREF_CURRENT_MD5=$(md5sum "${PREFNAME}"| cut -c1-8) PREF_CURRENT_MD5=$(md5sum "${PLEX_MEDIA_SERVER_PREFERENCES}" | cut -c1-8)
if [ "${PREF_CURRENT_MD5}" == "${PREF_COMPARE_MD5}" ]; then if [[ "${PREF_CURRENT_MD5}" == "${PREF_COMPARE_MD5}" ]]; then
break break
else else
PREF_COMPARE_MD5=$(md5sum "${PREFNAME}"| cut -c1-8) PREF_COMPARE_MD5=$(md5sum "${PLEX_MEDIA_SERVER_PREFERENCES}" | cut -c1-8)
fi fi
fi fi
done done
echo "Stopping Plex to claim server" echo "Stopping Plex to claim server"
while ps -p $PID > /dev/null; do while ps -p $PID >/dev/null; do
kill $PID kill $PID
sleep 1 sleep 1
done done
echo "Plex stopped" echo "Plex stopped"
fi fi
ProcessedMachineIdentifier=$(sed -n "s/^.*ProcessedMachineIdentifier=\"\([^\"]*\)\".*$/\1/p" "${PREFNAME}") ProcessedMachineIdentifier=$(sed -n "s/^.*ProcessedMachineIdentifier=\"\([^\"]*\)\".*$/\1/p" "${PLEX_MEDIA_SERVER_PREFERENCES}")
PlexOnlineToken="$(curl -X POST \ PlexOnlineToken="$(curl -X POST \
-H 'X-Plex-Client-Identifier: '"${ProcessedMachineIdentifier}" \ -H 'X-Plex-Client-Identifier: '"${ProcessedMachineIdentifier}" \
-H 'X-Plex-Product: Plex Media Server'\ -H 'X-Plex-Product: Plex Media Server' \
-H 'X-Plex-Version: 1.1' \ -H 'X-Plex-Version: 1.1' \
-H 'X-Plex-Provides: server' \ -H 'X-Plex-Provides: server' \
-H 'X-Plex-Platform: Linux' \ -H 'X-Plex-Platform: Linux' \
-H 'X-Plex-Platform-Version: 1.0' \ -H 'X-Plex-Platform-Version: 1.0' \
-H 'X-Plex-Device-Name: PlexMediaServer' \ -H 'X-Plex-Device-Name: PlexMediaServer' \
-H 'X-Plex-Device: Linux' \ -H 'X-Plex-Device: Linux' \
"https://plex.tv/api/claim/exchange?token=${PLEX_CLAIM}" \ "https://plex.tv/api/claim/exchange?token=${PLEX_CLAIM}" |
| sed -n 's/.*<authentication-token>\(.*\)<\/authentication-token>.*/\1/p')" sed -n 's/.*<authentication-token>\(.*\)<\/authentication-token>.*/\1/p')"
if [ -n "$PlexOnlineToken" ]; then if [[ -n "$PlexOnlineToken" ]]; then
echo "Server claimed successfully, navigate to http://serverip:32400/web to complete plex setup." echo "Server claimed successfully, navigate to http://serverip:32400/web to complete plex setup."
sed -i "s/\/>/ PlexOnlineToken=\"${PlexOnlineToken}\"\/>/g" "${PREFNAME}" sed -i "s/\/>/ PlexOnlineToken=\"${PlexOnlineToken}\"\/>/g" "${PLEX_MEDIA_SERVER_PREFERENCES}"
else else
echo "Unable to claim Plex server. Either manually claim by connecting to http://serverip:32400/web from the same network subnet, or recreate container with a new claim token." echo "Unable to claim Plex server. Either manually claim by connecting to http://serverip:32400/web from the same network subnet, or recreate container with a new claim token."
fi fi

View file

@ -1,9 +1,9 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# shellcheck shell=bash
FILES=$(find /dev/dri /dev/dvb -type c -print 2>/dev/null) FILES=$(find /dev/dri /dev/dvb -type c -print 2>/dev/null)
for i in $FILES for i in ${FILES}; do
do
VIDEO_GID=$(stat -c '%g' "${i}") VIDEO_GID=$(stat -c '%g' "${i}")
VIDEO_UID=$(stat -c '%u' "${i}") VIDEO_UID=$(stat -c '%u' "${i}")
# check if user matches device # check if user matches device
@ -11,13 +11,13 @@ do
echo "**** permissions for ${i} are good ****" echo "**** permissions for ${i} are good ****"
else else
# check if group matches and that device has group rw # check if group matches and that device has group rw
if id -G abc | grep -qw "${VIDEO_GID}" && [ $(stat -c '%A' "${i}" | cut -b 5,6) = "rw" ]; then if id -G abc | grep -qw "${VIDEO_GID}" && [[ $(stat -c '%A' "${i}" | cut -b 5,6) == "rw" ]]; then
echo "**** permissions for ${i} are good ****" echo "**** permissions for ${i} are good ****"
# check if device needs to be added to video group # check if device needs to be added to video group
elif ! id -G abc | grep -qw "${VIDEO_GID}"; then elif ! id -G abc | grep -qw "${VIDEO_GID}"; then
# check if video group needs to be created # check if video group needs to be created
VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}') VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}')
if [ -z "${VIDEO_NAME}" ]; then if [[ -z "${VIDEO_NAME}" ]]; then
VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-z0-9' | head -c4)" VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-z0-9' | head -c4)"
groupadd "${VIDEO_NAME}" groupadd "${VIDEO_NAME}"
groupmod -g "${VIDEO_GID}" "${VIDEO_NAME}" groupmod -g "${VIDEO_GID}" "${VIDEO_NAME}"
@ -27,7 +27,7 @@ do
usermod -a -G "${VIDEO_NAME}" abc usermod -a -G "${VIDEO_NAME}" abc
fi fi
# check if device has group rw # check if device has group rw
if [ $(stat -c '%A' "${i}" | cut -b 5,6) != "rw" ]; then if [[ $(stat -c '%A' "${i}" | cut -b 5,6) != "rw" ]]; then
echo -e "**** The device ${i} does not have group read/write permissions, attempting to fix inside the container. ****" echo -e "**** The device ${i} does not have group read/write permissions, attempting to fix inside the container. ****"
chmod g+rw "${i}" chmod g+rw "${i}"
fi fi

View file

@ -1,7 +1,8 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# shellcheck shell=bash
# If docker manages versioning exit # If docker manages versioning exit
if [ "${VERSION}" ] && [ "${VERSION}" == 'docker' ]; then if [[ -n "${VERSION}" ]] && [[ "${VERSION}" == "docker" ]]; then
echo "Docker is used for versioning skip update check" echo "Docker is used for versioning skip update check"
exit 0 exit 0
fi fi
@ -12,19 +13,20 @@ if (dpkg --get-selections plexmediaserver | grep -wq "install"); then
else else
echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script" echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script"
curl -o /tmp/plexmediaserver.deb -L \ curl -o /tmp/plexmediaserver.deb -L \
"${PLEX_DOWNLOAD}/${REMOTE_VERSION}/debian/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb" && \ "${PLEX_DOWNLOAD}/${REMOTE_VERSION}/debian/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb"
dpkg -i --force-confold /tmp/plexmediaserver.deb dpkg -i --force-confold /tmp/plexmediaserver.deb
rm -f /tmp/plexmediaserver.deb rm -f /tmp/plexmediaserver.deb
exit 0 exit 0
fi fi
# set no update message # set no update message
[[ -e /tmp/no-version.nfo ]] && \ if [[ -e /tmp/no-version.nfo ]]; then
rm /tmp/no-version.nfo rm /tmp/no-version.nfo
fi
NOVERSION_SET='/tmp/no-version.nfo' NOVERSION_SET='/tmp/no-version.nfo'
cat > "${NOVERSION_SET}" <<-EOFVERSION cat >"${NOVERSION_SET}" <<-EOFVERSION
####################################################### #######################################################
# Update routine will not run because you havent set # # Update routine will not run because you haven't set #
# the VERSION variable or you opted out of updates. # # the VERSION variable or you opted out of updates. #
# For more information checkout :- # # For more information checkout :- #
# https://github.com/linuxserver/docker-plex # # https://github.com/linuxserver/docker-plex #
@ -32,10 +34,11 @@ cat > "${NOVERSION_SET}" <<-EOFVERSION
EOFVERSION EOFVERSION
# set update failed message # set update failed message
[[ -e /tmp/update_fail.nfo ]] && \ if [[ -e /tmp/update_fail.nfo ]]; then
rm /tmp/update_fail.nfo rm /tmp/update_fail.nfo
fi
UPGRADE_FAIL='/tmp/update_fail.nfo' UPGRADE_FAIL='/tmp/update_fail.nfo'
cat > "${UPGRADE_FAIL}" <<-EOFFAIL cat >"${UPGRADE_FAIL}" <<-EOFFAIL
######################################################## ########################################################
# Upgrade attempt failed, this could be because either # # Upgrade attempt failed, this could be because either #
# plex update site is down, local network issues, or # # plex update site is down, local network issues, or #
@ -45,25 +48,27 @@ cat > "${UPGRADE_FAIL}" <<-EOFFAIL
######################################################## ########################################################
EOFFAIL EOFFAIL
# test for no version set or opt out for autoupdates # test for no version set or opt out for auto updates
if [[ -z "$VERSION" ]] || [[ "$VERSION" == "0" ]] || [[ -n "$ADVANCED_DISABLEUPDATES" ]]; then if [[ -z "${VERSION}" ]] || [[ "${VERSION}" == "0" ]] || [[ -n "${ADVANCED_DISABLEUPDATES}" ]]; then
printf '\n\n\n%s\n\n\n' "$(</tmp/no-version.nfo)" printf '\n\n\n%s\n\n\n' "$(</tmp/no-version.nfo)"
exit 0 exit 0
fi fi
# set header for no preferences/token message # set header for no preferences/token message
[[ -e /tmp/no-token.nfo ]] && \ if [[ -e /tmp/no-token.nfo ]]; then
rm /tmp/no-token.nfo rm /tmp/no-token.nfo
fi
NOTOKEN_SET='/tmp/no-token.nfo' NOTOKEN_SET='/tmp/no-token.nfo'
cat > "${NOTOKEN_SET}" <<-EOFTOKEN cat >"${NOTOKEN_SET}" <<-EOFTOKEN
##################################################### #####################################################
# Login via the webui at http://<ip>:32400/web # # Login via the webui at http://<ip>:32400/web #
# and restart the container, because there was no # # and restart the container, because there was no #
EOFTOKEN EOFTOKEN
# if preferences files doesn't exist, exit out # if preferences files doesn't exist, exit out
if [ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml" ]; then PLEX_MEDIA_SERVER_PREFERENCES="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server/Preferences.xml"
cat >> "${NOTOKEN_SET}" <<-EOFTOKEN if [[ ! -e "${PLEX_MEDIA_SERVER_PREFERENCES}" ]]; then
cat >>"${NOTOKEN_SET}" <<-EOFTOKEN
# preference file found, possibly first startup. # # preference file found, possibly first startup. #
##################################################### #####################################################
EOFTOKEN EOFTOKEN
@ -72,13 +77,13 @@ EOFTOKEN
fi fi
# attempt to read plex token # attempt to read plex token
PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \ PLEX_TOKEN=$(sed -n 's/.*PlexOnlineToken="//p' \
"/config/Library/Application Support/Plex Media Server/Preferences.xml" \ "${PLEX_MEDIA_SERVER_PREFERENCES}" |
| sed "s/\".*//") sed "s/\".*//")
# if plex token isn't found, exit out # if plex token isn't found, exit out
if [ -z "$PLEX_TOKEN" ]; then if [[ -z "${PLEX_TOKEN}" ]]; then
cat >> "${NOTOKEN_SET}" <<-EOFTOKEN cat >>"${NOTOKEN_SET}" <<-EOFTOKEN
# plex token found in the preference file # # plex token found in the preference file #
##################################################### #####################################################
EOFTOKEN EOFTOKEN
@ -90,22 +95,22 @@ fi
INSTALLED_VERSION=$(dpkg-query -W -f='${Version}' plexmediaserver) INSTALLED_VERSION=$(dpkg-query -W -f='${Version}' plexmediaserver)
# start update routine # start update routine
if [[ "${VERSION,,}" = latest ]] || [[ "${VERSION,,}" = plexpass ]] || [[ "$PLEXPASS" == "1" ]]; then if [[ "${VERSION,,}" == "latest" ]] || [[ "${VERSION,,}" == "plexpass" ]] || [[ "${PLEXPASS}" == "1" ]]; then
if [[ "${PLEX_ARCH}" = amd64 ]]; then if [[ "${PLEX_ARCH}" == "amd64" ]]; then
PLEX_URL_ARCH="x86_64" PLEX_URL_ARCH="x86_64"
elif [[ "${PLEX_ARCH}" = armhf ]]; then elif [[ "${PLEX_ARCH}" == "armhf" ]]; then
PLEX_URL_ARCH="armv7hf_neon" PLEX_URL_ARCH="armv7hf_neon"
elif [[ "${PLEX_ARCH}" = arm64 ]]; then elif [[ "${PLEX_ARCH}" == "arm64" ]]; then
PLEX_URL_ARCH="aarch64" PLEX_URL_ARCH="aarch64"
fi fi
REMOTE_VERSION=$(curl -s "https://plex.tv/downloads/details/5?distro=debian&build=linux-${PLEX_URL_ARCH}&channel=8&X-Plex-Token=$PLEX_TOKEN"| grep -oP 'version="\K[^"]+' | tail -n 1 ) REMOTE_VERSION=$(curl -s "https://plex.tv/downloads/details/5?distro=debian&build=linux-${PLEX_URL_ARCH}&channel=8&X-Plex-Token=${PLEX_TOKEN}" | grep -oP 'version="\K[^"]+' | tail -n 1)
elif [[ "${VERSION,,}" = public ]]; then elif [[ "${VERSION,,}" == "public" ]]; then
REMOTE_VERSION=$(curl -s 'https://plex.tv/api/downloads/5.json' | jq -r '.computer.Linux.version') REMOTE_VERSION=$(curl -s 'https://plex.tv/api/downloads/5.json' | jq -r '.computer.Linux.version')
else else
REMOTE_VERSION="${VERSION}" REMOTE_VERSION="${VERSION}"
fi fi
if [[ "$REMOTE_VERSION" == "$INSTALLED_VERSION" ]]; then if [[ "${REMOTE_VERSION}" == "${INSTALLED_VERSION}" ]]; then
echo "No update required" echo "No update required"
exit 0 exit 0
fi fi
@ -115,18 +120,18 @@ if [[ -z "${REMOTE_VERSION}" ]]; then
exit 0 exit 0
fi fi
echo "Atempting to upgrade to: $REMOTE_VERSION" echo "Attempting to upgrade to: ${REMOTE_VERSION}"
rm -f /tmp/plexmediaserver_*.deb rm -f /tmp/plexmediaserver_*.deb
wget -nv -P /tmp \ wget -nv -P /tmp \
"${PLEX_DOWNLOAD}/${REMOTE_VERSION}/debian/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb" "${PLEX_DOWNLOAD}/${REMOTE_VERSION}/debian/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb"
last=$? last=$?
# test if deb file size is ok, or if download failed # test if deb file size is ok, or if download failed
if [[ "$last" -gt "0" ]] || [[ $(stat -c %s /tmp/plexmediaserver_"${REMOTE_VERSION}"_${PLEX_ARCH}.deb) -lt 10000 ]]; then if [[ "${last}" -gt "0" ]] || [[ $(stat -c %s "/tmp/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb") -lt 10000 ]]; then
printf '\n\n\n%s\n\n\n' "$(</tmp/update_fail.nfo)" printf '\n\n\n%s\n\n\n' "$(</tmp/update_fail.nfo)"
exit 0 exit 0
# if ok, try to install it. # if ok, try to install it.
else else
dpkg -i --force-confold /tmp/plexmediaserver_"${REMOTE_VERSION}"_${PLEX_ARCH}.deb dpkg -i --force-confold "/tmp/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb"
rm -f /tmp/plexmediaserver_*.deb rm -f /tmp/plexmediaserver_*.deb
fi fi

View file

@ -1,10 +1,13 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# shellcheck shell=bash
# Wait for WireGuard to be up # Wait for WireGuard to be up
echo "Starting Plex Media Server. . . (you can ignore the libusb_init error)" echo "Starting Plex Media Server. . . (you can ignore the libusb_init error)"
export PLEX_MEDIA_SERVER_INFO_MODEL=$(uname -m) PLEX_MEDIA_SERVER_INFO_MODEL=$(uname -m)
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(uname -r) export PLEX_MEDIA_SERVER_INFO_MODEL
PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(uname -r)
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION
exec \ exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 32400" \ s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 32400" \
s6-setuidgid abc "/usr/lib/plexmediaserver/Plex Media Server" s6-setuidgid abc "/usr/lib/plexmediaserver/Plex Media Server"