Add support for Docker and permission checks

This commit is contained in:
ChuckPa 2022-10-12 12:19:12 -04:00
parent 00e1080049
commit 03e738ec8f
No known key found for this signature in database
GPG Key ID: 3CE28A0F6BC31B5B

View File

@ -385,11 +385,25 @@ HostConfig() {
AppSuppDir="/volume1/Plex/Library" AppSuppDir="/volume1/Plex/Library"
PID_FILE="$AppSuppDir/Plex Media Server/plexmediaserver.pid" PID_FILE="$AppSuppDir/Plex Media Server/plexmediaserver.pid"
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases" DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
LOGFDILE="$DBDIR/DBRepair.log" LOGFILE="$DBDIR/DBRepair.log"
LOG_TOOL="logger" LOG_TOOL="logger"
HostType="ASUSTOR" HostType="ASUSTOR"
return 0 return 0
# Docker (s6)
elif [ -f /bin/s6-svscan ] && [ -f /plex_service.sh ] && [ -f /plex-common.sh ]; then
PLEX_SQLITE="/usr/lib/plexmediaserver/Plex SQLite"
AppSuppDir="/config/Library/Application Support"
PID_FILE="$AppSuppDir/Plex Media Server/plexmediaserver.pid"
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
LOGFILE="$DBDIR/DBRepair.log"
LOG_TOOL="logger"
HostType="Docker"
return 0
fi fi
# Unknown / currently unsupported host # Unknown / currently unsupported host
@ -417,9 +431,9 @@ TimeStamp="$(date "+%Y-%m-%d_%H:%M:%S")"
SetLast "" "" SetLast "" ""
# Identify this host # Identify this host
HostType="" HostType="" ; LOG_TOOL="echo"
if ! HostConfig; then if ! HostConfig; then
Output 'Error: Unknown host. Currently supported hosts are: QNAP, Synology (DSM 6 & DSM 7), Linux Workstation/Server' Output 'Error: Unknown host. Currently supported hosts are: QNAP, Synology, Netgear, ASUSTOR, and Linux Workstation/Server'
exit 1 exit 1
fi fi
@ -439,6 +453,12 @@ if [ ! -f "$PLEX_SQLITE" ] ; then
exit 1 exit 1
fi fi
# Can I write to the Databases directory ?
if [ ! -w "$DBDIR" ]; then
Output "ERROR: Cannot write to the Databases directory. Insufficient privilege or wrong UID. Exiting."
exit 1
fi
# Databases exist or Backups exist to restore from # Databases exist or Backups exist to restore from
if [ ! -f "$DBDIR/$CPPL.db" ] && \ if [ ! -f "$DBDIR/$CPPL.db" ] && \
[ ! -f "$DBDIR/$CPPL.blobs.db" ] && \ [ ! -f "$DBDIR/$CPPL.blobs.db" ] && \
@ -499,7 +519,7 @@ do
read Input read Input
# Handle EOF/forced exit # Handle EOF/forced exit
[ "$Input" = "" ] && Input=7 && Exit=1 [ "$Input" = "" ] && Input=8 && Exit=1
fi fi
[ "$Input" = "1" ] && Choice=1 [ "$Input" = "1" ] && Choice=1
[ "$Input" = "2" ] && Choice=2 [ "$Input" = "2" ] && Choice=2