#!/bin/bash
#
#
#   @copyright Copyright (c) OX Software GmbH, Germany <info@open-xchange.com>
#   @license AGPL-3.0
#
#   This code is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with OX App Suite.  If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>.
#
#   Any use of the work other than as authorized under this license or copyright law is prohibited.
#
#

OXFUNCTIONS=/opt/open-xchange/lib/oxfunctions.sh
OXCONFIG=/opt/open-xchange/etc/ox-scriptconf.sh
OXPREFIX=@prefix@
OXBUNDLES=$OXPREFIX/bundles

test -f $OXFUNCTIONS || {
    echo "missing common shell functions file"
    exit 1
}

. $OXFUNCTIONS

test -f $OXCONFIG && . $OXCONFIG

ox_set_JAVA_BIN

test -z "$JAVA_OXCMD_OPTS" && JAVA_OXCMD_OPTS="-Xmx280M"

JAVA_OPTS="${JAVA_OXCMD_OPTS} \
-Djava.awt.headless=true \
-Dopenexchange.propdir=$PROPERTIESDIR"

CLASSPATH="-classpath /opt/open-xchange/bundles/org.glassfish.hk2.api-2.4.0-b10.jar:/opt/open-xchange/bundles/jackson-databind-2.11.0.jar:/opt/open-xchange/bundles/httpcore-osgi-4.4.13.jar:/opt/open-xchange/bundles/org.glassfish.hk2.locator-2.4.0-b10.jar:/opt/open-xchange/bundles/commons-cli-1.4.jar:/opt/open-xchange/bundles/org.glassfish.jersey.core.jersey-client-2.17.jar:/opt/open-xchange/bundles/commons-codec-1.14.jar:/opt/open-xchange/bundles/commons-csv-1.6.jar:/opt/open-xchange/bundles/com.openexchange.global/com.openexchange.global.jar:/opt/open-xchange/bundles/com.openexchange.global/lib/stringsearch-1.0.0.jar:/opt/open-xchange/bundles/com.openexchange.global/lib/stringsearch-2.jar:/opt/open-xchange/bundles/org.glassfish.hk2.utils-2.4.0-b10.jar:/opt/open-xchange/bundles/org.glassfish.hk2.external.javax.inject-2.4.0-b10.jar:/opt/open-xchange/bundles/commons-io-2.6.jar:/opt/open-xchange/bundles/javax.ws.rs-api-2.0.1.jar:/opt/open-xchange/bundles/org.glassfish.jersey.core.jersey-server-2.17.jar:/opt/open-xchange/bundles/jersey-entity-filtering-2.17.jar:/opt/open-xchange/bundles/org.glassfish.jersey.media.multipart_2.17.jar:/opt/open-xchange/bundles/jackson-jaxrs-base-2.11.0.jar:/opt/open-xchange/bundles/org.glassfish.jersey.core.jersey-common-2.17.jar:/opt/open-xchange/bundles/org.json.jar:/opt/open-xchange/bundles/jersey-media-json-jackson-2.17.jar:/opt/open-xchange/bundles/com.openexchange.java.jar:/opt/open-xchange/bundles/javax.annotation-api-1.3.2.jar:/opt/open-xchange/bundles/org.glassfish.jersey.bundles.repackaged.jersey-guava-2.17.jar:/opt/open-xchange/bundles/jackson-jaxrs-json-provider-2.11.0.jar:/opt/open-xchange/bundles/org.glassfish.hk2.osgi-resource-locator-1.0.1.jar:/opt/open-xchange/bundles/org.glassfish.hk2.external.aopalliance-repackaged-2.4.0-b10.jar:/opt/open-xchange/bundles/org.eclipse.osgi_3.15.0.v20190830-1434.jar:/opt/open-xchange/bundles/jackson-annotations-2.11.0.jar:/opt/open-xchange/bundles/jackson-core-2.11.0.jar:/opt/open-xchange/bundles/javassist-3.18.1-GA.jar:/opt/open-xchange/bundles/com.openexchange.annotation.jar:/opt/open-xchange/bundles/logback-core-1.2.3.jar:/opt/open-xchange/bundles/com.google.guava/lib/j2objc-annotations-1.3.jar:/opt/open-xchange/bundles/com.google.guava/lib/failureaccess-1.0.1.jar:/opt/open-xchange/bundles/com.google.guava/lib/checker-qual-2.10.0.jar:/opt/open-xchange/bundles/com.google.guava/lib/guava-30.0-jre.jar:/opt/open-xchange/bundles/com.google.guava/lib/error_prone_annotations-2.3.4.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/high-scale-lib-1.1.4.jar:/opt/open-xchange/bundles/com.openexchange.common/com.openexchange.common.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/nekohtml-1.9.22.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/jdo2-api-2.3-eb.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/rabin-hash-function-2.0.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/jboss-jms-api.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/mysql-connector-java-5.1.49.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/cache-api-1.1.0.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/trove-3.0.3.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/chardet-1.1.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/bucket4j-core-4.9.0.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/jts-1.13.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/cssparser-0.9.7.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/scribe-java-1.3.7.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/vinnie-2.0.2.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/jericho-html-3.4.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/jsoup-1.13.1.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/owasp-esapi-2.0.1.jar:/opt/open-xchange/bundles/com.openexchange.common/lib/gnu-rex.jar:/opt/open-xchange/bundles/logback-extensions-2.0.0.jar:/opt/open-xchange/bundles/log4j-over-slf4j-1.7.26.jar:/opt/open-xchange/bundles/slf4j-api-1.7.26.jar:/opt/open-xchange/bundles/javax.servlet-api-4.0.0.jar:/opt/open-xchange/bundles/logback-classic-1.2.3.jar:/opt/open-xchange/bundles/jcl-over-slf4j-1.7.26.jar:/opt/open-xchange/bundles/org.eclipse.osgi.services_3.8.0.v20190206-2147.jar:/opt/open-xchange/bundles/javax.annotation.concurrent/lib/jsr305-3.0.2.jar:/opt/open-xchange/bundles/javax.annotation.concurrent/javax.annotation.concurrent.jar:/opt/open-xchange/bundles/javax.mail/lib/libidn-1.9.jar:/opt/open-xchange/bundles/javax.mail/lib/EmailAddress.jar:/opt/open-xchange/bundles/javax.mail/lib/emailaddress-rfc2822-2.2.0.jar:/opt/open-xchange/bundles/javax.mail/lib/jtnef-2.0.0.jar:/opt/open-xchange/bundles/javax.mail/lib/poi-3.17.jar:/opt/open-xchange/bundles/javax.mail/javax.mail.jar:/opt/open-xchange/bundles/com.openexchange.net.ssl.jar:/opt/open-xchange/bundles/com.openexchange.net/com.openexchange.net.jar:/opt/open-xchange/bundles/com.openexchange.net/lib/java-ipv6-0.17-SNAPSHOT.jar:/opt/open-xchange/bundles/com.openexchange.system.extension.jar:/opt/open-xchange/bundles/com.openexchange.net.ssl.config.jar:/opt/open-xchange/bundles/httpclient-osgi-4.5.13.jar:/opt/open-xchange/bundles/com.openexchange.net.ssl.management.jar:/opt/open-xchange/bundles/com.openexchange.osgi.jar:/opt/open-xchange/bundles/com.openexchange.logging.jar:/opt/open-xchange/bundles/com.openexchange.monitoring.jar:/opt/open-xchange/bundles/org.apache.commons.lang_2.6.0.v201404270220.jar:/opt/open-xchange/bundles/commons-validator-1.6.jar:/opt/open-xchange/bundles/com.openexchange.configread.jar:/opt/open-xchange/bundles/jul-to-slf4j-1.7.26.jar:/opt/open-xchange/bundles/org.apache.servicemix.bundles.kafka-clients-2.4.0_1.jar:/opt/open-xchange/bundles/com.openexchange.management.jar:/opt/open-xchange/bundles/gson-2.8.5.jar:/opt/open-xchange/bundles/juniversalchardet-1.0.3.jar:/opt/open-xchange/bundles/com.google.json/com.google.json.jar:/opt/open-xchange/bundles/com.google.json/lib/json-sanitizer-1.2.1.jar:/opt/open-xchange/bundles/com.openexchange.config.cascade.jar:/opt/open-xchange/bundles/org.yaml.snakeyaml/lib/snakeyaml-1.21.jar:/opt/open-xchange/bundles/org.eclipse.osgi.util_3.5.300.v20190708-1141.jar:/opt/open-xchange/bundles/commons-beanutils-1.9.3.jar:/opt/open-xchange/bundles/commons-collections-3.2.2.jar:/opt/open-xchange/bundles/commons-digester-2.1.jar:/opt/open-xchange/bundles/com.openexchange.database.jar:/opt/open-xchange/bundles/com.openexchange.database.migration.jar:/opt/open-xchange/bundles/liquibase.core.jar:/opt/open-xchange/bundles/com.openexchange.caching/lib/concurrent-1.3.4.jar:/opt/open-xchange/bundles/com.openexchange.caching/com.openexchange.caching.jar:/opt/open-xchange/bundles/com.openexchange.caching/lib/jcs-1.3-custom.jar:/opt/open-xchange/bundles/com.openexchange.threadpool.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/lib/micrometer-registry-prometheus-1.5.1.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/lib/simpleclient-0.8.1.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/lib/simpleclient_servlet-0.8.1.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/com.openexchange.metrics.micrometer.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/lib/micrometer-core-1.5.1.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/lib/LatencyUtils-2.0.3.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/lib/HdrHistogram-2.1.11.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/lib/simpleclient_common-0.8.1.jar:/opt/open-xchange/bundles/com.openexchange.metrics.micrometer/lib/simpleclient_hotspot-0.8.1.jar:/opt/open-xchange/bundles/org.w3c.css.sac_1.3.1.v200903091627.jar:/opt/open-xchange/bundles/com.openexchange.xerces/lib/xercesImpl-2.12.0.jar:/opt/open-xchange/bundles/com.openexchange.xerces/lib/xml-apis-1.4.01.jar:/opt/open-xchange/bundles/com.openexchange.xerces/lib/serializer-2.7.2.jar:/opt/open-xchange/bundles/com.openexchange.xerces/lib/xml-resolver-1.2.jar:/opt/open-xchange/bundles/commons-net-3.6.jar:/opt/open-xchange/bundles/com.openexchange.caching.events.jar:/opt/open-xchange/bundles/failsafe-1.1.1.jar:/opt/open-xchange/bundles/com.openexchange.config.lean.jar:/opt/open-xchange/bundles/commons-collections4-4.3.jar:/opt/open-xchange/bundles/javax.validation.api-1.1.0.Final.jar:/opt/open-xchange/bundles/org.jvnet.mimepull_1.9.4.jar:/opt/open-xchange/bundles/jackson-module-jaxb-annotations-2.11.0.jar:/opt/open-xchange/lib/com.openexchange.userfeedback.clt.jar"

umask 066
exec $JAVA_BIN $JAVA_OPTS $CLASSPATH com.openexchange.userfeedback.clt.SendUserFeedback "$@"
