From e4f094b47ade29beea6d361870e4a90c7f210d79 Mon Sep 17 00:00:00 2001 From: Jeremy Mordkoff Date: Fri, 2 Dec 2016 16:39:37 -0500 Subject: [PATCH] bug 111 -- create and enable a launchpad service Signed-off-by: Jeremy Mordkoff --- BUILD.sh | 8 +++----- create_launchpad_service | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100755 create_launchpad_service diff --git a/BUILD.sh b/BUILD.sh index cb6fb37b..56c309e7 100755 --- 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 index 00000000..7e862d6b --- /dev/null +++ b/create_launchpad_service @@ -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 </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 -- 2.25.1