public
Created

  • Download Gist
PKGBUILD
Shell
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
# Contributor: [Vitaliy Berdinskikh](mailto:ur6lad@archlinux.org.ua) aka UR6LAD
# Contributor: Leif Warner <abimelech@gmail.com>
_timestamp=v20111024
pkgname=jetty
pkgver=8.0.4
pkgrel=1
pkgdesc="A full-fledged production-grade lightweight Java Servlet Container"
arch=('i686' 'x86_64')
url="http://jetty.codehaus.org/jetty/"
license=('Apache' 'EPL')
depends=('java-runtime')
install=jetty.install
source=(http://dist.codehaus.org/${pkgname}/${pkgname}-hightide-${pkgver}/${pkgname}-hightide-${pkgver}.${_timestamp}.tar.gz
rc.$pkgname
$pkgname.conf.d
jetty-setuid.xml
setuid.patch)
md5sums=('b878170caac1d9aea589d48e0995390a'
'a912afd9817f5c9675e9932971fb689a'
'a191d0246f97a314355cbcfd5c74d6a6'
'532d8f6b250c660f8cb2854576cd1c9f'
'a68e53f7b423ab46f9c7357fd9abf12d')
if test "$CARCH" == i686; then
source=("${source[@]}" http://mirrors.ibiblio.org/pub/mirrors/maven2/org/mortbay/jetty/libsetuid/${pkgver}.${_timestamp}/libsetuid-${pkgver}.${_timestamp}-sources.jar)
md5sums=("${md5sums[@]}" 'c746c3362e4771df97577f2aaf8002c0')
fi
options=(!strip)
_foldername=${pkgname}-hightide-${pkgver}.${_timestamp}
 
build() {
if test "$CARCH" == i686; then
gcc -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/ -shared org_mortbay_setuid_SetUID.c -o ${_foldername}/lib/setuid/libsetuid.so
chmod 644 ${_foldername}/lib/setuid/libsetuid.so
fi
patch $srcdir/${_foldername}/start.ini < setuid.patch
rm -r $srcdir/${_foldername}/bin/*cygwin*
}
 
package() {
install -d $pkgdir/opt
cp -a $srcdir/${_foldername} $pkgdir/opt/$pkgname
install jetty-setuid.xml $pkgdir/opt/jetty/etc/jetty-setuid.xml
install -D -m755 rc.$pkgname $pkgdir/etc/rc.d/$pkgname
install -D -m644 $pkgname.conf.d $pkgdir/etc/conf.d/$pkgname
}
# vim:set ts=2 sw=2 et:
jetty-setuid.xml
XML
1 2 3 4 5 6 7 8 9 10 11 12 13
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
 
<!-- =============================================================== -->
<!-- Configure the Jetty SetUIDServer -->
<!-- this configuration file should be used in combination with -->
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty-setuid.xml etc/jetty.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.setuid.SetUIDServer">
<Set name="uid">jettyUserUID</Set>
<Set name="gid">2</Set>
</Configure>
jetty.conf.d
D
1 2 3 4 5 6 7 8 9 10 11 12 13
# set JAVA_HOME
[ -f /etc/profile.d/jre.sh ] && . /etc/profile.d/jre.sh
[ -f /etc/profile.d/jdk.sh ] && . /etc/profile.d/jdk.sh
[ -f /etc/profile.d/openjdk6.sh ] && . /etc/profile.d/openjdk6.sh
# or set your variant
#JAVA_HOME=/somewhere
 
# Other Java options
#JAVA_OPTS=
 
JETTY_HOME=/opt/jetty
# Jetty's variables
#JETTY_OPTS=
jetty.install
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
post_install() {
id jetty &>/dev/null || useradd -r -c "Jetty daemon" -g daemon -d /opt/jetty -s /bin/false jetty
sed -i "s/jettyUserUID/`id -u jetty`/" /opt/jetty/etc/jetty-setuid.xml
chown -R jetty.daemon /opt/jetty/logs
}
 
pre_upgrade() {
id jetty &>/dev/null || useradd -r -c "Jetty daemon" -g daemon -d /opt/jetty -s /bin/false jetty
}
 
post_upgrade() {
sed -i "s/jettyUserUID/`id -u jetty`/" /opt/jetty/etc/jetty-setuid.xml
chown -R jetty.daemon /opt/jetty/logs
}
 
post_remove() {
userdel jetty &>/dev/null
}
rc.jetty
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
#!/bin/bash
 
# general config
. /etc/rc.conf
. /etc/rc.d/functions
 
# set Jetty's variables
. /etc/conf.d/jetty
 
case "$1" in
start)
stat_busy "Starting Jetty Servlet Container"
cd $JETTY_HOME
$JAVA_HOME/bin/java -jar $JAVA_OPTS start.jar $JETTY_OPTS >> /var/log/jetty.log 2>&1 &
echo $! > /var/run/jetty.pid
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon jetty
stat_done
fi
;;
stop)
stat_busy "Stopping Jetty Servlet Container"
cd $JETTY_HOME
[ -e /var/run/jetty.pid ] && PID=`cat /var/run/jetty.pid`
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon jetty
rm -f /var/run/jetty.pid
stat_done
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
setuid.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
--- jetty-hightide-8.0.1.v20110908/start.ini 2011-09-08 12:17:50.000000000 -0700
+++ ../jetty-hightide-8.0.1.v20110908/start.ini 2011-09-30 10:33:11.907265084 -0700
@@ -45,7 +45,7 @@
# for a full listing do
# java -jar start.jar --list-options
#-----------------------------------------------------------
-OPTIONS=Server,jsp,jmx,resources,websocket,ext,plus,annotations,jta,jdbc
+OPTIONS=Server,jsp,jmx,resources,websocket,ext,plus,annotations,jta,jdbc,setuid
#-----------------------------------------------------------
@@ -54,6 +54,7 @@
# For a full list of available configuration files do
# java -jar start.jar --help
#-----------------------------------------------------------
+etc/jetty-setuid.xml
etc/jetty-jmx.xml
etc/jetty.xml
etc/jetty-hightide.xml

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.