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

Check_package () buggy? s/if `Chroot ...`/[ -n "`Chroot ...`"]



Third attempt..

On Tue, Jul 31, 2007 at 04:25:43PM -0400, Justin Pryzby wrote:
> On Tue, Jul 31, 2007 at 03:48:13PM -0400, Justin Pryzby wrote:
> > I got this message after removing some .stage/ stampfiles:
> > |/usr/share/live-helper/functions/packages.sh: line 21: Package:: command not found
> > 
> > Is this patch sane?
> > 
> > --- /tmp/packages.sh	2007-07-31 15:40:49.000000000 -0400

> Crap; the test was reversed.
> 
> --- /tmp/packages.sh	2007-07-31 15:40:49.000000000 -0400
> +++ /usr/share/live-helper/functions/packages.sh	2007-07-31 16:19:03.000000000 -0400
> @@ -18,7 +18,7 @@
>  		enabled)
>  			for ITEM in ${PACKAGE}
>  			do
> -				if ! `Chroot "dpkg-query -s ${ITEM}"`
> +				if [ -z "`Chroot "dpkg-query -s ${ITEM}"`" ]
>  				then
>  					PACKAGES="${PACKAGES} ${ITEM}"
>  				fi
> 
> (It should probably be `... 2>/dev/null`, too).
This last patch also doesn't work after removing some stampfiles since
purged packages (or removed but not purged or ...) are still in the
dpkg status database.  I'm using this instead which does what I want.

--- /tmp/packages.sh	2007-07-31 15:40:49.000000000 -0400
+++ /usr/share/live-helper/functions/packages.sh	2007-07-31 17:07:04.000000000 -0400
@@ -18,10 +18,9 @@
 		enabled)
 			for ITEM in ${PACKAGE}
 			do
-				if ! `Chroot "dpkg-query -s ${ITEM}"`
-				then
+				Chroot "dpkg-query -s ${ITEM}" |
+				grep -Fxe 'Status: install ok installed' ||
 					PACKAGES="${PACKAGES} ${ITEM}"
-				fi
 			done
 			;;
 



Reply to: