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

comparison media-tv/emby-server/emby-server-3.4.1.0.ebuild @ 219:69bf0e308425

added ebuild for emby-server-3.4.1.0 and introduced systemd support
author gsnerf <gsnerf@gsnerf.de>
date Sun, 11 Nov 2018 15:08:42 +0100
parents
children
comparison
equal deleted inserted replaced
218:68f19d4c4a2e 219:69bf0e308425
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="5"
6
7 inherit eutils user git-r3 dotnet systemd
8
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."
10 HOMEPAGE="http://emby.media/"
11 KEYWORDS="-* ~arm ~amd64 ~x86"
12 SRC_URI="https://github.com/MediaBrowser/Emby/archive/${PV}.tar.gz"
13 SLOT="0"
14 LICENSE="GPL-2"
15 RESTRICT="mirror test"
16
17 RDEPEND=">=dev-lang/mono-5.4.0
18 >=media-video/ffmpeg-2[vpx]
19 media-gfx/imagemagick[jpeg,jpeg2k,webp,png]
20 !media-tv/mediabrowser-server
21 >=dev-db/sqlite-3.0.0
22 dev-dotnet/referenceassemblies-pcl
23 app-misc/ca-certificates"
24 DEPEND="app-arch/unzip
25 ${RDEPEND}"
26
27 INSTALL_DIR="/opt/emby-server"
28 DATA_DIR="/var/lib/emby-server"
29 STARTUP_LOG="/var/log/emby-server_start.log"
30 INIT_SCRIPT="${ROOT}/etc/init.d/emby-server"
31
32 # INSTALL
33 # #######################################################################################################
34
35 pkg_setup() {
36 einfo "creating user for Emby"
37 enewgroup emby
38 enewuser emby -1 /bin/bash ${INSTALL_DIR} "emby"
39
40 einfo "updating root certificates for mono certificate store"
41 addwrite "/usr/share/.mono/keypairs"
42 dotnet_pkg_setup
43 cert-sync /etc/ssl/certs/ca-certificates.crt
44 }
45
46 # gentoo expects a specific subfolder in the working directory for the extracted source, so simply extracting won't work here
47 src_unpack() {
48 unpack ${A}
49 mv Emby-${PV} emby-server-${PV}
50 }
51
52 src_prepare() {
53 # the user can define the quality of the imagemagic himself, here we try to figure out the correct files to use in our configuration
54 MAGICKWAND=$(ldconfig -p | grep MagickWand.*.so$ | cut -d" " -f4)
55 MAGICKWAND=${MAGICKWAND##*/}
56 einfo "adapting to imagemagick library to: ${MAGICKWAND}"
57 sed -i -e "s/\"libMagickWand-6.Q8.so\"/\"${MAGICKWAND}\"/" MediaBrowser.Server.Mono/ImageMagickSharp.dll.config || die "could not update libMagickWand reference!"
58 }
59
60
61 src_compile() {
62 addpredict "/etc/mono/registry"
63 xbuild /p:Configuration="Release Mono" /p:Platform="Any CPU" MediaBrowser.sln || die "building failed"
64 }
65
66 src_install() {
67 einfo "installing compiled files"
68 diropts -oemby -gemby
69 dodir ${INSTALL_DIR}
70 cp -R ${S}/MediaBrowser.Server.Mono/bin/Release/* ${D}${INSTALL_DIR}/ || die "install failed, possibly compile did not succeed earlier?"
71 cp "${FILESDIR}"/emby-server ${D}${INSTALL_DIR}/
72 chown emby:emby -R ${D}${INSTALL_DIR}
73
74 einfo "prepare data directory"
75 dodir ${DATA_DIR}
76
77 einfo "preparing basic configuration"
78 newconfd "${FILESDIR}"/emby-server.conf ${PN}
79
80 einfo "preparing init scripts"
81 newinitd "${FILESDIR}"/emby-server.init_3 ${PN}
82 systemd_dounit "${FILESDIR}/3.4/emby-server.service"
83 systemd_install_serviced "${FILESDIR}/3.4/emby-server.service.conf"
84
85 einfo "preparing startup log file"
86 dodir /var/log/
87 touch ${D}${STARTUP_LOG}
88 chown emby:emby ${D}${STARTUP_LOG}
89 }
90
91 pkg_postinst() {
92 einfo "emby-server was installed to ${INSTALL_DIR}, to start please use the init script provided."
93 einfo "All data generated and used by Emby can be found at ${DATA_DIR} after the first start."
94 einfo ""
95
96 if systemd_is_booted; then
97 ewarn "You seem to be running on systemd, to configure the service please refer to \"/etc/systemd/system/emby-server.service.d/00gentoo.conf\"."
98 ewarn "Changing /etc/conf.d/emby-server.conf will have no effect!"
99 fi
100
101 if [[ -d "/usr/lib/mediabrowser-server" || -h "/usr/lib/mediabrowser-server" ]]; then
102 ewarn "ATTENTION: You seem to have moved from the former mediabrowser-server package:"
103 ewarn "don't forget to migrate your original data directory before the first start!"
104 ewarn "To do that move"
105 ewarn " /usr/lib/mediabrowser-server"
106 ewarn "to"
107 ewarn " ${DATA_DIR}"
108 ewarn "and change owner status from mediabrowser:mediabrowser to emby:emby!"
109 ewarn " chown -R emby:emby ${DATA_DIR}"
110 fi
111
112 if [[ -d "/usr/lib/emby-server" || -h "/usr/lib/emby-server" ]]; then
113 ewarn "ATTENTION: You seem to have existing program data at /usr/lib/emby-server!"
114 ewarn "Please move that folder to ${DATA_DIR} before the first start and make sure the folder is owned by emby:emby"
115 ewarn "The folder /usr/lib/emby-server will be repurposed in one of the next releases, so make sure to clean that directory up!"
116 fi
117 }
118
119 # UNINSTALL
120 # #######################################################################################################
121
122 pkg_prerm() {
123 einfo "Stopping running instances of Emby Server"
124 if [ -e "${INIT_SCRIPT}" ]; then
125 ${INIT_SCRIPT} stop
126 fi
127 }