# Copyright 1999-2020 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit eutils DESCRIPTION="Guacamole is a clientless remote desktop gateway" HOMEPAGE="https://guacamole.apache.org/" SRC_URI="http://mirrors.ircam.fr/pub/apache/guacamole/${PV}/source/${P}.tar.gz" LICENSE="MIT" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="ldap +mysql postgres" REQUIRED_USE="|| ( ldap mysql postgres )" DEPEND="dev-java/maven-bin" RDEPEND="${DEPEND} www-servers/tomcat:8.5 virtual/jre:1.8 mysql? ( dev-java/jdbc-mysql ) postgres? ( dev-java/jdbc-postgresql ) ldap? ( net-nds/openldap )" # To enable Maven access to https://repo.maven.apache.org/maven2 RESTRICT="network-sandbox" MY_PN="guacamole" GUACAMOLE_HOME="/etc/${MY_PN}" CLASSPATH="${GUACAMOLE_HOME}/lib" src_compile() { mvn package -Drat.skip=true } src_install() { insinto "${GUACAMOLE_HOME}/extensions" #doins extensions/guacamole-auth-cas/target/guacamole-auth-cas-1.1.0.jar #doins extensions/guacamole-auth-totp/target/guacamole-auth-totp-1.1.0.jar doins extensions/guacamole-auth-quickconnect/target/guacamole-auth-quickconnect-1.1.0.jar #doins extensions/guacamole-auth-openid/target/guacamole-auth-openid-1.1.0.jar doins extensions/guacamole-auth-header/target/guacamole-auth-header-1.1.0.jar #doins extensions/guacamole-auth-duo/target/guacamole-auth-duo-1.1.0.jar if use mysql || use postgres; then insinto "${GUACAMOLE_HOME}/extensions" doins extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/target/guacamole-auth-jdbc-base-1.1.0.jar fi if use mysql; then insinto "${GUACAMOLE_HOME}/extensions" doins extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/target/guacamole-auth-jdbc-mysql-1.1.0.jar insinto "/usr/share/${PN}/schema/mysql" find "${S}/extensions/${MY_PN}-auth-jdbc/modules/${MY_PN}-auth-jdbc-mysql/schema/" -name '*.sql' -exec doins '{}' + elog "Please add a mysql database and a user and load the sql files in /usr/share/${PN}/schema/ into it." elog "If this is an update, then you will need to apply the appropriate update script in the location above." elog "You will also need to adjust the DB properties in ${GUACAMOLE_HOME}/guacamole.properties!" elog "The default user and it's password is \"guacadmin\"." elog "-" fi if use postgres; then insinto "${GUACAMOLE_HOME}/extensions" doins extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/target/guacamole-auth-jdbc-postgresql-1.1.0.jar insinto "/usr/share/${PN}/schema/postgres" find "${S}/extensions/${MY_PN}-auth-jdbc/modules/${MY_PN}-auth-jdbc-postgresql/schema/" -name '*.sql' -exec doins '{}' + elog "Please add a postgresql database and a user and load the sql files in /usr/share/${PN}/schema/ into it." elog "If this is an update, then you will need to apply the appropriate update script in the location above." elog "You will also need to adjust the DB properties in ${GUACAMOLE_HOME}/guacamole.properties!" elog "The default user and it's password is \"guacadmin\"." elog "-" fi if use ldap; then insinto "${GUACAMOLE_HOME}/extensions" doins extensions/guacamole-auth-ldap/target/guacamole-auth-ldap-1.1.0.jar insinto "/usr/share/${PN}/schema" doins "${S}/extensions/${MY_PN}-auth-ldap/schema/guacConfigGroup.ldif" "${S}/extensions/${MY_PN}-auth-ldap/schema/guacConfigGroup.schema" elog "You will need to add and load the .schema file in /usr/share/${PN}/schema/ to your ldap server." elog "You will also need to adjust the DB properties in ${GUACAMOLE_HOME}/guacamole.properties!" elog "There is also an example .lidf file for creating the users." elog "-" fi insinto "${GUACAMOLE_HOME}" doins "${FILESDIR}"/guacamole.properties doins "${S}/${MY_PN}/doc/example/user-mapping.xml" doins "${S}/${MY_PN}/src/main/resources/logback.xml" keepdir ${CLASSPATH} echo "GUACAMOLE_HOME=${GUACAMOLE_HOME}" >98guacamole doenvd 98guacamole insinto "/usr/share/${PN}" newins "${S}/${MY_PN}/target/${MY_PN}-${PV}.war" "${MY_PN}.war" elog "Guacamole split in two components, please install net-mis/guacamole-server in a computer when you need a Guacamole proxy" elog elog "If it is an update, please make sure to delete the old webapp in /var/lib/tomcat-8.5/webapps/ first!" elog "To deploy guacamole with tomcat, you will need to link the war file and create the configuration!" elog "ln -sf /var/lib/${MY_PN}/${MY_PN}.war /var/lib/tomcat-8.5/webapps/" elog "You will also need to adjust the configuration in ${GUACAMOLE_HOME}/${MY_PN}.properties" elog "With systemd make sure that the var GUACAMOLE_HOME is set to ${GUACAMOLE_HOME}. for example via /etc/conf/tomcat." elog "See https://guacamole.apache.org/doc/gug/configuring-guacamole.html for a basic setup" elog "or https://guacamole.apache.org/doc/gug/jdbc-auth.html for a database for authentication and host definitions." elog elog "Please install www-server/apache or www-servre/nginx for a proxying Guacamole see: https://guacamole.apache.org/doc/gug/proxying-guacamole.html" }