Merge pull request #67 from ChuckPa/chuckpa/add-arch-support

Version 1.0.5 
- Add Arch Linux support
- Improve override file processing
- Documentation cleanup
This commit is contained in:
Chuck 2023-05-10 07:26:19 -04:00 committed by GitHub
commit 9833228f71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 111 additions and 29 deletions

View File

@ -2,12 +2,12 @@
######################################################################### #########################################################################
# Plex Media Server database check and repair utility script. # # Plex Media Server database check and repair utility script. #
# Maintainer: ChuckPa # # Maintainer: ChuckPa #
# Version: v1.0.3 # # Version: v1.0.5 #
# Date: 27-Mar-2023 # # Date: 04-May-2023 #
######################################################################### #########################################################################
# Version for display purposes # Version for display purposes
Version="v1.0.3" Version="v1.0.5"
# Flag when temp files are to be retained # Flag when temp files are to be retained
Retain=0 Retain=0
@ -17,7 +17,6 @@ CheckedDB=0
# By default, we cannot start/stop PMS # By default, we cannot start/stop PMS
HaveStartStop=0 HaveStartStop=0
StartStopUser=0
StartCommand="" StartCommand=""
StopCommand="" StopCommand=""
@ -294,6 +293,37 @@ GetSize() {
echo $Size echo $Size
} }
# Extract specified value from override file if it exists (Null if not)
GetOverride() {
Retval=""
# Don't know if we have pushd so do it long hand
CurrDir="$(pwd)"
# Find the metadata dir if customized
if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then
# Get there
cd /etc/systemd/system/plexmediaserver.service.d
# Glob up all 'conf files' found
ConfFile="$(find override.conf local.conf *.conf 2>/dev/null | uniq)"
# If there is one, search it
if [ "$ConfFile" != "" ]; then
Retval="$(grep "$1" $ConfFile | head -1 | sed -e "s/.*${1}=//" | tr -d \" | tr -d \')"
fi
fi
# Go back to where we were
cd "$CurrDir"
# What did we find
echo "$Retval"
}
# Determine which host we are running on and set variables # Determine which host we are running on and set variables
HostConfig() { HostConfig() {
@ -405,13 +435,48 @@ HostConfig() {
# Find the metadata dir if customized # Find the metadata dir if customized
if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then
# Glob up all 'conf files' found # Get custom AppSuppDir if specified
NewSuppDir="$(cd /etc/systemd/system/plexmediaserver.service.d ; \ NewSuppDir="$(GetOverride PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR)"
cat override.conf local.conf *.conf 2>/dev/null | grep "APPLICATION_SUPPORT_DIR" | head -1)"
if [ -d "$NewSuppDir" ]; then
AppSuppDir="$NewSuppDir"
else
Output "Given application support directory override specified does not exist: '$NewSuppDir'. Ignoring."
fi
fi
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
PID_FILE="$AppSuppDir/Plex Media Server/plexmediaserver.pid"
LOGFILE="$DBDIR/DBRepair.log"
HostType="$(grep ^PRETTY_NAME= /etc/os-release | sed -e 's/PRETTY_NAME=//' | sed -e 's/"//g')"
HaveStartStop=1
StartCommand="systemctl start plexmediaserver"
StopCommand="systemctl stop plexmediaserver"
return 0
# Arch Linux
elif [ -e /etc/os-release ] && [ "$(grep 'Arch Linux' /etc/os-release)" != "" ] && \
[ -d /usr/lib/plexmediaserver ] && \
[ -d /var/lib/plex ]; then
# Where is the software
PKGDIR="/usr/lib/plexmediaserver"
PLEX_SQLITE="$PKGDIR/Plex SQLite"
LOG_TOOL="logger"
# Where is the data
AppSuppDir="/var/lib/plex"
# Find the metadata dir if customized
if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then
# Get custom AppSuppDir if specified
NewSuppDir="$(GetOverride PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR)"
if [ "$NewSuppDir" != "" ]; then if [ "$NewSuppDir" != "" ]; then
NewSuppDir="$(echo $NewSuppDir | sed -e 's/.*_DIR=//' | tr -d '"' | tr -d "'")"
if [ -d "$NewSuppDir" ]; then if [ -d "$NewSuppDir" ]; then
AppSuppDir="$NewSuppDir" AppSuppDir="$NewSuppDir"
else else
@ -421,10 +486,9 @@ HostConfig() {
fi fi
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases" DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
PID_FILE="$AppSuppDir/Plex Media Server/plexmediaserver.pid"
LOGFILE="$DBDIR/DBRepair.log" LOGFILE="$DBDIR/DBRepair.log"
LOG_TOOL="logger"
HostType="$(grep ^PRETTY_NAME= /etc/os-release | sed -e 's/PRETTY_NAME=//' | sed -e 's/"//g')" HostType="Arch Linux"
HaveStartStop=1 HaveStartStop=1
StartCommand="systemctl start plexmediaserver" StartCommand="systemctl start plexmediaserver"

View File

@ -98,9 +98,10 @@ If sufficient privleges exist (root), and supported by the environment, the opti
They will likely be supported by the container/VM PMS runs in. They will likely be supported by the container/VM PMS runs in.
``` ```
Vendor | Shared folder name | directory Vendor | Shared folder name | Recommended directory
-------------------+---------------------+------------------------------------------ -------------------+---------------------+------------------------------------------
Apple | Downloads | ~/Downloads Apple | Downloads | ~/Downloads
Arch Linux | N/A | Anywhere
ASUSTOR | Public | /volume1/Public ASUSTOR | Public | /volume1/Public
binhex | N/A | Container root (adjacent /config) binhex | N/A | Container root (adjacent /config)
Docker | N/A | Container root (adjacent /config) Docker | N/A | Container root (adjacent /config)
@ -130,16 +131,16 @@ If sufficient privleges exist (root), and supported by the environment, the opti
### EXAMPLE: To install & launch on Synology DSM 6 / DSM 7
### EXAMPLE: To install & launch on Synology DSM 6 cd /volume1/Plex (/volume1/PlexMediaServer on DSM 7)
cd /volume1/Plex # /volume1/PlexMediaServer on DSM 7
sudo bash sudo bash
tar xf PlexDBRepair-x.y.z.tar.gz tar xf PlexDBRepair-x.y.z.tar.gz
cd PlexDBRepair-x.y.z cd PlexDBRepair-x.y.z
chmod +x DBRepair.sh chmod +x DBRepair.sh
./DBRepair.sh ./DBRepair.sh
### EXAMPLE: Using DBRepair inside containers (manual start/stop included) ### EXAMPLE: Using DBRepair inside containers (manual start/stop included)
#### (Select containers allow stopping/starting PMS from the menu. See menu for details) #### (Select containers allow stopping/starting PMS from the menu. See menu for details)

View File

@ -7,10 +7,25 @@
[![master](https://img.shields.io/badge/master-stable-green.svg?maxAge=2592000)]('') [![master](https://img.shields.io/badge/master-stable-green.svg?maxAge=2592000)]('')
![Maintenance](https://img.shields.io/badge/Maintained-Yes-green.svg) ![Maintenance](https://img.shields.io/badge/Maintained-Yes-green.svg)
# Release Info:
v1.0.5
- Add Arch Linux Support
- Put system override processing in funtion
v1.0.4
- Correct Start/Stop problem on some hosts
v1.0.3
- Use POSIX free space calculation on all systems
# Introduction # Introduction
DBRepair provides database repair and maintenance for the most common Plex Media Server database problems. DBRepair provides database repair and maintenance for the most common Plex Media Server database problems.
It is a simple menu-driven utility with a command line backend. It is a simple menu-driven utility with a command line backend.
While it does correct the following errors, it can't correct 'data' errors with the individual records.
These type changes can only be performed by PMS.
## Situations and errors commonly seen include: ## Situations and errors commonly seen include:
1. Searching is sluggish 1. Searching is sluggish
@ -71,18 +86,19 @@ It is a simple menu-driven utility with a command line backend.
## Hosts currently supported ## Hosts currently supported
1. Apple (MacOS) 1. Apple (MacOS)
2. ASUSTOR 2. Arch Linux
3. Docker containers via 'docker exec' command (inside the running container environment) 3. ASUSTOR
4. Docker containers via 'docker exec' command (inside the running container environment)
- Plex,inc. - Plex,inc.
- Linuxserver.io - Linuxserver.io
- BINHEX - BINHEX
- HOTIO - HOTIO
- Podman (libgpod) - Podman (libgpod)
4. Linux workstation & server 5. Linux workstation & server
5. Netgear (OS5 Linux-based systems) 6. Netgear (OS5 Linux-based systems)
6. QNAP (QTS & QuTS) 7. QNAP (QTS & QuTS)
7. Synology (DSM 6 & DSM 7) 8. Synology (DSM 6 & DSM 7)
8. Western Digital (OS5) 9. Western Digital (OS5)
# Installation # Installation
@ -90,9 +106,10 @@ It is a simple menu-driven utility with a command line backend.
Please use this table as a reference. Please use this table as a reference.
``` ```
Vendor | Shared folder name | directory Vendor | Shared folder name | Recommended directory
-------------------+---------------------+------------------------------------------ -------------------+---------------------+------------------------------------------
Apple | Downloads | ~/Downloads Apple | Downloads | ~/Downloads
Arch Linux | N/A | Anywhere
ASUSTOR | Public | /volume1/Public ASUSTOR | Public | /volume1/Public
binhex | N/A | Container root (adjacent /config) binhex | N/A | Container root (adjacent /config)
Docker | N/A | Container root (adjacent /config) Docker | N/A | Container root (adjacent /config)