diff options
author | Britney Fransen <brfransen@gmail.com> | 2015-07-15 18:17:51 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2015-07-15 18:17:51 (GMT) |
commit | 8818abda9545c04ebf135fef63a2baa7ebec9e49 (patch) | |
tree | a377baae60578f402b8611911f571eba13dcaeea /abs/extra/plex-media-server/plex-media-server.install | |
parent | 5cacb421450d963a30f69ecf40ff437c35e3da49 (diff) | |
download | linhes_pkgbuild-8818abda9545c04ebf135fef63a2baa7ebec9e49.zip linhes_pkgbuild-8818abda9545c04ebf135fef63a2baa7ebec9e49.tar.gz linhes_pkgbuild-8818abda9545c04ebf135fef63a2baa7ebec9e49.tar.bz2 |
plex-media-server: inital inclusion.
Diffstat (limited to 'abs/extra/plex-media-server/plex-media-server.install')
-rw-r--r-- | abs/extra/plex-media-server/plex-media-server.install | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/abs/extra/plex-media-server/plex-media-server.install b/abs/extra/plex-media-server/plex-media-server.install new file mode 100644 index 0000000..ac4a349 --- /dev/null +++ b/abs/extra/plex-media-server/plex-media-server.install @@ -0,0 +1,41 @@ +post_install() { + if [[ ! -d /data/storage/disk0/media/plex ]]; then + install -dm 755 /data/storage/disk0/media/plex + chown 421:421 -R /data/storage/disk0/media/plex + fi + if [[ -n $(getent group 421) && $(getent group 421) != $(getent group plex) ]]; then + echo "GID 421 is already assigned to the $(getent group 421 | cut -d':' -f1) group, cannot create the plex group." + elif [[ -n $(getent passwd 421) && $(getent passwd 421) != $(getent passwd plex) ]]; then + echo "UID 421 is already assigned to the $(getent passwd 421 | cut -d':' -f1) user, cannot create the plex user." + else + if [[ -n $(getent passwd plex) && $(getent passwd plex) != 'plex:x:421:421:Plex User:/data/storage/disk0/media/plex:/usr/bin/nologin' ]]; then + echo "The plex user is outdated. It will be removed and recreated." + if [[ -z $(pidof "Plex Media Server") ]]; then + userdel plex + chown 421:421 -R /data/storage/disk0/media/plex + else + echo "Unable to update the plex user. Please stop plexmediaserver.service and reinstall the package." + fi + fi + if [[ -z $(getent group plex) ]]; then + groupadd -g 421 plex + fi + if [[ -z $(getent passwd plex) ]]; then + useradd -c 'Plex User' -u 421 -g plex -d /data/storage/disk0/media/plex -s /usr/bin/nologin plex + fi + passwd -l plex > /dev/null + fi + add_service.sh plexmediaserver +} + +post_upgrade() { + post_install + if [[ $(vercmp 0.9.11.1.678-1 $2) == '1' ]]; then + echo "Plex' home is now located in '/var/lib/plex'. You will have to move the 'Plex Media Server' directory located in '/opt/plexmediserver/Library/Application Support' into the new home. Please refer to 'https://support.plex.tv/hc/en-us/articles/201370363-Move-an-Install-to-Another-System' for detailed instructions." + fi +} + +post_remove() { + remove_service.sh plexmediaserver +} +# vim: ts=2 sw=2 et: |