r2634 - in dists/trunk/live-helper: functions helpers

matth-guest at alioth.debian.org matth-guest at alioth.debian.org
Sun Jul 29 16:51:36 UTC 2007


Author: matth-guest
Date: 2007-07-29 16:51:36 +0000 (Sun, 29 Jul 2007)
New Revision: 2634

Modified:
   dists/trunk/live-helper/functions/packages.sh
   dists/trunk/live-helper/helpers/lh_chroot_localization
Log:
adds Check_installed to check if a package is already installed and implement
the idea by fixing the use of Check_package in lh_chroot_localization


Modified: dists/trunk/live-helper/functions/packages.sh
===================================================================
--- dists/trunk/live-helper/functions/packages.sh	2007-07-29 15:42:20 UTC (rev 2633)
+++ dists/trunk/live-helper/functions/packages.sh	2007-07-29 16:51:36 UTC (rev 2634)
@@ -11,41 +11,19 @@
 
 Check_package ()
 {
-	FILE="${1}"
+ 	FILE="${1}"
 	PACKAGE="${2}"
 
-	case "${LIVE_CHROOT_BUILD}" in
-		enabled)
-			for ITEM in ${PACKAGE}
-			do
-				if ! `Chroot "dpkg-query -s ${ITEM}"`
-				then
-					PACKAGES="${PACKAGES} ${ITEM}"
-				fi
-			done
-			;;
+	Check_installed "${FILE}" "${PACKAGE}"
 
-		disabled)
-			if `which dpkg-query`
-			then
-				for ITEM in ${PACKAGE}
-				do
-					if ! `dpkg-query -s ${ITEM}`
-					then
-						PACKAGES="${PACKAGES} ${ITEM}"
-					fi
-				done
-			else
-				FILE="`echo ${FILE} | sed -e 's/chroot//'`"
-
-				if [ ! -f "${FILE}" ] && [ ! -d "${FILE}" ]
-				then
-					Echo_error "You need to install ${PACKAGE} on your host system."
-					exit 1
-				fi
-			fi
-			;;
-	esac
+	if [ ${INSTALL_STATUS} -eq 1 ]
+	then
+		PACKAGES="${PACKAGES} ${PACKAGE}"
+	elif [ ${INSTALL_STATUS} -eq 2 ]
+	then
+		Echo_error "You need to install ${PACKAGE} on your host system."
+		exit 1
+	fi
 }
 
 Install_package ()
@@ -79,3 +57,46 @@
 		esac
 	fi
 }
+
+# Check_installed
+# uses as return value global var INSTALL_STATUS
+# INSTALL_STATUS : 0 if package is installed
+#                  1 if package isn't installed and we're in an apt managed system
+#                  2 if package isn't installed and we aren't in an apt managed system
+Check_installed ()
+{
+	FILE="${1}"
+    	PACKAGE="${2}"
+	echo "### DEBUG ###"
+    	case "${LIVE_CHROOT_BUILD}" in
+		enabled)
+			if Chroot "dpkg-query -s ${PACKAGE}" > /dev/null 2>&1
+			then
+				INSTALL_STATUS=0
+			else
+				INSTALL_STATUS=1
+			fi
+			;;
+		disabled)
+			if which dpkg-query > /dev/null 2>&1
+			then
+				if Chroot "dpkg-query -s ${PACKAGE}" > /dev/null 2>&1
+				then
+					INSTALL_STATUS=0
+				else
+					INSTALL_STATUS=1
+				fi
+			else
+				FILE="`echo ${FILE} | sed -e 's/chroot//'`"
+
+				if [ ! -f "${FILE}" ]
+				then
+					INSTALL_STATUS=2
+				else
+					INSTALL_STATUS=0
+				fi
+			fi
+			;;
+	esac
+}
+

Modified: dists/trunk/live-helper/helpers/lh_chroot_localization
===================================================================
--- dists/trunk/live-helper/helpers/lh_chroot_localization	2007-07-29 15:42:20 UTC (rev 2633)
+++ dists/trunk/live-helper/helpers/lh_chroot_localization	2007-07-29 16:51:36 UTC (rev 2634)
@@ -613,33 +613,33 @@
 	do
 		case "${LOCALIZATION}" in
 			iceape)
-				Check_package chroot/usr/bin/iceape iceweasel-l10n-"${ICEAPE}"
+				Check_installed chroot/usr/bin/iceape iceape || Check_package iceweasel-l10n-"${ICEAPE}"
 				;;
 
 			icedove)
-				Check_package chroot/usr/bin/icedove icedove-locale-"${ICEDOVE}"
+				Check_installed chroot/usr/bin/icedove icedove || Check_package icedove-locale-"${ICEDOVE}"
 				;;
 
 			iceweasel)
-				Check_package chroot/usr/bin/iceweasel iceweasel-l10n-"${ICEWEASEL}"
+				Check_installed chroot/usr/bin/iceweasel iceweasel || Check_package iceweasel-l10n-"${ICEWEASEL}" 
 				;;
 
 			kde)
-				Check_package chroot/usr/bin/kstart kde-i18n-"${KDE}"
+				Check_installed chroot/usr/bin/kstart kdebase-bin || Check_package kde-i18n-"${KDE}" 
 				;;
 
 			koffice)
-				Check_package chroot/usr/bin/usr/bin/koconverter koffice-i18n-"${KOFFICE}"
+				Check_installed chroot/usr/bin/koconverter koffice || Check_package koffice-i18n-"${KOFFICE}"
 				;;
 
 			openoffice)
-				Check_package chroot/usr/bin/ooffice openoffice.org-l10n-"${OPENOFFICE}"
+				Check_installed chroot/usr/bin/ooffice openoffice.org-common || Check_package openoffice.org-l10n-"${OPENOFFICE}" 
 				;;
 		esac
 	done
 
-	Check_package chroot/usr/bin/gwenview gwenview-i18n
-	Check_package chroot/usr/bin/k3b k3b-i18n
+	Check_installed chroot/usr/bin/gwenview gwenview || Check_package gwenview-i18n 
+	Check_installed chroot/usr/bin/k3b k3b || Check_package k3b-i18n
 
 	# Restoring cache
 	Restore_cache cache/packages_localization




More information about the debian-live-changes mailing list