We have moved to Git. This repository is only provided for compatibility with old installations. Learn how to migrate your installation here.

annotate media-tv/emby-server/emby-server-3.0.5572.0-r2.ebuild @ 95:ae751affb613

reworked init and config scripts for emby server as well as location of program files
author gsnerf <gsnerf@gsnerf.de>
date Sun, 12 Apr 2015 18:27:31 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
95
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
1 # Copyright 1999-2015 Gentoo Foundation
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
2 # Distributed under the terms of the GNU General Public License v2
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
3 # $Header: $
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
4
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
5 EAPI="5"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
6
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
7 inherit eutils user git-r3
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
8
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
9 DESCRIPTION="Emby Server (formerly known as MediaBrowser Server) is a software that indexes a lot of different kinds of media and allows for them to be retrieved and played through the DLNA protocol on any device capable of processing them."
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
10 HOMEPAGE="http://emby.media/"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
11 KEYWORDS="-* ~arm ~amd64 ~x86"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
12 SRC_URI="https://github.com/MediaBrowser/MediaBrowser/archive/${PV}.tar.gz"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
13 SLOT="0"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
14 LICENSE="GPL-2"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
15 IUSE=""
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
16 RESTRICT="mirror test"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
17
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
18 RDEPEND=">=dev-lang/mono-3.2.7
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
19 >=media-video/ffmpeg-2[vpx]
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
20 >=media-libs/libmediainfo-0.7
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
21 media-gfx/imagemagick[jpeg,jpeg2k,webp,png]
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
22 !media-tv/mediabrowser-server"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
23 DEPEND="app-arch/unzip ${RDEPEND}"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
24
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
25 INSTALL_DIR="/opt/emby-server"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
26 DATA_DIR="/var/lib/emby-server"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
27 STARTUP_LOG="/var/log/emby-server_start.log"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
28 INIT_SCRIPT="${ROOT}/etc/init.d/emby-server"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
29
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
30 # INSTALL
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
31 # #######################################################################################################
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
32
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
33 pkg_setup() {
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
34 einfo "creating user for Emby"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
35 enewgroup emby
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
36 enewuser emby -1 /bin/bash ${INSTALL_DIR} "emby" --system
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
37 }
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
38
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
39 # gentoo expects a specific subfolder in the working directory for the extracted source, so simply extracting won't work here
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
40 src_unpack() {
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
41 unpack ${A}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
42 mv MediaBrowser-${PV} emby-server-${PV}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
43 }
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
44
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
45 src_prepare() {
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
46 MAGICKWAND=$(ldconfig -p | grep MagickWand.*.so$ | cut -d" " -f4)
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
47 MAGICKWAND=${MAGICKWAND##*/}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
48 einfo "adapting to imagemagick library to: ${MAGICKWAND}"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
49 sed -i -e "s/\"libMagickWand-6.Q8.so\"/\"${MAGICKWAND}\"/" MediaBrowser.Server.Mono/ImageMagickSharp.dll.config || die "could not update libMagickWand reference!"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
50 }
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
51
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
52
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
53 src_compile() {
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
54 einfo "updating root certificates for mono certificate store"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
55 mozroots --import --sync
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
56 einfo "now actually compile"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
57 xbuild /p:Configuration="Release Mono" /p:Platform="Any CPU" MediaBrowser.Mono.sln || die "building failed"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
58 }
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
59
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
60 src_install() {
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
61 einfo "preparing startup scripts"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
62 newinitd "${FILESDIR}"/emby-server.init_2 ${PN}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
63 newconfd "${FILESDIR}"/emby-server.conf ${PN}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
64
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
65 einfo "preparing startup log file"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
66 dodir /var/log/
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
67 touch ${D}${STARTUP_LOG}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
68 chown emby:emby ${D}${STARTUP_LOG}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
69
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
70 einfo "installing compiled files"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
71 diropts -oemby -gemby
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
72 dodir ${INSTALL_DIR}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
73 cp -R ${S}/MediaBrowser.Server.Mono/bin/Release\ Mono/* ${D}${INSTALL_DIR}/ || die "install failed, possibly compile did not succeed earlier?"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
74 chown emby:emby -R ${D}${INSTALL_DIR}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
75
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
76 # as we use the system libraries, we delete the local ones now as we couldn't do it before
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
77 rm -R ${D}${INSTALL_DIR}/MediaInfo
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
78
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
79 einfo "prepare data directory"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
80 dodir ${DATA_DIR}
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
81 }
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
82
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
83 pkg_postinst() {
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
84 einfo "emby-server was installed to ${INSTALL_DIR}, to start please use the init script provided."
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
85 einfo "All data generated and used by Emby can be found at ${DATA_DIR} after the first start."
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
86 einfo ""
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
87
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
88 if [[ -d "/usr/lib/mediabrowser-server" || -h "/usr/lib/mediabrowser-server" ]]; then
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
89 ewarn "ATTENTION: You seem to have moved from the former mediabrowser-server package:"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
90 ewarn "don't forget to migrate your original data directory before the first start!"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
91 ewarn "To do that move"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
92 ewarn " /usr/lib/mediabrowser-server"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
93 ewarn "to"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
94 ewarn " ${DATA_DIR}"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
95 ewarn "and change owner status from mediabrowser:mediabrowser to emby:emby!"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
96 ewarn " chown -R emby:emby ${DATA_DIR}"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
97 fi
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
98
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
99 if [[ -d "/usr/lib/emby-server" || -h "/usr/lib/emby-server" ]]; then
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
100 ewarn "ATTENTION: You seem to have existing program data at /usr/lib/emby-server!"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
101 ewarn "Please move that folder to ${DATA_DIR} before the first start and make sure the folder is owned by emby:emby"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
102 fi
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
103 }
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
104
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
105 # UNINSTALL
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
106 # #######################################################################################################
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
107
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
108 pkg_prerm() {
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
109 einfo "Stopping running instances of Emby Server"
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
110 if [ -e "${INIT_SCRIPT}" ]; then
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
111 ${INIT_SCRIPT} stop
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
112 fi
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
113 }
ae751affb613 reworked init and config scripts for emby server as well as location of program files
gsnerf <gsnerf@gsnerf.de>
parents:
diff changeset
114