Fix various shellcheck concerns

Signed-off-by: Eric Nemchik <eric@nemchik.com>
pull/387/head
Eric Nemchik 11 months ago
parent 4b79b7759e
commit 56562f4956
No known key found for this signature in database

@ -1,18 +1,19 @@
#!/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}"
lsiown -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"
lsiown abc:abc -R \ lsiown abc:abc -R \
/config/Library /config/Library
fi fi
# remove plex pid after unclean stop # remove plex pid after unclean stop
@ -21,15 +22,15 @@ if [[ -f "/config/Library/Application Support/Plex Media Server/plexmediaserver.
fi fi
# set permissions on Plex Transcoder Temp Directory # set permissions on Plex Transcoder Temp Directory
PREFNAME="/config/Library/Application Support/Plex Media Server/Preferences.xml" PLEX_MEDIA_SERVER_PREFERENCES="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server/Preferences.xml"
if [[ -f "${PREFNAME}" ]]; then if [[ -f "${PLEX_MEDIA_SERVER_PREFERENCES}" ]]; then
TranscoderTempDirectory='\bTranscoderTempDirectory="([^"]+)"' TranscoderTempDirectory='\bTranscoderTempDirectory="([^"]+)"'
while IFS= read -r line; do while IFS= read -r line; do
if [[ ${line} =~ ${TranscoderTempDirectory} ]] && [[ -d "${BASH_REMATCH[1]}" ]]; then if [[ ${line} =~ ${TranscoderTempDirectory} ]] && [[ -d "${BASH_REMATCH[1]}" ]]; then
echo "Setting permissions on ${BASH_REMATCH[1]}" echo "Setting permissions on ${BASH_REMATCH[1]}"
lsiown -R abc:abc "${BASH_REMATCH[1]}" lsiown -R abc:abc "${BASH_REMATCH[1]}"
fi fi
done <"${PREFNAME}" done <"${PLEX_MEDIA_SERVER_PREFERENCES}"
fi fi
# permissions (non-recursive) on config root and folders # permissions (non-recursive) on config root and folders

@ -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

@ -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

@ -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

@ -1,8 +1,11 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# shellcheck shell=bash
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"

Loading…
Cancel
Save