0 0 1
default
Michalis Adamidis (gsnerf) - 15 months ago 2017-06-05 13:46:19
gsnerf@gsnerf.de
actually added the new emby-server ebuild...
1 file changed with 112 insertions and 0 deletions:
↑ Collapse Diff ↑
 
new file 100644
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
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
 
IUSE=""
16
 
RESTRICT="mirror test"
17
 

	
18
 
RDEPEND=">=dev-lang/mono-4.6.0
19
 
	>=media-video/ffmpeg-2[vpx]
20
 
	media-gfx/imagemagick[jpeg,jpeg2k,webp,png]
21
 
	!media-tv/mediabrowser-server
22
 
	>=dev-db/sqlite-3.0.0
23
 
	dev-dotnet/referenceassemblies-pcl"
24
 
DEPEND="app-arch/unzip ${RDEPEND}"
25
 

	
26
 
INSTALL_DIR="/opt/emby-server"
27
 
DATA_DIR="/var/lib/emby-server"
28
 
STARTUP_LOG="/var/log/emby-server_start.log"
29
 
INIT_SCRIPT="${ROOT}/etc/init.d/emby-server"
30
 

	
31
 
# INSTALL
32
 
# #######################################################################################################
33
 

	
34
 
pkg_setup() {
35
 
	einfo "creating user for Emby"
36
 
	enewgroup emby
37
 
	enewuser emby -1 /bin/bash ${INSTALL_DIR} "emby"
38
 
}
39
 

	
40
 
# gentoo expects a specific subfolder in the working directory for the extracted source, so simply extracting won't work here
41
 
src_unpack() {
42
 
        unpack ${A}
43
 
        mv Emby-${PV} emby-server-${PV}
44
 
}
45
 

	
46
 
src_prepare() {
47
 
	MAGICKWAND=$(ldconfig -p | grep MagickWand.*.so$ | cut -d" " -f4)
48
 
	MAGICKWAND=${MAGICKWAND##*/}
49
 
	einfo "adapting to imagemagick library to: ${MAGICKWAND}"
50
 
	sed -i -e "s/\"libMagickWand-6.Q8.so\"/\"${MAGICKWAND}\"/" MediaBrowser.Server.Mono/ImageMagickSharp.dll.config || die "could not update libMagickWand reference!"
51
 
}
52
 

	
53
 

	
54
 
src_compile() {
55
 
	einfo "updating root certificates for mono certificate store"
56
 
	mozroots --import --sync
57
 
	einfo "now actually compile"
58
 
	xbuild /p:Configuration="Release Mono" /p:Platform="Any CPU" MediaBrowser.Mono.sln || die "building failed"
59
 
}
60
 

	
61
 
src_install() {
62
 
	einfo "preparing startup scripts"
63
 
	newinitd "${FILESDIR}"/emby-server.init_3  ${PN}
64
 
	newconfd "${FILESDIR}"/emby-server.conf ${PN}
65
 

	
66
 
	einfo "preparing startup log file"
67
 
	dodir /var/log/
68
 
	touch ${D}${STARTUP_LOG}
69
 
	chown emby:emby ${D}${STARTUP_LOG}
70
 

	
71
 
	einfo "installing compiled files"
72
 
	diropts -oemby -gemby
73
 
	dodir ${INSTALL_DIR}
74
 
	cp -R ${S}/MediaBrowser.Server.Mono/bin/Release\ Mono/* ${D}${INSTALL_DIR}/ || die "install failed, possibly compile did not succeed earlier?"
75
 
	chown emby:emby -R ${D}${INSTALL_DIR}
76
 

	
77
 
	einfo "prepare data directory"
78
 
	dodir ${DATA_DIR}
79
 
}
80
 

	
81
 
pkg_postinst() {
82
 
	einfo "emby-server was installed to ${INSTALL_DIR}, to start please use the init script provided."
83
 
	einfo "All data generated and used by Emby can be found at ${DATA_DIR} after the first start."
84
 
	einfo ""
85
 

	
86
 
	if [[ -d "/usr/lib/mediabrowser-server" || -h "/usr/lib/mediabrowser-server" ]]; then
87
 
		ewarn "ATTENTION: You seem to have moved from the former mediabrowser-server package:"
88
 
		ewarn "don't forget to migrate your original data directory before the first start!"
89
 
		ewarn "To do that move"
90
 
		ewarn "     /usr/lib/mediabrowser-server"
91
 
		ewarn "to"
92
 
		ewarn "     ${DATA_DIR}"
93
 
		ewarn "and change owner status from mediabrowser:mediabrowser to emby:emby!"
94
 
		ewarn "     chown -R emby:emby ${DATA_DIR}"
95
 
	fi
96
 

	
97
 
	if [[ -d "/usr/lib/emby-server" || -h "/usr/lib/emby-server"  ]]; then
98
 
		ewarn "ATTENTION: You seem to have existing program data at /usr/lib/emby-server!"
99
 
		ewarn "Please move that folder to ${DATA_DIR} before the first start and make sure the folder is owned by emby:emby"
100
 
		ewarn "The folder /usr/lib/emby-server will be repurposed in one of the next releases, so make sure to clean that directory up!"
101
 
	fi
102
 
}
103
 

	
104
 
# UNINSTALL
105
 
# #######################################################################################################
106
 

	
107
 
pkg_prerm() {
108
 
	einfo "Stopping running instances of Emby Server"
109
 
	if [ -e "${INIT_SCRIPT}" ]; then
110
 
		${INIT_SCRIPT} stop
111
 
	fi
112
 
}
0 comments (0 inline, 0 general)