public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
From: Taahir Ahmed <ahmedtd@tamu.edu>
To: gentoo-java@lists.gentoo.org
Subject: [gentoo-java] Packaging scm-manager
Date: Thu, 08 Aug 2013 18:48:24 -0500	[thread overview]
Message-ID: <15148336.2obGtzaLKW@basis> (raw)

[-- 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 $?
}



             reply	other threads:[~2013-08-08 23:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08 23:48 Taahir Ahmed [this message]
2013-08-09  0:58 ` [gentoo-java] Packaging scm-manager assabajanischer_hinterwaeldler
2013-08-09  7:04 ` James Le Cuirot
2013-08-12  5:22 ` Taahir Ahmed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15148336.2obGtzaLKW@basis \
    --to=ahmedtd@tamu.edu \
    --cc=gentoo-java@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox