Handle previously installed dpkgs

Checking return code of dpkg --status doesn't handle removed files
properly. Get the text status of the package instead and make sure
that it is 'installed'.

http://bugzilla.gnome.org/show_bug.cgi?id=577456
This commit is contained in:
Owen W. Taylor 2009-04-01 16:56:50 -04:00
parent a074ef5d7c
commit 7995f75cfb

View File

@ -41,6 +41,20 @@ fi
# when running in Xephyr mode, and we should probably change it to use # when running in Xephyr mode, and we should probably change it to use
# less lame things. # less lame things.
# Can this be simplified? Obvious ways don't handle handle packages
# that have been installed then removed. ('purged' status, e.g.)
dpkg_is_installed() {
status=`dpkg-query --show --showformat='${Status}' $1 2>/dev/null`
if [ $? = 0 ] ; then
set $status
if [ "$3" = installed ] ; then
return 0
fi
fi
return 1
}
if test x$system = xUbuntu -o x$system = xDebian ; then if test x$system = xUbuntu -o x$system = xDebian ; then
reqd="" reqd=""
for pkg in \ for pkg in \
@ -50,7 +64,7 @@ if test x$system = xUbuntu -o x$system = xDebian ; then
libgnomeui-dev librsvg2-dev libwnck-dev libgl1-mesa-dev \ libgnomeui-dev librsvg2-dev libwnck-dev libgl1-mesa-dev \
mesa-common-dev python2.5-dev libreadline5-dev xulrunner-1.9-dev \ mesa-common-dev python2.5-dev libreadline5-dev xulrunner-1.9-dev \
; do ; do
if ! dpkg --status $pkg > /dev/null 2>&1; then if ! dpkg_is_installed $pkg; then
reqd="$pkg $reqd" reqd="$pkg $reqd"
fi fi
done done