public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-java] Packaging scm-manager
@ 2013-08-08 23:48 Taahir Ahmed
  2013-08-09  0:58 ` assabajanischer_hinterwaeldler
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Taahir Ahmed @ 2013-08-08 23:48 UTC (permalink / raw
  To: gentoo-java

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

Hi all,

I'm interested in packaging scm-manager [http://www.scm-manager.org/].  It's a 
very nice java servlet that handles hosting git, mercurial, bazaar, and 
subversion repositories.

I'm starting by writing an init script for my existing install (attached).  
I've got it mostly working, I think, but I am wondering if there's a gentoo-
approved way of setting a proper value for JAVA_HOME in the init script.

There is a file (/etc/profile.d/java-config-2.sh) that sets a value for 
several java-related environment variables.  Is it good practice to source 
this file from an init script?  Right now I'm just using a sub-shell call to 
java-config to detect the active system vm.

Thanks,

Taahir Ahmed

[-- Attachment #2: scm-manager --]
[-- Type: text/plain, Size: 2900 bytes --]

#!/sbin/runscript

# Taahir Ahmed

# OpenRC init script for scm-manager.  It's installed in scm-user's home
# directory, and we drop root priveleges before we invoke it.  It's a java
# webapp, so my trust in it isn't particularly high.

depend() {
    
    # Doesn't make sense to run without network access.  At the very least, we
    # need a loopback.
    need net
    
    # I'm pretty sure it can talk to syslog.
    use logger
}

JAVA_HOME=$(java-config --jre-home)

BASEDIR=/home/scm-user/scm-server
REPO="$BASEDIR"/lib

CLASSPATH=${CLASSPATH}:"$BASEDIR"/conf
CLASSPATH=${CLASSPATH}:"$REPO"/scm-server-1.32.jar
CLASSPATH=${CLASSPATH}:"$REPO"/commons-daemon-1.0.10.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-server-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/javax.servlet-2.5.0.v201103041518.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-continuation-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-http-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-io-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-webapp-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-xml-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-servlet-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-security-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-jmx-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-util-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-ajp-7.6.11.v20130520.jar

start() {

    # if [ "${RC_CMD}" = "restart" ];
    # then
    # 	# I don't think a restart requires anything special
    # fi

    ebegin "Starting scm-manager"
    
    # Launch the daemon using jsvc (from the dev-java/commons-daemon package).
    /usr/bin/jsvc                                  \
	-java-home $JAVA_HOME                      \
	-cp "$CLASSPATH"                           \
	-Djava.awt.headless=true                   \
	-Dlogback.configurationFile=logging.xml    \
	-user scm-user                             \
	-outfile "$BASEDIR/var/log/scm-server.out" \
	-errfile "$BASEDIR/var/log/scm-server.err" \
	-pidfile "$BASEDIR/var/scm-server.pid"     \
	-Dapp.name="scm-server"                    \
	-Dapp.repo="$REPO"                         \
	-Dbasedir="$BASEDIR"                       \
	sonia.scm.server.ScmServerDaemon
    
    eend $?
}

stop() {
    ebegin "Stopping scm-manager"

    # Stop using jsvc and the pidfile created during "start".
    /usr/bin/jsvc      \
	-verbose       \
	-stop          \
	-java-home $JAVA_HOME \
	-cp "$CLASSPATH" \
	-user scm-user \
	-outfile "$BASEDIR/var/log/scm-server.out" \
	-errfile "$BASEDIR/var/log/scm-server.err" \
	-pidfile "$BASEDIR/var/scm-server.pid" \
	-Dapp.name="scm-server" \
	-Dapp.repo="$REPO"      \
	-Dbasedir="$BASEDIR"    \
	-Djava.awt.headless=true                   \
	-Dlogback.configurationFile=logging.xml    \
	sonia.scm.server.ScmServerDaemon

    eend $?
}



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-12  5:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 23:48 [gentoo-java] Packaging scm-manager Taahir Ahmed
2013-08-09  0:58 ` assabajanischer_hinterwaeldler
2013-08-09  7:04 ` James Le Cuirot
2013-08-12  5:22 ` Taahir Ahmed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox