summaryrefslogtreecommitdiff
blob: 426dae0e6c2c320c4e9302774da8dab5c21c4e56 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-cdr/webcdwriter/webcdwriter-2.7.2.ebuild,v 1.5 2007/04/28 21:38:23 tove Exp $

inherit eutils java-pkg

MY_P="${P/cd/CD}"
DESCRIPTION="Make CD-writer(s) available to all users in your network"
HOMEPAGE="http://joerghaeger.de/webCDwriter/index.html"
SRC_URI="http://joerghaeger.de/webCDwriter/download/${MY_P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="java pam mp3 sox vorbis"

RDEPEND="
	app-cdr/cdrdao
	virtual/cdrtools
	mp3? ( media-sound/mpg123 )
	sox? ( media-sound/sox )
	vorbis? ( media-sound/vorbis-tools )
	java? ( >=virtual/jre-1.4 )"
DEPEND="java? ( >=virtual/jdk-1.4 )
	${RDEPEND}"

S="${WORKDIR}/${MY_P}"

src_compile() {
	epatch ${FILESDIR}/configure.patch

	local myconf

	use pam || myconf="--pam"
	myconf="${myconf} --user=root --group=root"
	./configure ${myconf} || die "configure failed"
	make || die "make failed"
}

src_install() {

	newinitd ${FILESDIR}/${PN}.rc CDWserver

	diropts -m700
	dodir /etc/CDWserver
	keepdir /var/CDWserver/bin
	dodir /var/CDWserver/export/Server/tools
	dodir /var/CDWserver/http/rcdrecord
	keepdir /var/CDWserver/projects
	keepdir /var/log/CDWserver
	keepdir /var/spool/CDWserver

	insinto /etc/CDWserver

	PORT="12411"
	if use mp3
	then
		MP3="on"
	else
		MP3="off"
	fi
	if use vorbis
	then
		OGG="on"
	else
		OGG="off"
	fi
	if use sox
	then
		AUDIO="on"
	else
		AUDIO="off"
	fi

	cd ${S}/CDWserver/config
	cat config.default \
		| sed s*#portNo=12411*portNo=${PORT}*g \
		| sed s*#MP3decoding=on*MP3decoding=${MP3}*g \
		| sed s*"# ogg123"*oggDecoding=${OGG}*g \
		| sed s*#audioCDSupport=on*audioCDSupport=${AUDIO}*g \
		> config
	for name in `find -name '[!M]*' -type f`
	do
		doins ${name}
	done

	cd ${S}/CDWserver/http
	for dirname in `find -type d`
	do
		cd ${S}/CDWserver/http/${dirname}
		dodir /var/CDWserver/http/${dirname}
		insinto /var/CDWserver/http/${dirname}
		for name in `find -name '[!M]*' -type f`
		do
			doins ${name}
		done
	done

	cd ${S}/CDWserver/test
	make || die "make -C CDWserver/test failed"
	for name in `find -type f -perm -111`
	do
		dobin ${name}
	done

	insinto /var/CDWserver/http/rcdrecord

	cd ${S}/rcdrecord
	for name in `find -name '*.html'`
	do
	    doins ${name}
	done

	cd ${S}/webCDcreator
	cp start.html index.html
	for dirname in `find -type d`
	do
		cd ${S}/webCDcreator/${dirname}
		dodir /var/CDWserver/http/webCDcreator/${dirname}
		insinto /var/CDWserver/http/webCDcreator/${dirname}
		for name in `find -type f`
		do
			if test "${name}" != Makefile
			then
				doins ${name}
			fi
		done
	done

	cd ${S}/tools
	make || die "make -C tools failed"
	mv CDWconfig.sh.tmp ${S}/CDWserver/CDWconfig.sh

	cd ${S}

	dosbin ${S}/CDWserver/CDWconfig.sh
	dosbin ${S}/CDWserver/CDWserver
	dobin ${S}/CDWserver/CDWrootGate
	dobin ${S}/CDWserver/CDWverify
	dobin ${S}/CDWserver/setScheduler
	dobin ${S}/rcdrecord/rcdrecord

	dosym /usr/sbin/CDWserver /usr/sbin/CDWpasswd
	dosym /usr/sbin/CDWserver /usr/sbin/CDWuseradd
	dosym /usr/bin/rcdrecord /usr/bin/files2cd
	dosym /usr/bin/rcdrecord /usr/bin/image2cd

	insinto /var/CDWserver/export/Server/tools
	doins ${S}/MD5Verify/MD5Verify.jar

	dodoc COPYING ChangeLog README CREDITS
	dohtml *.html
}

pkg_postinst() {
	# ripped from the makefile
	local PORTEXT
	if [ "${PORT}" == "80" ]
	then
		PORTEXT=""
	else
		PORTEXT=":${PORT}"
	fi
	elog "To do:"
	elog "1. Enter \"/etc/init.d/CDWserver start\" to start your webCDwriter"
	elog "2. Open your web browser and try"
	elog "   \"http://127.0.0.1${PORTEXT}\" or \"http://`hostname`${PORTEXT}\""
	elog "to check the status of your webCDwriter"
#	elog "3. Run \"/usr/sbin/CDWconfig.sh\" to set the rights of CDWserver"
	echo
	ewarn "Remember to setup /etc/CDWserver/config"
}