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 ...@@ -11,8 +11,15 @@ kill timeout 60
11 respawn 11 respawn
12 12
13 env LANG=en_US.UTF-8 13 env LANG=en_US.UTF-8
14 -#env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 14 +
15 -#env NEW_JAVA_HOME=/usr/lib/jvm/java-8-oracle/ 15 +pre-start script
16 + # Ensure that the environment is initialized
17 + [ -d /opt/onos ] && mkdir -p /opt/onos/var
18 + [ -d /opt/onos ] && mkdir -p /opt/onos/config
19 + # TODO make karaf version configurable
20 + [ -d /opt/onos ] && [ ! -h /opt/onos/log ] \
21 + && ln -s /opt/onos/apache-karaf-3.0.3/data/log /opt/onos/log || :
22 +end script
16 23
17 pre-stop script 24 pre-stop script
18 /opt/onos/bin/onos halt 2>>/opt/onos/var/stderr.log 25 /opt/onos/bin/onos halt 2>>/opt/onos/var/stderr.log
...@@ -21,7 +28,7 @@ end script ...@@ -21,7 +28,7 @@ end script
21 28
22 script 29 script
23 [ -f /opt/onos/options ] && . /opt/onos/options 30 [ -f /opt/onos/options ] && . /opt/onos/options
24 - start-stop-daemon --signal INT --start --chuid $ONOS_USER \ 31 + start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \
25 - --exec /opt/onos/bin/onos-service -- $ONOS_OPTS \ 32 + --exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \
26 >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log 33 >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
27 end script 34 end script
......