From 7d9583a7744934bcb75c5db4ee4df4c79bac432d Mon Sep 17 00:00:00 2001 From: ChuckPa Date: Fri, 9 Jun 2023 20:23:33 -0400 Subject: [PATCH] Refine Arch Linux detection. Grab a few others in the process --- DBRepair.sh | 60 +++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/DBRepair.sh b/DBRepair.sh index 7f5df84..0b49eb0 100755 --- a/DBRepair.sh +++ b/DBRepair.sh @@ -624,45 +624,47 @@ HostConfig() { fi - # Arch Linux (must check for native Arch after binhex) - elif [ -e /etc/os-release ] && [ "$(grep 'Arch Linux' /etc/os-release)" != "" ] && \ + # Last chance to identify this host + elif [ -e /etc/os-release ]; then + + # Arch Linux (must check for native Arch after binhex) + if [ "$(grep -E '=arch|="arch"' /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 software - PKGDIR="/usr/lib/plexmediaserver" - PLEX_SQLITE="$PKGDIR/Plex SQLite" - LOG_TOOL="logger" + # Where is the data + AppSuppDir="/var/lib/plex" - # Where is the data - AppSuppDir="/var/lib/plex" + # Find the metadata dir if customized + if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then - # 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)" - # Get custom AppSuppDir if specified - NewSuppDir="$(GetOverride PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR)" - - if [ "$NewSuppDir" != "" ]; then - if [ -d "$NewSuppDir" ]; then - AppSuppDir="$NewSuppDir" - else - Output "Given application support directory override specified does not exist: '$NewSuppDir'. Ignoring." + if [ "$NewSuppDir" != "" ]; then + if [ -d "$NewSuppDir" ]; then + AppSuppDir="$NewSuppDir" + else + Output "Given application support directory override specified does not exist: '$NewSuppDir'. Ignoring." + fi fi fi + + DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases" + LOGFILE="$DBDIR/DBRepair.log" + LOG_TOOL="logger" + HostType="$(grep PRETTY_NAME /etc/os-release | sed -e 's/^.*="//' | tr -d \" )" + + HaveStartStop=1 + StartCommand="systemctl start plexmediaserver" + StopCommand="systemctl stop plexmediaserver" + return 0 fi - - DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases" - LOGFILE="$DBDIR/DBRepair.log" - LOG_TOOL="logger" - HostType="Arch Linux" - - HaveStartStop=1 - StartCommand="systemctl start plexmediaserver" - StopCommand="systemctl stop plexmediaserver" - return 0 - fi