bug 111 -- create and enable a launchpad service
authorJeremy Mordkoff <Jeremy.Mordkoff@riftio.com>
Fri, 2 Dec 2016 21:39:37 +0000 (16:39 -0500)
committerJeremy Mordkoff <Jeremy.Mordkoff@riftio.com>
Fri, 2 Dec 2016 21:39:37 +0000 (16:39 -0500)
Signed-off-by: Jeremy Mordkoff <Jeremy.Mordkoff@riftio.com>
BUILD.sh
create_launchpad_service [new file with mode: 0755]

index cb6fb37..56c309e 100755 (executable)
--- a/BUILD.sh
+++ b/BUILD.sh
@@ -269,8 +269,6 @@ if [[ $UIPathToBuild ]]; then
     sudo make -C $UIPathToBuild install
 fi
 
-echo "To run SO with UI please run:"
-echo 'sudo -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode'
-echo
-echo "To run SO without UI please run:"
-echo 'sudo -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode --no-ui'
+echo "Creating Service ...."
+sudo $(dirname $0)/create_launchpad_service
+
diff --git a/create_launchpad_service b/create_launchpad_service
new file mode 100755 (executable)
index 0000000..7e862d6
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+# install the launchpad systemd service
+# these files should work on both ub16 and fc20
+
+if [ $(whoami) != "root" ]; then
+    echo must be root
+    exit 1
+fi
+
+
+cat <<EOF >/etc/systemd/system/launchpad.service
+[Unit]
+Description=RIFT.ware Launchpad
+After=network-online.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/sh -c 'nohup sudo -b -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode'
+ExecStop=/bin/sh -c 'killall rwmain'
+
+[Install]
+WantedBy=default.target
+EOF
+
+chmod 664 /etc/systemd/system/launchpad.service
+
+if ! systemctl daemon-reload; then
+    echo "WARNING: Not able to reload daemons: this must be run in a privileged container: sudo systemctl daemon-reload ; sudo systemctl enable launchpad.service"
+else
+    # enable launchpad at boot - should always succeed in a privileged container
+    systemctl enable launchpad.service
+fi
+
+# start launchpad?
+#sudo systemctl start launchpad.service
+
+echo
+echo "Launchpad service created and enabled. Run 'sudo systemctl start launchpad.service' to start the service."
+echo