ONOS-470: Allow ONOS service to be run with customized username
Change-Id: I643b61842577f68c33bee6383638647615528da4
diff --git a/tools/package/debian/onos.conf b/tools/package/debian/onos.conf
index 9891bd1..85c210d 100644
--- a/tools/package/debian/onos.conf
+++ b/tools/package/debian/onos.conf
@@ -21,7 +21,7 @@
script
[ -f /opt/onos/options ] && . /opt/onos/options
- start-stop-daemon --signal INT --start --chuid sdn \
+ start-stop-daemon --signal INT --start --chuid $ONOS_USER \
--exec /opt/onos/bin/onos-service -- $ONOS_OPTS \
>/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
end script
diff --git a/tools/test/bin/onos-install b/tools/test/bin/onos-install
index 27a478a..4bc41a4 100755
--- a/tools/test/bin/onos-install
+++ b/tools/test/bin/onos-install
@@ -43,6 +43,9 @@
[ -z "$nostart" ] && sudo cp $ONOS_INSTALL_DIR/debian/onos.conf /etc/init/onos.conf
echo 'export ONOS_OPTS=debug' > $ONOS_INSTALL_DIR/options
+ # Setup correct user to run onos-service
+ echo 'export ONOS_USER="${ONOS_USER:-sdn}"' >> $ONOS_INSTALL_DIR/options
+
# Remove any previous ON.Lab bits from ~/.m2 repo and re-stage it.
rm -fr ~/.m2/repository/org/onosproject
cp -r $ONOS_INSTALL_DIR/$KARAF_DIST/system/org/onosproject ~/.m2/repository/org/onosproject