2013-08-14 09:12:34 +00:00
|
|
|
post_install() {
|
|
|
|
if [ ! `getent passwd plex` ]; then
|
|
|
|
useradd -m -r -s /bin/bash -d /opt/plexmediaserver plex
|
|
|
|
if [ ! $? -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "WARNING COULDN'T CREATE PLEX USERID, MAKE SURE I HAVE PERMISSON TO DO THAT!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi;
|
|
|
|
|
|
|
|
# Now to fix broken items from plexapp.com
|
|
|
|
rm -f /opt/plexmediaserver/start.sh
|
|
|
|
. /etc/conf.d/plexmediaserver
|
|
|
|
|
|
|
|
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ];
|
|
|
|
then
|
|
|
|
mkdir -p "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR"
|
|
|
|
if [ ! $? -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR, MAKE SURE I HAVE PERMISSON TO DO THAT!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
chown -R ${PLEX_MEDIA_SERVER_USER} "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d ${PLEX_MEDIA_SERVER_HOME}/Library/Application\ Support/Plex\ Media\ Server/Plug-ins ]; then
|
|
|
|
mkdir -p ${PLEX_MEDIA_SERVER_HOME}/Library/Application\ Support/Plex\ Media\ Server/Plug-ins
|
|
|
|
if [ ! $? -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR, MAKE SURE I HAVE PERMISSON TO DO THAT!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cp -r ${PLEX_MEDIA_SERVER_HOME}/Resources/Plug-ins/{System.bundle,Framework.bundle} ${PLEX_MEDIA_SERVER_HOME}/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/
|
|
|
|
chown -R ${PLEX_MEDIA_SERVER_USER} ${PLEX_MEDIA_SERVER_HOME} &
|
|
|
|
fi
|
|
|
|
|
|
|
|
systemctl --system daemon-reload
|
|
|
|
cat << "EOM"
|
|
|
|
####
|
|
|
|
# Installation done
|
2014-09-22 11:13:56 +00:00
|
|
|
# - Change default configurations in:
|
2013-08-14 09:12:34 +00:00
|
|
|
# /etc/conf.d/plexmediaserver
|
|
|
|
# - Launch the server with:
|
|
|
|
# systemctl start plexmediaserver
|
2014-09-22 11:13:56 +00:00
|
|
|
# - WebUI is available at http://<ip>:32400/web
|
|
|
|
# - After first run let it settle down for 10-20 min
|
|
|
|
# or you won't be able to add anything to library
|
2013-08-14 09:12:34 +00:00
|
|
|
#
|
|
|
|
# This is an UNOFFICIAL package. Please don't go to plex forums
|
|
|
|
# asking for help as they don't support it on ArchLinux ARM.
|
|
|
|
#
|
|
|
|
# Redistributed with permission from Plex team.
|
|
|
|
####
|
|
|
|
EOM
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pre_install() {
|
|
|
|
if [ -f /usr/lib/systemd/system/plexmediaserver.service ]; then
|
|
|
|
echo "Stopping Plexmediaserver before starting..."
|
|
|
|
systemctl stop plexmediaserver
|
|
|
|
fi;
|
|
|
|
}
|
|
|
|
|
|
|
|
pre_upgrade() {
|
|
|
|
pre_install;
|
|
|
|
}
|
|
|
|
|
|
|
|
pre_remove() {
|
|
|
|
pre_install;
|
|
|
|
}
|
|
|
|
|
|
|
|
post_upgrade() {
|
|
|
|
systemctl --system daemon-reload
|
|
|
|
. /etc/conf.d/plexmediaserver
|
|
|
|
rm -f ${PLEX_MEDIA_SERVER_HOME}/start.sh
|
|
|
|
chown -R ${PLEX_MEDIA_SERVER_USER} ${PLEX_MEDIA_SERVER_HOME} &
|
|
|
|
}
|
2014-09-22 11:13:56 +00:00
|
|
|
|
|
|
|
post_remove() {
|
|
|
|
rm -r /opt/plexmediaserver
|
|
|
|
}
|