[glick2] Add sysv init file for binfmt registration



commit 032c912cc2f40d3455fe279b6a6b84aa516b69ac
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Nov 29 21:46:07 2011 +0100

    Add sysv init file for binfmt registration

 Makefile.am |    2 +-
 fs.c        |    3 +-
 glick2.init |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 3 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index eb08c1b..04ae94b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -113,7 +113,7 @@ glick.desktop: Makefile glick.desktop.in
 	  $(edit) $${srcdir}$  in >$  tmp
 	mv $  tmp $@
 
-EXTRA_DIST=glick2.conf.in glick.desktop.in glick2.xml glick2.spec
+EXTRA_DIST=glick2.conf.in glick.desktop.in glick2.xml glick2.spec glick2.init
 
 DISTCHECK_CONFIGURE_FLAGS=--disable-setuid-install
 
diff --git a/fs.c b/fs.c
index eba7d8b..664f1e2 100644
--- a/fs.c
+++ b/fs.c
@@ -3286,8 +3286,7 @@ main (int argc, char *argv[])
       g_signal_connect (connection, "closed",
 			G_CALLBACK (session_bus_died), NULL);
 #else
-      g_printerr ("No GDBus support in glib, but --die-with-session specified\n");
-      return 1;
+      g_printerr ("No GDBus support in glib, but --die-with-session specified, will leak session process\n");
 #endif
     }
 
diff --git a/glick2.init b/glick2.init
new file mode 100755
index 0000000..8907683
--- /dev/null
+++ b/glick2.init
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# glick2  Allow users to run glick2 bundles by just clicking on them
+#	(or typing ./bundle)
+#
+# chkconfig: 2345 35 98
+# description: Allow users to run glick2 bundles by just clicking \
+#	       on them (or typing ./file.exe)
+
+. /etc/rc.d/init.d/functions
+RETVAL=0
+
+start() {
+	echo -n $"Registering binary handler for glick2 bundles"
+	/sbin/modprobe binfmt_misc &>/dev/null
+	echo ":glick:M:0:\x8cGLK\x0d\x0a\x1a\x0a::/usr/bin/glick-runner:" > /proc/sys/fs/binfmt_misc/register
+	echo
+}
+
+stop() {
+	echo -n $"Unregistering binary handler for glick2 bundles"
+ 	[ -r /proc/sys/fs/binfmt_misc/glick ] && echo "-1" >/proc/sys/fs/binfmt_misc/glick
+	echo
+}
+
+reload() {
+	stop
+	start
+}
+
+glick2_status() {
+	if ls /proc/sys/fs/binfmt_misc/glick &>/dev/null; then 
+		echo $"glick2 binary format handlers are registered."
+		return 0
+	else
+		echo $"glick2 binary format handlers are not registered."
+		return 3
+	fi
+}
+
+
+case "$1" in
+	start)
+		start
+		;;
+	stop)
+		stop
+		;;
+	status)
+		glick2_status
+		RETVAL=$?
+		;;
+	restart)
+		stop
+		start
+		;;
+	condrestart)
+		if glick2_status &>/dev/null; then
+			stop
+			start
+		fi
+		;;
+	*)
+		echo $"Usage: $prog {start|stop|status|restart|condrestart}"
+		exit 1
+esac
+exit $RETVAL



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]