Cross-platform changes to onos.initd

We now can use start-stop-daemon (debian), daemon()
shell function (centos), or sudo (others) to start
onos-service.

It should be backward compatible on systemd systems.

Tested on Ubuntu 14 and CentOS 6. Should also work on
Ubuntu 15/16, CentOS 7, Debian, and Fedora.

(Note that we should test this against various OSes,
preferably automatically rather than manually!)

Addresses at least part of ONOS-2907

Change-Id: I4ded98baf02321a5a9db37fdff19e1ce4a3d23d2
diff --git a/tools/test/bin/onos-config b/tools/test/bin/onos-config
index e37dc3b..a38191d 100755
--- a/tools/test/bin/onos-config
+++ b/tools/test/bin/onos-config
@@ -37,7 +37,7 @@
 # ONOS builtin apps and providers ignited by default
 export ONOS_APPS="${ONOS_APPS:-drivers,openflow}"
 
-ssh $remote "
+ssh -tt $remote "
     echo \"onos.ip = \$(sudo ifconfig | grep $ONOS_NIC | cut -d: -f2 | cut -d\\  -f1)\" \
         >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/system.properties
 
diff --git a/tools/test/bin/onos-install b/tools/test/bin/onos-install
index f0fb9dd..e35585c 100755
--- a/tools/test/bin/onos-install
+++ b/tools/test/bin/onos-install
@@ -55,7 +55,7 @@
 
 [ ! -z "$mvn_settings" ] && scp -q $mvn_settings $remote:/tmp/settings.xml
 
-ssh $remote "
+ssh -tt $remote "
     [ -d $ONOS_INSTALL_DIR/bin ] && echo \"ONOS is already installed\" && exit 1
 
     # Prepare a landing zone and unroll the bits
diff --git a/tools/test/bin/onos-service b/tools/test/bin/onos-service
index 43c231c..eab52ed 100755
--- a/tools/test/bin/onos-service
+++ b/tools/test/bin/onos-service
@@ -43,7 +43,7 @@
 
         # Execute the remote commands
         for node in $nodes; do
-            ssh $ONOS_USER@${node} "sudo service onos ${2:-status}"
+            ssh -tt $ONOS_USER@${node} "sudo service onos ${2:-status}"
         done
     ;;
     *)
diff --git a/tools/test/bin/onos-uninstall b/tools/test/bin/onos-uninstall
index ff8ff53..cf767c4 100755
--- a/tools/test/bin/onos-uninstall
+++ b/tools/test/bin/onos-uninstall
@@ -26,9 +26,8 @@
 
 remote=$ONOS_USER@${1:-$OCI}
 
-ssh $remote "
-    sudo stop onos 1>/dev/null 2>/dev/null
-
+ssh -tt $remote "
+    sudo service onos stop  1>/dev/null 2>/dev/null
     # Wait for onos to stop up to 5 seconds
     for i in \$(seq 1 5); do
       [ -z \"\$(ps -ef | grep karaf.jar | grep -v grep)\" ] && break