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
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
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core