switch to new api, enable plex pass for armhd and aarch64

pull/166/head
aptalca 6 years ago
parent d4ac9c5e0d
commit 8a5075c9c8

@ -12,8 +12,8 @@ ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
# global environment settings # global environment settings
ENV DEBIAN_FRONTEND="noninteractive" \ ENV DEBIAN_FRONTEND="noninteractive" \
PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server" \ PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server-new" \
PLEX_INSTALL="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" \ PLEX_ARCH="amd64" \
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \ PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \ PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \ PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
@ -35,12 +35,12 @@ RUN \
chmod +x /sbin/udevadm && \ chmod +x /sbin/udevadm && \
echo "**** install plex ****" && \ echo "**** install plex ****" && \
if [ -z ${PLEX_RELEASE+x} ]; then \ if [ -z ${PLEX_RELEASE+x} ]; then \
PLEX_RELEASE=$(curl -s 'https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&distro=ubuntu' \ PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \
|grep -oP 'version="\K[^"]+' | tail -n 1); \ | jq -r 'first(.[] | .Linux.version)'); \
fi && \ fi && \
curl -o \ curl -o \
/tmp/plexmediaserver.deb -L \ /tmp/plexmediaserver.deb -L \
"https://downloads.plex.tv/plex-media-server/${PLEX_RELEASE}/plexmediaserver_${PLEX_RELEASE}_amd64.deb" && \ "${PLEX_DOWNLOAD}/${PLEX_RELEASE}/debian/plexmediaserver_${PLEX_RELEASE}_${PLEX_ARCH}.deb" && \
dpkg -i /tmp/plexmediaserver.deb && \ dpkg -i /tmp/plexmediaserver.deb && \
mv /sbin/udevadm.bak /sbin/udevadm && \ mv /sbin/udevadm.bak /sbin/udevadm && \
echo "**** ensure abc user's home folder is /app ****" && \ echo "**** ensure abc user's home folder is /app ****" && \

@ -12,6 +12,8 @@ LABEL maintainer="sparklyballs, thelamer"
# global environment settings # global environment settings
ENV DEBIAN_FRONTEND="noninteractive" \ ENV DEBIAN_FRONTEND="noninteractive" \
PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server-new" \
PLEX_ARCH="arm64" \
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \ PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \ PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \ PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
@ -26,15 +28,19 @@ RUN \
udev \ udev \
unrar \ unrar \
wget \ wget \
jq && \ jq && \
echo "**** Udevadm hack ****" && \ echo "**** Udevadm hack ****" && \
mv /sbin/udevadm /sbin/udevadm.bak && \ mv /sbin/udevadm /sbin/udevadm.bak && \
echo "exit 0" > /sbin/udevadm && \ echo "exit 0" > /sbin/udevadm && \
chmod +x /sbin/udevadm && \ chmod +x /sbin/udevadm && \
echo "**** install plex ****" && \ echo "**** install plex ****" && \
if [ -z ${PLEX_RELEASE+x} ]; then \
PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \
| jq -r 'first(.[] | .Linux.version)'); \
fi && \
curl -o \ curl -o \
/tmp/plexmediaserver.deb -L \ /tmp/plexmediaserver.deb -L \
"https://downloads.plex.tv/plex-media-server-new/1.15.0.647-67e950f12/debian/plexmediaserver_1.15.0.647-67e950f12_arm64.deb" && \ "${PLEX_DOWNLOAD}/${PLEX_RELEASE}/debian/plexmediaserver_${PLEX_RELEASE}_${PLEX_ARCH}.deb" && \
dpkg -i /tmp/plexmediaserver.deb && \ dpkg -i /tmp/plexmediaserver.deb && \
mv /sbin/udevadm.bak /sbin/udevadm && \ mv /sbin/udevadm.bak /sbin/udevadm && \
echo "**** ensure abc user's home folder is /app ****" && \ echo "**** ensure abc user's home folder is /app ****" && \

@ -12,6 +12,8 @@ LABEL maintainer="sparklyballs, thelamer"
# global environment settings # global environment settings
ENV DEBIAN_FRONTEND="noninteractive" \ ENV DEBIAN_FRONTEND="noninteractive" \
PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server-new" \
PLEX_ARCH="armhf" \
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \ PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \ PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \ PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
@ -26,15 +28,19 @@ RUN \
udev \ udev \
unrar \ unrar \
wget \ wget \
jq && \ jq && \
echo "**** Udevadm hack ****" && \ echo "**** Udevadm hack ****" && \
mv /sbin/udevadm /sbin/udevadm.bak && \ mv /sbin/udevadm /sbin/udevadm.bak && \
echo "exit 0" > /sbin/udevadm && \ echo "exit 0" > /sbin/udevadm && \
chmod +x /sbin/udevadm && \ chmod +x /sbin/udevadm && \
echo "**** install plex ****" && \ echo "**** install plex ****" && \
if [ -z ${PLEX_RELEASE+x} ]; then \
PLEX_RELEASE=$(curl -sX GET 'https://plex.tv/api/downloads/5.json' \
| jq -r 'first(.[] | .Linux.version)'); \
fi && \
curl -o \ curl -o \
/tmp/plexmediaserver.deb -L \ /tmp/plexmediaserver.deb -L \
"https://downloads.plex.tv/plex-media-server-new/1.15.0.647-67e950f12/debian/plexmediaserver_1.15.0.647-67e950f12_armhf.deb" && \ "${PLEX_DOWNLOAD}/${PLEX_RELEASE}/debian/plexmediaserver_${PLEX_RELEASE}_${PLEX_ARCH}.deb" && \
dpkg -i /tmp/plexmediaserver.deb && \ dpkg -i /tmp/plexmediaserver.deb && \
mv /sbin/udevadm.bak /sbin/udevadm && \ mv /sbin/udevadm.bak /sbin/udevadm && \
echo "**** ensure abc user's home folder is /app ****" && \ echo "**** ensure abc user's home folder is /app ****" && \

@ -212,6 +212,7 @@ Below are the instructions for updating containers:
## Versions ## Versions
* **14.03.19:** - Switch to new api endpoints, enable beta (plex pass) updates for armhf and aarch64.
* **15.02.19:** - Clean up plex pid after unclean stop. * **15.02.19:** - Clean up plex pid after unclean stop.
* **11.02.19:** - Fix nvidia variables, add device variables. * **11.02.19:** - Fix nvidia variables, add device variables.
* **16.01.19:** - Add pipeline logic, multi arch, and HW transcoding configuration; remove avahi service. * **16.01.19:** - Add pipeline logic, multi arch, and HW transcoding configuration; remove avahi service.

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

@ -1,15 +1,5 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# determine architecture to gaurd arm variants in deployment stage 1
ARCH=$(arch)
if [[ "${ARCH}" == armv* ]]; then
echo "This is armv7, upgrading Plex is not supported yet"
exit 0
elif [[ "${ARCH}" == "aarch64" ]]; then
echo "This is aarch64, upgrading Plex is not supported yet"
exit 0
fi
# If docker manages versioning exit # If docker manages versioning exit
if [ "${VERSION}" ] && [ "${VERSION}" == 'docker' ]; then if [ "${VERSION}" ] && [ "${VERSION}" == 'docker' ]; then
echo "Docker is used for verisoning skip update check" echo "Docker is used for verisoning skip update check"
@ -22,7 +12,7 @@ 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_INSTALL}" && \ "${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
@ -101,10 +91,16 @@ 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
REMOTE_VERSION=$(curl -s "${PLEX_INSTALL}&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) if [[ "${PLEX_ARCH}" = amd64 ]]; then
PLEX_URL_ARCH="x86_64"
elif [[ "${PLEX_ARCH}" = armhf ]]; then
PLEX_URL_ARCH="armv7hf_neon"
elif [[ "${PLEX_ARCH}" = arm64 ]]; then
PLEX_URL_ARCH="aarch64"
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 )
elif [[ "${VERSION,,}" = public ]]; then elif [[ "${VERSION,,}" = public ]]; then
PLEX_TOKEN="" REMOTE_VERSION=curl -sX GET 'https://plex.tv/api/downloads/5.json' | jq -r 'first(.[] | .Linux.version)'
REMOTE_VERSION=$(curl -s "${PLEX_INSTALL}&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 )
else else
REMOTE_VERSION="${VERSION}" REMOTE_VERSION="${VERSION}"
fi fi
@ -116,21 +112,16 @@ fi
echo "Atempting to upgrade to: $REMOTE_VERSION" echo "Atempting to upgrade to: $REMOTE_VERSION"
rm -f /tmp/plexmediaserver_*.deb rm -f /tmp/plexmediaserver_*.deb
if [[ $REMOTE_VERSION == 1.15* ]]; then
wget -nv -P /tmp \ wget -nv -P /tmp \
"https://downloads.plex.tv/plex-media-server-new/$REMOTE_VERSION/debian/plexmediaserver_${REMOTE_VERSION}_amd64.deb" "${PLEX_DOWNLOAD}/${REMOTE_VERSION}/debian/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb"
else
wget -nv -P /tmp \
"${PLEX_DOWNLOAD}/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb"
fi
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}"_amd64.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}"_amd64.deb dpkg -i --force-confold /tmp/plexmediaserver_"${REMOTE_VERSION}"_${PLEX_ARCH}.deb
rm -f /tmp/plexmediaserver_*.deb rm -f /tmp/plexmediaserver_*.deb
fi fi

Loading…
Cancel
Save