[d-i-commits] r32011 - in trunk/packages/rootskel: debian src/lib/debian-installer.d

Frans Pop fjp at costa.debian.org
Sun Nov 13 18:50:16 UTC 2005


Author: fjp
Date: 2005-11-13 18:50:15 +0000 (Sun, 13 Nov 2005)
New Revision: 32011

Modified:
   trunk/packages/rootskel/debian/changelog
   trunk/packages/rootskel/src/lib/debian-installer.d/S60frontend
Log:
In S60frontend only allow the gtk frontend if framebuffer is available
and the system has sufficient memory (for now: 92 MiB)


Modified: trunk/packages/rootskel/debian/changelog
===================================================================
--- trunk/packages/rootskel/debian/changelog	2005-11-13 18:33:53 UTC (rev 32010)
+++ trunk/packages/rootskel/debian/changelog	2005-11-13 18:50:15 UTC (rev 32011)
@@ -1,3 +1,10 @@
+rootskel (1.24) UNRELEASED; urgency=low
+
+  * In S60frontend only allow the gtk frontend if framebuffer is available
+    and the system has sufficient memory (for now: 92 MiB).
+
+ -- Frans Pop <fjp at debian.org>  Sun, 13 Nov 2005 19:41:52 +0100
+
 rootskel (1.23) unstable; urgency=low
 
   [ Joey Hess ]

Modified: trunk/packages/rootskel/src/lib/debian-installer.d/S60frontend
===================================================================
--- trunk/packages/rootskel/src/lib/debian-installer.d/S60frontend	2005-11-13 18:33:53 UTC (rev 32010)
+++ trunk/packages/rootskel/src/lib/debian-installer.d/S60frontend	2005-11-13 18:50:15 UTC (rev 32011)
@@ -1,6 +1,33 @@
+get_mem () {
+	ram=$(grep ^MemTotal: /proc/meminfo | { read x y z; echo $y; }) || true # in kilobytes
+	if [ "$ram" = "" ]; then
+		echo "Cannot determine system memory" >&2
+        	ram=0
+	else
+	        ram=$(expr "$ram" / 1024) # convert to megabytes
+	fi
+	echo $ram
+}
+
+check_gtk () {
+	if [ -z "$TERM_FRAMEBUFFER" ] ; then
+		echo "Framebuffer not available; disabling graphical frontend" >&2
+		return 1
+	fi
+	# 88MB = 92MiB
+	if [ $(get_mem) -lt 88 ] ; then
+		echo "Insufficient memory for graphical frontend; disabling" >&2
+		return 1
+	fi
+	return 0
+}
+
 if [ -z "$DEBIAN_FRONTEND" ] ; then
 	for frontend in gtk newt slang text ; do
 		if [ -e "/usr/lib/cdebconf/frontend/$frontend.so" ]; then
+			if [ "$frontend" = gtk ] ; then
+				check_gtk || continue
+			fi
 			DEBIAN_FRONTEND=$frontend
 			break
 		fi




More information about the d-i-commits mailing list