All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Kisdaroczi <kisda@domain.hid>
To: xenomai@xenomai.org
Subject: Re: [Xenomai-core] Xenomai in Debian
Date: Fri, 26 Feb 2010 14:35:58 +0100	[thread overview]
Message-ID: <4B87CE3E.2070402@domain.hid> (raw)
In-Reply-To: <4B86B0DB.4000600@domain.hid>


[-- Attachment #1.1: Type: text/plain, Size: 1194 bytes --]

Am 25.02.2010 18:18, schrieb Stefan Kisdaroczi:
> <snip>
>>>
>>> Hi Gilles,
>>>
>>> can a init.d script with
>>>   echo "<gid>" > /sys/module/xeno_nucleus/parameters/xenomai_gid
>>> work in module and builtin case ?
>>
>> it seems that init.d will work for the builtin case and modprobe.d for the
>> module case. So adding both should work "in all cases" :-)
>> I'll give it a try ...
> 
> Attached a patch that adds a init-script /etc/init.d/xenomai to the package libxenomai1.
> If group xenomai and the file /sys/module/xeno_nucleus/parameters/xenomai_gid are found,
> xenomai_gid is set on startup.
> 
> Now looking at modprobe.d ...

I have attached a patch against debian xenomai version 2.5.1-4, changes:
 - create group xenomai on install
 - added a init-script which sets /sys/.../xenomai_gid if
   /sys/.../xenomai_gid exists
 - added a modprobe-script that adds the xenomai_gid parameter if the user
   did call modprobe without xenomai_gid=

With this changes, all users which are member of the group xenomai are able
to run xenomai apps, with xeno_nucleus builtin or as a module.

Please do not merge anywhere for now, comments are welcome.

Stefan

[-- Attachment #1.2: xenomai-group-debian.patch --]
[-- Type: text/plain, Size: 3814 bytes --]

diff -uNrp xenomai-2.5.1.orig/debian/libxenomai1.dirs xenomai-2.5.1/debian/libxenomai1.dirs
--- xenomai-2.5.1.orig/debian/libxenomai1.dirs	2010-02-26 01:01:07.000000000 +0100
+++ xenomai-2.5.1/debian/libxenomai1.dirs	2010-02-26 01:16:13.000000000 +0100
@@ -1,2 +1,3 @@
+etc/modprobe.d
 etc/udev/rules.d
 usr/share/lintian/overrides
diff -uNrp xenomai-2.5.1.orig/debian/libxenomai1.modprobe xenomai-2.5.1/debian/libxenomai1.modprobe
--- xenomai-2.5.1.orig/debian/libxenomai1.modprobe	1970-01-01 01:00:00.000000000 +0100
+++ xenomai-2.5.1/debian/libxenomai1.modprobe	2010-02-26 01:07:41.000000000 +0100
@@ -0,0 +1,3 @@
+install xeno_nucleus /sbin/modprobe --ignore-install xeno_nucleus $CMDLINE_OPTS \
+  $(/usr/bin/test $(/bin/echo -n '$CMDLINE_OPTS' | /bin/grep xenomai_gid) \
+    || /usr/bin/getent group xenomai | /usr/bin/cut -d: -f3 | /bin/sed -e 's/^/xenomai_gid\=/')
diff -uNrp xenomai-2.5.1.orig/debian/libxenomai1.postinst xenomai-2.5.1/debian/libxenomai1.postinst
--- xenomai-2.5.1.orig/debian/libxenomai1.postinst	2010-02-26 01:01:07.000000000 +0100
+++ xenomai-2.5.1/debian/libxenomai1.postinst	2010-02-26 01:06:00.000000000 +0100
@@ -1,6 +1,22 @@
 #!/bin/sh -e
 
-rm -f /etc/udev/rules.d/xenomai.rules
-ln -sf ../xenomai.rules /etc/udev/rules.d/xenomai.rules
+case "$1" in
+    configure)
+        # Add the xenomai group unless it's already there
+        if ! getent group xenomai >/dev/null; then
+            addgroup --quiet --system xenomai || true
+        fi
+        rm -f /etc/udev/rules.d/xenomai.rules
+        ln -sf ../xenomai.rules /etc/udev/rules.d/xenomai.rules
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
 
 #DEBHELPER#
diff -uNrp xenomai-2.5.1.orig/debian/libxenomai1.xenomai.init xenomai-2.5.1/debian/libxenomai1.xenomai.init
--- xenomai-2.5.1.orig/debian/libxenomai1.xenomai.init	1970-01-01 01:00:00.000000000 +0100
+++ xenomai-2.5.1/debian/libxenomai1.xenomai.init	2010-02-26 01:48:28.000000000 +0100
@@ -0,0 +1,36 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides:          xenomai
+# Required-Start:    mountkernfs
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+# Short-Description: Set xeno_nucleus group
+### END INIT INFO
+
+GROUP=xenomai
+INITNAME=/etc/init.d/xenomai
+FILENAME=/sys/module/xeno_nucleus/parameters/xenomai_gid
+GID=$(getent group $GROUP | cut -d: -f3)
+
+test -e $FILENAME || exit 0
+test -n "$GID" || exit 0
+
+case "$1" in
+  start)
+        echo "$GID" > $FILENAME
+        ;;
+  stop)
+        echo "-1" > $FILENAME
+        ;;
+  restart|force-reload)
+        $0 start
+        ;;
+  *)
+        echo "Usage: $INITNAME {start|stop|restart|force-reload}"
+        exit 1
+        ;;
+esac
+
+exit 0
+
diff -uNrp xenomai-2.5.1.orig/debian/rules xenomai-2.5.1/debian/rules
--- xenomai-2.5.1.orig/debian/rules	2010-02-26 01:01:07.000000000 +0100
+++ xenomai-2.5.1/debian/rules	2010-02-26 01:17:19.000000000 +0100
@@ -100,6 +100,7 @@ install: build
 	for f in $(CURDIR)/ksrc/nucleus/udev/*.rules ; do \
 	    cat $$f >> $(CURDIR)/debian/libxenomai1/etc/udev/xenomai.rules ; \
 	done
+	install -m 644 debian/libxenomai1.modprobe $(CURDIR)/debian/libxenomai1/etc/modprobe.d/xenomai
 	# remove empty directory
 	rm -rf $(CURDIR)/debian/xenomai-doc/usr/share/doc/xenomai-doc/ps
 	cp debian/libxenomai1.lintian $(CURDIR)/debian/libxenomai1/usr/share/lintian/overrides/libxenomai1
@@ -132,6 +133,7 @@ binary-indep: build install
 binary-arch: build install
 	dh_testdir -s
 	dh_testroot -s
+	dh_installinit -s --name=xenomai
 	dh_installman -s
 	dh_installdocs -s -A CREDITS README.INSTALL TROUBLESHOOTING
 	dh_link -s

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

  reply	other threads:[~2010-02-26 13:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-07  9:01 [Xenomai-core] Xenomai in Debian Roland Stigge
2010-02-07 14:24 ` Gilles Chanteperdrix
2010-02-13 14:32 ` Gilles Chanteperdrix
2010-02-13 15:07   ` Roland Stigge
2010-02-13 15:25     ` Gilles Chanteperdrix
2010-02-13 18:30       ` Jan Kiszka
2010-02-13 18:37         ` Gilles Chanteperdrix
2010-02-13 18:48           ` Jan Kiszka
2010-02-13 21:15             ` Gilles Chanteperdrix
2010-02-14  9:38     ` Philippe Gerum
2010-02-23 16:52       ` Stefan Kisdaroczi
2010-02-23 17:46         ` Philippe Gerum
2010-02-24 13:06           ` Stefan Kisdaroczi
2010-02-24 13:11             ` Philippe Gerum
2010-02-24 13:13               ` Philippe Gerum
2010-02-26 13:13                 ` Stefan Kisdaroczi
2010-02-26 13:28                   ` Philippe Gerum
2010-02-26 13:48                     ` Stefan Kisdaroczi
2010-02-26 14:07                       ` Philippe Gerum
2010-03-03 16:54                         ` Stefan Kisdaroczi
2010-03-03 17:21                           ` Philippe Gerum
2010-02-25 12:46             ` Stefan Kisdaroczi
2010-02-25 13:44       ` Stefan Kisdaroczi
2010-02-25 13:49         ` Gilles Chanteperdrix
2010-02-25 13:59           ` Stefan Kisdaroczi
2010-02-25 14:29             ` Stefan Kisdaroczi
2010-02-25 17:18               ` Stefan Kisdaroczi
2010-02-26 13:35                 ` Stefan Kisdaroczi [this message]
2010-05-02 16:01                   ` Roland Stigge
     [not found]             ` <4B868CC1.6030103@domain.hid>
2010-02-25 18:31               ` Stefan Kisdaroczi
2010-02-25 13:59           ` Jan Kiszka
2010-03-01 17:04     ` Gilles Chanteperdrix
2010-03-01 21:45       ` Roland Stigge
  -- strict thread matches above, loose matches on Subject: below --
2008-02-26  8:25 Roland Stigge
2008-02-26 10:26 ` Gilles Chanteperdrix
2008-02-26 10:43   ` Roland Stigge
2008-02-26 13:20     ` Gilles Chanteperdrix
2008-02-26 15:32       ` Roland Stigge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B87CE3E.2070402@domain.hid \
    --to=kisda@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.