Commit f31d2541 authored by Jakub Jirutka's avatar Jakub Jirutka Committed by Bartłomiej Piotrowski

testing/jetty-runner: new abuild

https://www.eclipse.org/jetty
Fast and easy way to run Java web application from the command line.
parent d7f68bf5
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname="jetty-runner"
pkgver="9.2.15.20160210"
_pkgver="${pkgver%.*}.v${pkgver##*.}"
pkgrel=0
pkgdesc="Fast and easy way to run Java web application from the command line."
url="https://www.eclipse.org/jetty"
arch="noarch"
license="ASL 2.0"
depends="openjdk8-jre"
makedepends=""
install=""
subpackages=""
source="https://repo.maven.apache.org/maven2/org/eclipse/jetty/$pkgname/$_pkgver/$pkgname-$_pkgver.jar
$pkgname
$pkgname.initd
$pkgname.confd"
_builddir="$srcdir"
package() {
cd "$_builddir"
install -m644 -D "$pkgname-$_pkgver.jar" \
"$pkgdir/usr/share/java/$pkgname.jar" || return 1
install -m755 -D $pkgname "$pkgdir/usr/bin/$pkgname" || return 1
install -m755 -D $pkgname.initd "$pkgdir/etc/init.d/$pkgname" || return 1
install -m644 -D $pkgname.confd "$pkgdir/etc/conf.d/$pkgname" || return 1
}
md5sums="d8fe666569cabd1d16976a39a682652a jetty-runner-9.2.15.v20160210.jar
1cb6fdbfb741c751b58702d11ffa7dde jetty-runner
8e7e5c9d03374a9ea5cbe3e2f9b7a123 jetty-runner.initd
9361eabb2dfce897bee701c470c77da1 jetty-runner.confd"
sha256sums="2aa81f0754459a8b246b40076af7b30307f9183a84b40bf00ef8624dceaf7615 jetty-runner-9.2.15.v20160210.jar
d4d0b3b13df6291e8df6427beccc1a2694af46c6f5e9a94da5b4e8291437d569 jetty-runner
dd04eef7ee4f6a9a3fce398bea09ebbbd6a0b686e6408a44bbdd954eb37dfa7f jetty-runner.initd
995d203b95c1b311537d1d58b7de3bb83cc8ef554033c235a5917b8964f4eb12 jetty-runner.confd"
sha512sums="b0fb2edb64f2cb8c7428fc89356adfcb1221290a47031f04e836b3cc726f6f1afaaa3f6678e216569d2a262f775cc3719a4ab12ba0a115f0fb326180ee01c497 jetty-runner-9.2.15.v20160210.jar
bcf503157b94c7714355e6ff66eb87e7ef9558247b4242d02452d768cd99a6c73bd1f9aad899128fec063f8c68901d98cc41497211eacf075ae10dfe2f28557d jetty-runner
a2f78a637374fb43ad0ddf58593dd31fd66f997171c54e204638cb00f67365e17346af1763273f1ebd35fca175d0df29907ddcd74745c24d766a329a19e7d4ce jetty-runner.initd
3e7e52e31f69b54ff81e741ccec8fad5afb5277affb085f6b4f42d643a5609a75e8b6f83fff33c24e41866a42e698de72d687ba5f6cf74825b40ac8c7dda57b3 jetty-runner.confd"
#!/bin/sh
java="${JAVA_HOME:+$JAVA_HOME/bin/}java"
$java $JAVA_OPTS -cp /usr/share/java/jetty-runner.jar org.eclipse.jetty.runner.Runner $@
# YOU SHOULD NOT MODIFY THIS FILE! CREATE A COPY NAMED AFTER THE APPLICATION
# YOU WANT TO RUN AND MODIFY THAT INSTEAD (and remove this notice).
# User to run the application.
user="nobody"
# Path of the WAR file, the web app directory, or the context xml file to run.
webapp_path=""
# The relative URL root (i.e. context path) of the application.
#context_root=""
# The port to listen on for HTTP connections (or 0 for a randomly allocated port).
server_port="8080"
# The name or IP of the interface to listen on (default is all interfaces).
#server_bind_address=""
# Path of the log file to catch stdout/stderr of the server process.
# Use empty value to disable stdout/sderr logging.
#server_out_log="/var/log/jetty/server.log"
# Path of the access log file.
# Use empty value to disable access log.
#server_access_log="/var/log/jetty/access.log"
# Additional JARs to be added to the classloader.
# It may contain space or colon separated paths of JAR files or directories.
#server_extra_jars=""
# Java system properties to pass to the JVM.
# Define space separated tuples of <name>=<value>; it will be transformed into
# -D<name>=<value> arguments for java.
#java_properties=""
# Initial and maximum size of the heap (in megabytes).
# Note: This sets parameters -Xms and -Xmx.
java_heap_size="128"
# Ratio of old/new generation sizes. The default value is 2 (i.e. max size of
# old will be twice as the max size of young).
# Note: This sets parameter -XX:NewRatio.
java_new_ratio="2"
# Additional options to pass to the JVM.
java_opts="-XX:MaxGCPauseMillis=80"
# You may use rc_need, rc_use, rc_after, rc_before and rc_provide variables to
# influence the dependencies of the service.
#rc_use="nginx postgresql"
#!/sbin/openrc-run
: ${name:=${RC_SVCNAME}}
: ${pidfile:=/run/${RC_SVCNAME}.pid}
: ${user:=nobody}
: ${jetty_runner:=/usr/share/java/jetty-runner.jar}
command="java"
command_background="true"
start_stop_daemon_args="--quiet --user $user"
retry="SIGTERM/20"
depend() {
need net
}
start_pre() {
if [ "$RC_SVCNAME" = "jetty-runner" ]; then
ewarn "You are not supposed to run this runscript directly. Instead, you should"
ewarn "create a symlink for the application you want to run as well as a copy of"
ewarn "the configuration file and modify it appropriately, like so:"
ewarn ""
ewarn " ln -s jetty-runner /etc/init.d/myapp"
ewarn " cp /etc/conf.d/jetty-runner /etc/conf.d/myapp"
ewarn ""
fi
if [ ! -e "$webapp_path" ]; then
eerror "File or directory '$webapp_path' does not exist!"; exit 1
fi
if [ -n "$server_out_log" ]; then
checkpath -d -o "$user" "$(dirname "$server_out_log")"
fi
if [ -n "$server_access_log" ]; then
checkpath -d -o "$user" "$(dirname "$server_access_log")"
fi
if [ -n "$server_port" ] && nc -z 127.0.0.1 "$server_port"; then
eerror "Port $server_port is already in use!"; exit 1
fi
java_opts="
-server
${java_heap_size:+ -Xms${java_heap_size}M -Xmx${java_heap_size}M}
${java_new_ratio:+ -XX:NewRatio=${java_new_ratio}}
-Dfile.encoding=utf-8
$java_opts"
local item; for item in $java_properties; do
java_opts="$java_opts -D${item}"
done
jetty_opts="
$(optif --port "$server_port")
$(optif --host "$server_bind_address")
$(optif --out "$server_out_log")
$(optif --log "$server_access_log")"
local path; for path in ${server_extra_jars//:/ }; do
if [ -f "$path" ]; then
jetty_opts="$jetty_opts --jar $path"
elif [ -d "$path" ]; then
jetty_opts="$jetty_opts --lib $path"
else
ewarn "JAR file or directory $path does not exist!"
fi
done
jetty_opts="$jetty_opts $(optif --path "$context_root") $webapp_path"
command_args="$java_opts -cp $jetty_runner org.eclipse.jetty.runner.Runner $jetty_opts"
}
optif() {
test -n "$2" && echo "$1 $2"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment