Brian O'Connor

ONOS-2896 Updating onos.conf for onos-package

Adding pre-start script to ensure that /opt/onos/{var,config,log} are present, and
create them if they are missing

Also, prefill the user and options if /opt/onos/options is missing

Change-Id: Iae0ed182435669d2247c46929e3df5a18dd0aac5
......@@ -11,8 +11,15 @@ kill timeout 60
respawn
env LANG=en_US.UTF-8
#env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
#env NEW_JAVA_HOME=/usr/lib/jvm/java-8-oracle/
pre-start script
# Ensure that the environment is initialized
[ -d /opt/onos ] && mkdir -p /opt/onos/var
[ -d /opt/onos ] && mkdir -p /opt/onos/config
# TODO make karaf version configurable
[ -d /opt/onos ] && [ ! -h /opt/onos/log ] \
&& ln -s /opt/onos/apache-karaf-3.0.3/data/log /opt/onos/log || :
end script
pre-stop script
/opt/onos/bin/onos halt 2>>/opt/onos/var/stderr.log
......@@ -21,7 +28,7 @@ end script
script
[ -f /opt/onos/options ] && . /opt/onos/options
start-stop-daemon --signal INT --start --chuid $ONOS_USER \
--exec /opt/onos/bin/onos-service -- $ONOS_OPTS \
start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \
--exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \
>/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
end script
......