summaryrefslogtreecommitdiff
blob: 8f5d8017b9930a19aea8f5355f8aa841eeacc890 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-tv/freevo/freevo-1.6.0.ebuild,v 1.7 2007/11/27 11:14:27 zzam Exp $

inherit distutils

IUSE="matrox dvd encode lirc X nls"
DESCRIPTION="Digital video jukebox (PVR, DVR)."
HOMEPAGE="http://www.freevo.org/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
RESTRICT="mirror"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"

DEPEND=">=dev-python/pygame-1.5.6
	>=dev-python/imaging-1.1.3
	>=dev-python/pyxml-0.8.2
	>=dev-python/twisted-2
	>=dev-python/twisted-web-0.5.0-r1
	>=dev-python/mmpython-0.4.10
	>=media-video/mplayer-0.92
	>=media-libs/freetype-2.1.4
	>=media-libs/libsdl-1.2.5
	dev-python/elementtree
	dvd? ( >=media-video/xine-ui-0.9.22 >=media-video/lsdvd-0.10 )
	encode? ( >=media-sound/cdparanoia-3.9.8 >=media-sound/lame-3.93.1 )
	matrox? ( >=media-video/matroxset-0.3 )
	lirc? ( app-misc/lirc >=dev-python/pylirc-0.0.3 )"
RDEPEND="${DEPEND}"

pkg_setup() {
	if ! built_with_use media-libs/sdl-image png; then
		eerror "media-libs/sdl-image must be emerged with the 'png' use flag"
		eerror "Please fix and re-emerge freevo."
		die "fix use flags"
	fi
}

src_unpack() {
	unpack ${A}
	cp "${FILESDIR}/freevo.rc6" "${WORKDIR}/"
	if use X ; then
		sed -e 's/lircd/lircd xdm/g' "${WORKDIR}/freevo.rc6" > "${WORKDIR}/freevo.rc6b"
	else
		sed -e 's/lircd/lircd local/g' "${WORKDIR}/freevo.rc6" > "${WORKDIR}/freevo.rc6b"
	fi
}

src_install() {
	distutils_src_install

	insinto /etc/freevo
	doins "${T}/freevo.conf"
	newins local_conf.py.example local_conf.py

	if [ "${PROFILE_ARCH}" == "xbox" ]; then
		sed -i -e "s/# MPLAYER_AO_DEV.*/MPLAYER_AO_DEV='alsa1x'/" "${D}"/etc/freevo/local_conf.py
		newins "${FILESDIR}"/xbox-lircrc lircrc
	fi

	if use X; then
		echo "#!/bin/bash" > freevo
		echo "/usr/bin/freevoboot startx" >> freevo
		exeinto /etc/X11/Sessions/
		doexe freevo

		KDFREEVO=`kde-config --prefix`
		if [ "x$KDFREEVO" != "x" ]; then
			FREEVOSESSION=`grep ^SessionsDirs= ${KDFREEVO}/share/config/kdm/kdmrc | cut -d= -f 2 | cut -d: -f1`
			if [ "x${FREEVOSESSION}" != "x" ]; then
				insinto ${FREEVOSESSION}
				doins "${FILESDIR}"/freevo.desktop freevo.desktop
			fi
		fi

		insinto /etc/X11/dm/Sessions
		doins "${FILESDIR}"/freevo.desktop freevo.desktop
	fi

	exeinto /usr/bin
	newexe "${FILESDIR}/freevo.boot" freevoboot
	newconfd "${FILESDIR}/freevo.conf" freevo

	rm -rf "${D}/usr/share/doc"
	newdoc Docs/README README.docs
	dodoc BUGS COPYING ChangeLog FAQ INSTALL PKG-INFO README TODO \
		Docs/{CREDITS,NOTES,plugins/*.txt}
	cp -r Docs/{installation,plugin_writing} "${D}/usr/share/doc/${PF}"

	use nls || rm -rf "${D}"/usr/share/locale
}

pkg_postinst() {
	elog "If you want to schedule programs, emerge xmltv now."
	elog

	elog "Please check /etc/freevo/freevo.conf and"
	elog "/etc/freevo/local_conf.py before starting Freevo."
	elog "To rebuild freevo.conf with different parameters,"
	elog "please run:"
	elog "    freevo setup"
	elog

	if [ -e "${ROOT}/etc/init.d/freevo" ] ; then
		ewarn "Please remove ${ROOT}/etc/init.d/freevo because is no longer used"
		ewarn "and runnining freevo as root could be a security risk"
	fi
	ewarn
	ewarn "Freevo starting method for freevo-only-systems is changed, cause"
	ewarn "initscript would run it as root and this may cause unsecurity."
	ewarn "That is now substituted with freevoboot, a wrapper to be runned"
	ewarn "as user. Configuration is still in /etc/conf.d/freevo"
	ewarn "and you can always use freevo directly."
	ewarn
	if use X ; then
		ewarn "If you're using a Freevo-only system with X, you'll need"
		ewarn " to setup the autologin (as user) and choose freevo as"
		ewarn "default session. If you need to run recordserver/webserver"
		ewarn "at boot, please use /etc/conf.d/freevo as always."
		ewarn
		ewarn "Should you decide to personalize your freevo.desktop"
		ewarn "session, keep inside /usr/bin/freevoboot startx (wrapper)."
		ewarn
	else
		ewarn "Freevo initscript is changed and should not be run as root"
		ewarn
		ewarn "If you want Freevo to start automatically,you'll need"
		ewarn "to follow instructions at :"
		ewarn "http://freevo.sourceforge.net/cgi-bin/doc/BootFreevo"
		ewarn
		ewarn "*NOTE: you can use mingetty or provide a login"
		ewarn "program for getty to autologin as limited privileges user"
		ewarn "a tutorial for getty is at:"
		ewarn "http://ubuntuforums.org/showthread.php?t=152274"
		ewarn
		ewarn "Sorry for the disadvantage, this is done for bug #150568."
		ewarn
	fi

	if [ -e "${ROOT}/etc/init.d/freevo" ] ; then
		ewarn "Please remove ${ROOT}/etc/init.d/freevo as is a security"
		ewarn "threat. To set autostart read above."
	fi

	if [ -e "${ROOT}/opt/freevo" ] ; then
		ewarn "Please remove ${ROOT}/opt/freevo because it is no longer used."
	fi
	if [ -e "${ROOT}/etc/freevo/freevo_config.py" ] ; then
		ewarn "Please remove ${ROOT}/etc/freevo/freevo_config.py."
	fi
	if [ -e "${ROOT}/etc/init.d/freevo-record" ] ; then
		ewarn "Please remove ${ROOT}/etc/init.d/freevo-record"
	fi
	if [ -e "${ROOT}/etc/init.d/freevo-web" ] ; then
		ewarn "Please remove ${ROOT}/etc/init.d/freevo-web"
	fi

	local myconf
	if [ "`/bin/ls -l /etc/localtime | grep -e "Europe\|GMT"`" ] ; then
		myconf="${myconf} --tv=pal"
	fi
	if [ "${PROFILE_ARCH}" == "xbox" ]; then
		myconf="${myconf} --geometry=640x480 --display=x11"
	elif use matrox ; then
		myconf="${myconf} --geometry=768x576 --display=mga"
	elif use X ; then
		myconf="${myconf} --geometry=800x600 --display=x11"
	else
		myconf="${myconf} --geometry=800x600 --display=fbdev"
	fi

	"/usr/bin/freevo" setup ${myconf} || die "configure problem"
	ewarn
	ewarn "please note that your local_conf.py should be changed,"
	ewarn "modify the example in /etc/freevo/local.conf.py with"
	ewarn "your settings."
}