www-apps/nikola: add missing die.
[gentoo.git] / www-apps / guacamole / guacamole-0.9.8.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit eutils
7 DESCRIPTION="Guacamole is a html5 vnc client as servlet"
8 HOMEPAGE="http://guac-dev.org/"
9 SRC_URI="mirror://sourceforge/${PN}/${PN}-client-${PV}.tar.gz
10         mysql? ( https://sourceforge.net/projects/${PN}/files/current/extensions/${PN}-auth-jdbc-${PV}.tar.gz )
11         postgres? ( https://sourceforge.net/projects/${PN}/files/current/extensions/${PN}-auth-jdbc-${PV}.tar.gz )
12         noauth? ( https://sourceforge.net/projects/${PN}/files/current/extensions/${PN}-auth-noauth-${PV}.tar.gz )
13         ldap? ( https://sourceforge.net/projects/guacamole/files/current/extensions/${PN}-auth-ldap-${PV}.tar.gz )"
14 S="${WORKDIR}/${PN}-client-${PV}"
15
16 LICENSE="MIT"
17
18 SLOT="0"
19
20 KEYWORDS="~x86 ~amd64"
21
22 IUSE="ldap mysql postgres noauth"
23
24 DEPEND="dev-java/maven-bin:*"
25
26 RDEPEND="${DEPEND}
27         www-servers/tomcat[websockets]
28         >virtual/jre-1.6
29         net-misc/guacamole-server
30         mysql? ( virtual/mysql )
31         postgres? ( dev-db/postgresql )
32         ldap? ( net-nds/openldap )"
33
34 src_compile() {
35         mkdir "${HOME}"/.m2
36         cat /usr/share/`readlink /usr/bin/mvn | sed 's:mvn:maven-bin:'`/conf/settings.xml | \
37         sed -e 's:/path/to/local/repo:'${HOME}/.m2':g' -e 's:<!-- localRepo::' >"${S}"/settings.xml
38         mvn -s "${S}"/settings.xml package
39 }
40
41 src_install() {
42         echo guacd-hostname: localhost >>"${S}/${PN}/doc/example/${PN}.properties"
43         echo guacd-port:     4822 >>"${S}/${PN}/doc/example/${PN}.properties"
44         echo basic-user-mapping: /etc/guacamole/user-mapping.xml >>"${S}/${PN}/doc/example/${PN}.properties"
45         if use noauth; then
46                 sed -e 's:basic-user-mapping:#basic-user-mapping:' -i "${S}/${PN}/doc/example/${PN}.properties"
47                 echo noauth-config: /etc/guacamole/noauth-config.xml  >>"${S}/${PN}/doc/example/${PN}.properties"
48                 insinto "/etc/${PN}/extensions"
49                 find "${WORKDIR}/${PN}-auth-noauth-${PV}/" -name '*.jar' -exec doins '{}' +
50                 insinto "/etc/guacamole"
51                 find "${WORKDIR}/${PN}-auth-noauth-${PV}/doc/example/" -name '*.xml' -exec doins '{}' +
52                 elog "Warning: Setting No Authentication is obviously very insecure! Only use it if you know what you are doing!"
53         fi
54         if use mysql; then
55                 echo mysql-hostname: localhost >>"${S}/${PN}/doc/example/${PN}.properties"
56                 echo mysql-port: 3306 >>"${S}/${PN}/doc/example/${PN}.properties"
57                 echo mysql-database: guacamole >>"${S}/${PN}/doc/example/${PN}.properties"
58                 echo mysql-username: guacamole >>"${S}/${PN}/doc/example/${PN}.properties"
59                 echo mysql-password: some_password >>"${S}/${PN}/doc/example/${PN}.properties"
60                 sed -e 's:basic-user-mapping:#basic-user-mapping:' -i "${S}/${PN}/doc/example/${PN}.properties"
61                 insinto "/etc/${PN}/extensions"
62                 find "${WORKDIR}/${PN}-auth-jdbc-${PV}/mysql/" -name '*.jar' -exec doins '{}' +
63                 insinto "/usr/share/${PN}/schema"
64                 find "${WORKDIR}/${PN}-auth-jdbc-${PV}/mysql/schema/" -name '*.sql' -exec doins '{}' +
65                 insinto "/usr/share/${PN}/schema/upgrade"
66                 find "${WORKDIR}/${PN}-auth-jdbc-${PV}/mysql/schema/upgrade/" -name '*.sql' -exec doins '{}' +
67                 elog "Please add a mysql database and a user and load the sql files in /usr/share/guacamole/schema/ into it."
68                 elog "If this is an update, then you will need to apply the appropriate update script in the location above."
69                 elog "You will also need to adjust the DB propeties in /etc/guacamole.properties!"
70                 elog "The default user and it's password is \"guacadmin\"."
71                 elog "You will also need to download the mysql-connector from here http://dev.mysql.com/downloads/connector/j/"
72                 elog "and put the contained .jar file into /etc/guacamole/lib!"
73                 elog "-"
74         fi
75         if use postgres; then
76                 echo postgresql-hostname: localhost >>"${S}/${PN}/doc/example/${PN}.properties"
77                 echo postgresql-port: 5432 >>"${S}/${PN}/doc/example/${PN}.properties"
78                 echo postgresql-database: guacamole >>"${S}/${PN}/doc/example/${PN}.properties"
79                 echo postgresql-username: guacamole >>"${S}/${PN}/doc/example/${PN}.properties"
80                 echo postgresql-password: some_password >>"${S}/${PN}/doc/example/${PN}.properties"
81                 sed -e 's:basic-user-mapping:#basic-user-mapping:' -i "${S}/${PN}/doc/example/${PN}.properties"
82                 insinto "/etc/${PN}/extensions"
83                 find "${WORKDIR}/${PN}-auth-jdbc-${PV}/postgresql/" -name '*.jar' -exec doins '{}' +
84                 insinto "/usr/share/${PN}/schema"
85                 find "${WORKDIR}/${PN}-auth-jdbc-${PV}/postgresql/schema/" -name '*.sql' -exec doins '{}' +
86                 insinto "/usr/share/${PN}/schema/upgrade"
87                 find "${WORKDIR}/${PN}-auth-jdbc-${PV}/postgresql/schema/upgrade/" -name '*.sql' -exec doins '{}' +
88                 elog "Please add a postgresql database and a user and load the sql files in /usr/share/guacamole/schema/ into it."
89                 elog "If this is an update, then you will need to apply the appropriate update script in the location above."
90                 elog "You will also need to adjust the DB propeties in /etc/guacamole.properties!"
91                 elog "The default user and it's password is \"guacadmin\"."
92                 elog "You will also need to download the postgresql-connector from here https://jdbc.postgresql.org/download.html#current"
93                 elog "and put the contained .jar file into /etc/guacamole/lib!"
94                 elog "-"
95         fi
96         if use ldap; then
97                 echo ldap-hostname: localhost >>"${S}/${PN}/doc/example/${PN}.properties"
98                 echo ldap-port: 389 >>"${S}/${PN}/doc/example/${PN}.properties"
99                 echo ldap-user-base-dn: ou=people,dc=example,dc=net >>"${S}/${PN}/doc/example/${PN}.properties"
100                 echo ldap-username-attribute: uid >>"${S}/${PN}/doc/example/${PN}.properties"
101                 echo ldap-config-base-dn: ou=groups,dc=example,dc=net >>"${S}/${PN}/doc/example/${PN}.properties"
102                 sed -e 's:basic-user-mapping:#basic-user-mapping:' -i "${S}/${PN}/doc/example/${PN}.properties"
103                 insinto "/etc/${PN}/extensions"
104                 find "${WORKDIR}/${PN}-auth-ldap-${PV}" -name '*.jar' -exec doins '{}' +
105                 insinto "/usr/share/${PN}/schema"
106                 doins "${WORKDIR}/${PN}-auth-ldap-${PV}/schema/guacConfigGroup.ldif" "${WORKDIR}/${PN}-auth-ldap-${PV}/schema/guacConfigGroup.schema"
107                 elog "You will need to add and load the .schema file in /usr/share/guacamole/schema/ to your ldap server."
108                 elog "There is also an example .lidf file for creating the users."
109                 elog "-"
110         fi
111         insinto "/etc/${PN}"
112         doins "${WORKDIR}/${PN}-client-${PV}/${PN}/doc/example/user-mapping.xml"
113         insinto "/etc/${PN}"
114         doins "${S}/${PN}/doc/example/guacamole.properties"
115         echo "GUACAMOLE_HOME=/etc/guacamole" >98guacamole
116         doenvd 98guacamole
117         insinto "/var/lib/${PN}"
118         newins "${S}/${PN}/target/${P}.war" "${PN}.war"
119         elog "If it is an update, please make sure to delete the old webapp in /var/lib/tomcat-7/webapps/ first!"
120         elog "To deploy guacamole with tomcat, you will need to link the war file and create the configuration!"
121         elog "ln -sf /var/lib/${PN}/${PN}.war /var/lib/tomcat-7/webapps/"
122         elog "You will also need to adjust the configuration in /etc/${PN}/${PN}.properties"
123         elog "See http://guac-dev.org/doc/${PV}/gug/configuring-guacamole.html#initial-setup for a basic setup"
124         elog "or http://guac-dev.org/doc/${PV}/gug/jdbc-auth.html for a database for authentication and host definitions."
125 }