Closed Frankkz closed 1 year ago
When you look at all theses distributions, are they all using the same Application Support directory path?
I don't mind picking up support for miscellaneous variants but it's not within scope to support everything. When using docker, there is a level of implied skill here. It should be easy enough for the "weird distros" to tweak the script to work.
The core features of the script are largely set. I don't see much more happening to it.
When you look at all theses distributions, are they all using the same Application Support directory path?
Yes, because all these arch-based distros use the same package repository for their Plex Media Server.
plex-media-server or plex-media-server-plexpass
The above packages create the following file upon installation:
https://aur.archlinux.org/cgit/aur.git/tree/plexmediaserver.conf.d?h=plex-media-server
cat /etc/conf.d/plexmediaserver
# If your LC_ALL and LANG aren't en_US.UTF-8, plex crashes.
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib
PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plex
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
PLEX_MEDIA_SERVER_TMPDIR=/tmp
TMPDIR=/tmp
I don't mind picking up support for miscellaneous variants but it's not within scope to support everything. When using docker, there is a level of implied skill here. It should be easy enough for the "weird distros" to tweak the script to work.
The core features of the script are largely set. I don't see much more happening to it.
I understand. The script for arch-based distros is already there, simply adjusting "[ grep "Arch Linux" ]" to also search for "ID_LIKE=arch" would be all that's really needed to successfully run on distributions based on Arch Linux.
I am not too experienced with shell scripting but this is what I'd suggest;
HostConfig() {
...
# Arch Linux (must check for native Arch after binhex)
if [ -e /etc/os-release ] && { source /etc/os-release; ( [[ $ID == "arch" ]] || [[ $ID_LIKE == *"arch"* ]] ) } && \
[ -d /usr/lib/plexmediaserver ] && \
[ -d /var/lib/plex ]; then
...
HostType="$PRETTY_NAME"
...
return 0
fi
return 1
...
}
Running DBRepair.sh with the above modification will successfully run the script :)
2023-06-09 14.11.24 - ============================================================
2023-06-09 14.11.24 - Session start: Host is Manjaro Linux
2023-06-09 14.11.28 - Stop - PASS
2023-06-09 14.12.54 - Auto - START
2023-06-09 14.12.56 - Check - Check com.plexapp.plugins.library.db - PASS
2023-06-09 14.12.57 - Check - Check com.plexapp.plugins.library.blobs.db - PASS
2023-06-09 14.12.57 - Check - PASS
2023-06-09 14.13.11 - Repair - Export databases - PASS
2023-06-09 14.13.17 - Repair - Import - PASS
2023-06-09 14.13.18 - Repair - Verify main database - PASS (Size: 77MB/71MB).
2023-06-09 14.13.18 - Repair - Verify blobs database - PASS (Size: 143MB/146MB).
2023-06-09 14.13.18 - Repair - Move files - PASS
2023-06-09 14.13.18 - Repair - PASS
2023-06-09 14.13.18 - Repair - PASS
2023-06-09 14.13.18 - Reindex - MakeBackup com.plexapp.plugins.library.db - PASS
2023-06-09 14.13.18 - Reindex - MakeBackup com.plexapp.plugins.library.blobs.db - PASS
2023-06-09 14.13.18 - Reindex - MakeBackup - PASS
2023-06-09 14.13.19 - Reindex - Reindex: com.plexapp.plugins.library.db - PASS
2023-06-09 14.13.19 - Reindex - Reindex: com.plexapp.plugins.library.blobs.db - PASS
2023-06-09 14.13.19 - Reindex - PASS
2023-06-09 14.13.19 - Reindex - PASS
2023-06-09 14.13.19 - Auto - COMPLETED
2023-06-09 14.13.35 - Exit - Retain temp files.
Problem
Currently the bash script is hard coded to find "Arch Linux" in the os-release file https://github.com/ChuckPa/PlexDBRepair/blob/40a8873ce1922c5a6f7c0b993eb3fd635e16e6bd/DBRepair.sh#L621-L624 This creates the problem that only the official Arch Linux distribution is allowed run the script, even though it should also work on arch-based distros.
Proposal
I did some digging to maybe find a better way to identify arch-based distributions and learned about the "ID_LIKE" parameter.
https://www.freedesktop.org/software/systemd/man/os-release.html#ID_LIKE=
/etc/os-release files of several arch-based distros
Manjaro - https://gitlab.manjaro.org/packages/core/filesystem/-/blob/master/os-release
Manjaro ARM - https://gitlab.manjaro.org/manjaro-arm/packages/core/filesystem/-/blob/master/os-release
EndeavourOS
ArcoLinux - https://github.com/arcolinux/arcolinux-system-config/blob/master/usr/local/share/arcolinux/release/os-release-arco
Note: ID_LIKE is optional so there will likely be arch-based distros that miss this check but at least the majority will be covered :).
Personal Test
Successfully ran this on my Manjaro machine.
Thanks!