Skip to content

Commit 8a5075c

Browse files
committed
switch to new api, enable plex pass for armhd and aarch64
1 parent d4ac9c5 commit 8a5075c

File tree

6 files changed

+36
-31
lines changed

6 files changed

+36
-31
lines changed

Dockerfile

Lines changed: 5 additions & 5 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" \
@@ -35,12 +35,12 @@ RUN \
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 'first(.[] | .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: 8 additions & 2 deletions
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" \
@@ -26,15 +28,19 @@ RUN \
2628
udev \
2729
unrar \
2830
wget \
29-
jq && \
31+
jq && \
3032
echo "**** Udevadm hack ****" && \
3133
mv /sbin/udevadm /sbin/udevadm.bak && \
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 'first(.[] | .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: 8 additions & 2 deletions
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" \
@@ -26,15 +28,19 @@ RUN \
2628
udev \
2729
unrar \
2830
wget \
29-
jq && \
31+
jq && \
3032
echo "**** Udevadm hack ****" && \
3133
mv /sbin/udevadm /sbin/udevadm.bak && \
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 'first(.[] | .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 ****" && \

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ Below are the instructions for updating containers:
212212

213213
## Versions
214214

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

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ app_setup_block: |
8383
8484
# changelog
8585
changelogs:
86+
- { date: "14.03.19:", desc: "Switch to new api endpoints, enable beta (plex pass) updates for armhf and aarch64." }
8687
- { date: "15.02.19:", desc: "Clean up plex pid after unclean stop." }
8788
- { date: "11.02.19:", desc: "Fix nvidia variables, add device variables." }
8889
- { 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 'first(.[] | .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)