Hi,

As I think of this bug, configuration may have multipple entries now.
So attached script may be more robust.

You may add to README.Debian to run 
$ sudo dpkg-reconfigure tomoyo-tools

again to fix multiple GRUB entry problem by turnning off and
on this option.  (This only works with new script.)

New patch attached which use "g" option in sed script.

Osamu
diff -Nru tomoyo-tools-2.5.0-20130406.orig/debian/tomoyo-tools.postinst tomoyo-tools-2.5.0-20130406/debian/tomoyo-tools.postinst
--- tomoyo-tools-2.5.0-20130406.orig/debian/tomoyo-tools.postinst	2013-03-03 12:56:13.000000000 +0900
+++ tomoyo-tools-2.5.0-20130406/debian/tomoyo-tools.postinst	2013-11-01 00:52:11.094642529 +0900
@@ -30,11 +30,11 @@
 
         if [ -f $GRUBCONF ] && [ -x /usr/sbin/update-grub ]; then
             if [ $RET = true ]; then
-		if [ `grep "^GRUB_CMDLINE_LINUX=" $GRUBCONF` -a ! `grep "^GRUB_CMDLINE_LINUX=\"*security*\"" $GRUBCONF` ]; then
+		if [ `grep "^GRUB_CMDLINE_LINUX=" $GRUBCONF` -a ! `grep "^GRUB_CMDLINE_LINUX=\".*security=tomoyo.*\"" $GRUBCONF` ]; then
                     sed -e /^GRUB_CMDLINE_LINUX=\"/s/\"$/\ $FLAG\"/ -i $GRUBCONF && update-grub
 		fi
             elif [ $RET = false ]; then
-                sed -e /^GRUB_CMDLINE_LINUX/s/$FLAG// -i $GRUBCONF && update-grub
+                sed -e /^GRUB_CMDLINE_LINUX/s/$FLAG//g -i $GRUBCONF && update-grub
             fi
 	 else
 		 echo "no grub settings (it may have other bootloader, quit...)"
diff -Nru tomoyo-tools-2.5.0-20130406.orig/debian/tomoyo-tools.postrm tomoyo-tools-2.5.0-20130406/debian/tomoyo-tools.postrm
--- tomoyo-tools-2.5.0-20130406.orig/debian/tomoyo-tools.postrm	2012-06-15 09:25:39.000000000 +0900
+++ tomoyo-tools-2.5.0-20130406/debian/tomoyo-tools.postrm	2013-11-01 00:51:38.016135928 +0900
@@ -4,6 +4,8 @@
 
 CONFDIR="/etc/tomoyo"
 CONFFILES="domain_policy.conf exception_policy.conf manager.conf profile.conf meminfo.conf stat.conf"
+GRUBCONF="/etc/default/grub"
+FLAG="security=tomoyo"
 
 case "$1" in
     upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
@@ -11,8 +13,7 @@
 
     remove)
     if [ -f /etc/default/grub ] && [ -x /usr/sbin/update-grub ]; then
-      sed -e s/GRUB_CMDLINE_LINUX=\"security=tomoyo\"/GRUB_CMDLINE_LINUX=\"\"/ \
-	  -i /etc/default/grub && update-grub
+      sed -e /^GRUB_CMDLINE_LINUX/s/$FLAG//g -i $GRUBCONF && update-grub
     fi
     ;;
 
@@ -28,8 +29,7 @@
     fi
 
     if [ -f /etc/default/grub ] && [ -x /usr/sbin/update-grub ]; then
-      sed -e s/GRUB_CMDLINE_LINUX=\"security=tomoyo\"/GRUB_CMDLINE_LINUX=\"\"/ \
-	  -i /etc/default/grub && update-grub
+      sed -e /^GRUB_CMDLINE_LINUX/s/$FLAG//g -i $GRUBCONF && update-grub
     fi
     ;;
 

Reply via email to