Skip to contentSkip to conversation

matrix-gui: update init scripts to execute /etc/profile.d/*.sh only when they exist

PATCH New Hongmei Gou 1 participant 1 message Aug 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 matrix-gui: update init scripts to execute /etc/profile.d/*.sh only when they exist

---
v2 change: simplify the check as suggested by Denys

 recipes-core/matrix/matrix-gui/init         | 49 +++++++++++++++++++++++
 recipes-core/matrix/matrix-gui/init.eglfs   | 60 +++++++++++++++++++++++++++++
 recipes-core/matrix/matrix-gui_2.0.bbappend |  4 +-
 3 files changed, 112 insertions(+), 1 deletion(-)
 create mode 100644 recipes-core/matrix/matrix-gui/init
 create mode 100644 recipes-core/matrix/matrix-gui/init.eglfs
recipes-core/matrix/matrix-gui/init new file +49 -0
new file mode 100644
index 0000000..5124c38
@@ -0,0 +1,49 @@
+#! /bin/sh
+
+matrixgui="/usr/bin/matrix_browser"
+GUI_OPTS="http://localhost:80/ __MATRIX_FLAGS__"
+PIDFILE="/var/run/matrix-gui-2.0.pid"
+
+# Important System Environment Variables
+for sh in /etc/profile.d/*.sh ; do
+    [ -r "$sh" ] && . "$sh"
+done
+
+test -x "$matrixgui" || exit 0
+
+case "$1" in
+  start)
+    __SWITCH_FOREGROUND_VT__
+
+    #Clear out the the tmp and lock directory
+    cd __MATRIX_WEB_DIR__
+    rm -rf tmp/*
+    rm -rf lock/*
+    cd -
+
+	if [ -e $PIDFILE ]; then
+      PIDDIR=/proc/$(cat $PIDFILE)
+      if [ -d ${PIDDIR} -a  "$(readlink -f ${PIDDIR}/exe)" = "${matrixgui}" ]; then
+        echo "$DESC already started; not starting."
+      else
+        echo "Removing stale PID file $PIDFILE."
+        rm -f $PIDFILE
+      fi
+    fi
+
+    echo -n "Starting Matrix GUI application"
+    start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE --exec $matrixgui -- $GUI_OPTS
+    echo "."
+    ;;
+
+  stop)
+    echo -n "Stopping Matrix GUI application"
+    start-stop-daemon --stop --quiet --pidfile $PIDFILE
+    echo "."
+    ;;
+  *)
+    echo "Usage: /etc/init.d/matrix-gui-2.0 {start|stop}"
+    exit 1
+esac
+
+exit 0
recipes-core/matrix/matrix-gui/init.eglfs new file +60 -0

60 lines not on this page · raw message

recipes-core/matrix/matrix-gui_2.0.bbappend +3 -1
index 57f4e12..1cc5c0a 100644
@@ -1,3 +1,5 @@
-PR_append = ".tisdk1"
+PR_append = ".tisdk2"
 
 SRCREV = "9a2d12590102fefc5c29fc9e8d346ce6b0198468"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
Signature · 1 line
1.9.1