mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
75 lines
2.2 KiB
Text
75 lines
2.2 KiB
Text
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
|
|
# - change default configurations in:
|
|
# /etc/conf.d/plexmediaserver
|
|
# - Launch the server with:
|
|
# systemctl start plexmediaserver
|
|
#
|
|
# 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} &
|
|
}
|