Skip to content

Commit 539ac8f

Browse files
authored
Merge pull request #166 from linuxserver/api
switch to new api, enable plex pass for armhd and aarch64
2 parents d4ac9c5 + 78ea9cb commit 539ac8f

File tree

8 files changed

+54
-48
lines changed

8 files changed

+54
-48
lines changed

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
1212

1313
# global environment settings
1414
ENV DEBIAN_FRONTEND="noninteractive" \
15-
PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server" \
16-
PLEX_INSTALL="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" \
15+
PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server-new" \
16+
PLEX_ARCH="amd64" \
1717
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
1818
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
1919
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
@@ -28,19 +28,19 @@ RUN \
2828
udev \
2929
unrar \
3030
wget \
31-
jq && \
31+
jq && \
3232
echo "**** Udevadm hack ****" && \
3333
mv /sbin/udevadm /sbin/udevadm.bak && \
3434
echo "exit 0" > /sbin/udevadm && \
3535
chmod +x /sbin/udevadm && \
3636
echo "**** install plex ****" && \
3737
if [ -z ${PLEX_RELEASE+x} ]; then \
38-
PLEX_RELEASE=$(curl -s 'https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&distro=ubuntu' \
39-
|grep -oP 'version="\K[^"]+' | tail -n 1); \
38+
PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \
39+
| jq -r '.computer.Linux.version'); \
4040
fi && \
4141
curl -o \
4242
/tmp/plexmediaserver.deb -L \
43-
"https://downloads.plex.tv/plex-media-server/${PLEX_RELEASE}/plexmediaserver_${PLEX_RELEASE}_amd64.deb" && \
43+
"${PLEX_DOWNLOAD}/${PLEX_RELEASE}/debian/plexmediaserver_${PLEX_RELEASE}_${PLEX_ARCH}.deb" && \
4444
dpkg -i /tmp/plexmediaserver.deb && \
4545
mv /sbin/udevadm.bak /sbin/udevadm && \
4646
echo "**** ensure abc user's home folder is /app ****" && \

Dockerfile.aarch64

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ LABEL maintainer="sparklyballs, thelamer"
1212

1313
# global environment settings
1414
ENV DEBIAN_FRONTEND="noninteractive" \
15+
PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server-new" \
16+
PLEX_ARCH="arm64" \
1517
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
1618
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
1719
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
@@ -32,9 +34,13 @@ RUN \
3234
echo "exit 0" > /sbin/udevadm && \
3335
chmod +x /sbin/udevadm && \
3436
echo "**** install plex ****" && \
37+
if [ -z ${PLEX_RELEASE+x} ]; then \
38+
PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \
39+
| jq -r '.computer.Linux.version'); \
40+
fi && \
3541
curl -o \
3642
/tmp/plexmediaserver.deb -L \
37-
"https://downloads.plex.tv/plex-media-server-new/1.15.0.647-67e950f12/debian/plexmediaserver_1.15.0.647-67e950f12_arm64.deb" && \
43+
"${PLEX_DOWNLOAD}/${PLEX_RELEASE}/debian/plexmediaserver_${PLEX_RELEASE}_${PLEX_ARCH}.deb" && \
3844
dpkg -i /tmp/plexmediaserver.deb && \
3945
mv /sbin/udevadm.bak /sbin/udevadm && \
4046
echo "**** ensure abc user's home folder is /app ****" && \

Dockerfile.armhf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ LABEL maintainer="sparklyballs, thelamer"
1212

1313
# global environment settings
1414
ENV DEBIAN_FRONTEND="noninteractive" \
15+
PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server-new" \
16+
PLEX_ARCH="armhf" \
1517
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
1618
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
1719
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
@@ -32,9 +34,13 @@ RUN \
3234
echo "exit 0" > /sbin/udevadm && \
3335
chmod +x /sbin/udevadm && \
3436
echo "**** install plex ****" && \
37+
if [ -z ${PLEX_RELEASE+x} ]; then \
38+
PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \
39+
| jq -r '.computer.Linux.version'); \
40+
fi && \
3541
curl -o \
3642
/tmp/plexmediaserver.deb -L \
37-
"https://downloads.plex.tv/plex-media-server-new/1.15.0.647-67e950f12/debian/plexmediaserver_1.15.0.647-67e950f12_armhf.deb" && \
43+
"${PLEX_DOWNLOAD}/${PLEX_RELEASE}/debian/plexmediaserver_${PLEX_RELEASE}_${PLEX_ARCH}.deb" && \
3844
dpkg -i /tmp/plexmediaserver.deb && \
3945
mv /sbin/udevadm.bak /sbin/udevadm && \
4046
echo "**** ensure abc user's home folder is /app ****" && \

Jenkinsfile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pipeline {
1010
environment {
1111
BUILDS_DISCORD=credentials('build_webhook_url')
1212
GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab')
13+
JSON_URL = 'https://plex.tv/api/downloads/5.json'
14+
JSON_PATH = '.computer.Linux.version'
1315
BUILD_VERSION_ARG = 'PLEX_RELEASE'
1416
LS_USER = 'linuxserver'
1517
LS_REPO = 'docker-plex'
@@ -26,7 +28,7 @@ pipeline {
2628
CI_DELAY='120'
2729
CI_DOCKERENV='TZ=US/Pacific'
2830
CI_AUTH='user:password'
29-
CI_WEBPATH='/web'
31+
CI_WEBPATH=''
3032
}
3133
stages {
3234
// Setup all the basic environment variables needed for the build
@@ -91,16 +93,16 @@ pipeline {
9193
/* ########################
9294
External Release Tagging
9395
######################## */
94-
// If this is a custom command to determine version use that command
95-
stage("Set tag custom bash"){
96-
steps{
97-
script{
98-
env.EXT_RELEASE = sh(
99-
script: ''' curl -s 'https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&distro=ubuntu' |grep -oP 'version="\\K[^"]+' | tail -n 1 ''',
100-
returnStdout: true).trim()
101-
env.RELEASE_LINK = 'custom_command'
102-
}
103-
}
96+
// If this is a custom json endpoint parse the return to get external tag
97+
stage("Set ENV custom_json"){
98+
steps{
99+
script{
100+
env.EXT_RELEASE = sh(
101+
script: '''curl -s ${JSON_URL} | jq -r ". | ${JSON_PATH}" ''',
102+
returnStdout: true).trim()
103+
env.RELEASE_LINK = env.JSON_URL
104+
}
105+
}
104106
}
105107
// Sanitize the release tag and strip illegal docker or github characters
106108
stage("Sanitize tag"){
@@ -558,7 +560,7 @@ pipeline {
558560
"tagger": {"name": "LinuxServer Jenkins","email": "[email protected]","date": "'${GITHUB_DATE}'"}}' '''
559561
echo "Pushing New release for Tag"
560562
sh '''#! /bin/bash
561-
echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json
563+
echo "Data change at JSON endpoint ${JSON_URL}" > releasebody.json
562564
echo '{"tag_name":"'${EXT_RELEASE_CLEAN}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\
563565
"target_commitish": "master",\
564566
"name": "'${EXT_RELEASE_CLEAN}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Find us at:
2424
[![](https://lsio-ci.ams3.digitaloceanspaces.com/linuxserver/plex/latest/badge.svg)](https://lsio-ci.ams3.digitaloceanspaces.com/linuxserver/plex/latest/index.html)
2525

2626
[Plex](https://plex.tv) organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. has always been a top priority. Straightforward design and bulk actions mean getting things done faster.
27-
*To All Arm Users* - Plex is currently transitioning to a new build system allowing everyone to ingest software releases for all popular architectures. In the mean time releases on this channel for armv7 and aarch64 will be frozen at a beta release version of 1.15, including plex pass users. For armv7 users that want a stable release please use our legacy repo [Here](https://hub.docker.com/r/lsioarmhf/plex) .
2827

2928
[![plex](http://the-gadgeteer.com/wp-content/uploads/2015/10/plex-logo-e1446990678679.png)](https://plex.tv)
3029

@@ -212,6 +211,7 @@ Below are the instructions for updating containers:
212211

213212
## Versions
214213

214+
* **14.03.19:** - Switch to new api endpoints, enable beta (plex pass) updates for armhf and aarch64.
215215
* **15.02.19:** - Clean up plex pid after unclean stop.
216216
* **11.02.19:** - Fix nvidia variables, add device variables.
217217
* **16.01.19:** - Add pipeline logic, multi arch, and HW transcoding configuration; remove avahi service.

jenkins-vars.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
# jenkins variables
44
project_name: docker-plex
5-
external_type: na
6-
custom_version_command: curl -s 'https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&distro=ubuntu' |grep -oP 'version="\\K[^"]+' | tail -n 1
5+
external_type: custom_json
76
release_type: stable
87
release_tag: latest
98
ls_branch: master
109
repo_vars:
10+
- JSON_URL = 'https://plex.tv/api/downloads/5.json'
11+
- JSON_PATH = '.computer.Linux.version'
1112
- BUILD_VERSION_ARG = 'PLEX_RELEASE'
1213
- LS_USER = 'linuxserver'
1314
- LS_REPO = 'docker-plex'
@@ -24,4 +25,4 @@ repo_vars:
2425
- CI_DELAY='120'
2526
- CI_DOCKERENV='TZ=US/Pacific'
2627
- CI_AUTH='user:password'
27-
- CI_WEBPATH='/web'
28+
- CI_WEBPATH=''

readme-vars.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
project_name: plex
55
project_url: "https://plex.tv"
66
project_logo: "http://the-gadgeteer.com/wp-content/uploads/2015/10/plex-logo-e1446990678679.png"
7-
project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. has always been a top priority. Straightforward design and bulk actions mean getting things done faster.
7+
project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. has always been a top priority. Straightforward design and bulk actions mean getting things done faster."
88

9-
*To All Arm Users* - Plex is currently transitioning to a new build system allowing everyone to ingest software releases for all popular architectures. In the mean time releases on this channel for armv7 and aarch64 will be frozen at a beta release version of 1.15, including plex pass users. For armv7 users that want a stable release please use our legacy repo [Here](https://hub.docker.com/r/lsioarmhf/plex) ."
109
project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}"
1110

1211
# supported architectures
@@ -83,6 +82,7 @@ app_setup_block: |
8382
8483
# changelog
8584
changelogs:
85+
- { date: "14.03.19:", desc: "Switch to new api endpoints, enable beta (plex pass) updates for armhf and aarch64." }
8686
- { date: "15.02.19:", desc: "Clean up plex pid after unclean stop." }
8787
- { date: "11.02.19:", desc: "Fix nvidia variables, add device variables." }
8888
- { date: "16.01.19:", desc: "Add pipeline logic, multi arch, and HW transcoding configuration; remove avahi service." }

root/etc/cont-init.d/60-plex-update

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
#!/usr/bin/with-contenv bash
22

3-
# determine architecture to gaurd arm variants in deployment stage 1
4-
ARCH=$(arch)
5-
if [[ "${ARCH}" == armv* ]]; then
6-
echo "This is armv7, upgrading Plex is not supported yet"
7-
exit 0
8-
elif [[ "${ARCH}" == "aarch64" ]]; then
9-
echo "This is aarch64, upgrading Plex is not supported yet"
10-
exit 0
11-
fi
12-
133
# If docker manages versioning exit
144
if [ "${VERSION}" ] && [ "${VERSION}" == 'docker' ]; then
155
echo "Docker is used for verisoning skip update check"
@@ -22,7 +12,7 @@ if (dpkg --get-selections plexmediaserver | grep -wq "install"); then
2212
else
2313
echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script"
2414
curl -o /tmp/plexmediaserver.deb -L \
25-
"${PLEX_INSTALL}" && \
15+
"${PLEX_DOWNLOAD}/${REMOTE_VERSION}/debian/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb" && \
2616
dpkg -i --force-confold /tmp/plexmediaserver.deb
2717
rm -f /tmp/plexmediaserver.deb
2818
exit 0
@@ -101,10 +91,16 @@ INSTALLED_VERSION=$(dpkg-query -W -f='${Version}' plexmediaserver)
10191

10292
# start update routine
10393
if [[ "${VERSION,,}" = latest ]] || [[ "${VERSION,,}" = plexpass ]] || [[ "$PLEXPASS" == "1" ]]; then
104-
REMOTE_VERSION=$(curl -s "${PLEX_INSTALL}&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 )
94+
if [[ "${PLEX_ARCH}" = amd64 ]]; then
95+
PLEX_URL_ARCH="x86_64"
96+
elif [[ "${PLEX_ARCH}" = armhf ]]; then
97+
PLEX_URL_ARCH="armv7hf_neon"
98+
elif [[ "${PLEX_ARCH}" = arm64 ]]; then
99+
PLEX_URL_ARCH="aarch64"
100+
fi
101+
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 )
105102
elif [[ "${VERSION,,}" = public ]]; then
106-
PLEX_TOKEN=""
107-
REMOTE_VERSION=$(curl -s "${PLEX_INSTALL}&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 )
103+
REMOTE_VERSION=curl -sX GET 'https://plex.tv/api/downloads/5.json' | jq -r '.computer.Linux.version'
108104
else
109105
REMOTE_VERSION="${VERSION}"
110106
fi
@@ -116,21 +112,16 @@ fi
116112

117113
echo "Atempting to upgrade to: $REMOTE_VERSION"
118114
rm -f /tmp/plexmediaserver_*.deb
119-
if [[ $REMOTE_VERSION == 1.15* ]]; then
120115
wget -nv -P /tmp \
121-
"https://downloads.plex.tv/plex-media-server-new/$REMOTE_VERSION/debian/plexmediaserver_${REMOTE_VERSION}_amd64.deb"
122-
else
123-
wget -nv -P /tmp \
124-
"${PLEX_DOWNLOAD}/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb"
125-
fi
116+
"${PLEX_DOWNLOAD}/${REMOTE_VERSION}/debian/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb"
126117
last=$?
127118

128119
# test if deb file size is ok, or if download failed
129-
if [[ "$last" -gt "0" ]] || [[ $(stat -c %s /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb) -lt 10000 ]]; then
120+
if [[ "$last" -gt "0" ]] || [[ $(stat -c %s /tmp/plexmediaserver_"${REMOTE_VERSION}"_${PLEX_ARCH}.deb) -lt 10000 ]]; then
130121
printf '\n\n\n%s\n\n\n' "$(</tmp/update_fail.nfo)"
131122
exit 0
132123
# if ok, try to install it.
133124
else
134-
dpkg -i --force-confold /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb
125+
dpkg -i --force-confold /tmp/plexmediaserver_"${REMOTE_VERSION}"_${PLEX_ARCH}.deb
135126
rm -f /tmp/plexmediaserver_*.deb
136127
fi

0 commit comments

Comments
 (0)