SVN: geninitrd/trunk: Makefile geninitrd mod-fbsplash.sh

glen glen at pld-linux.org
Fri Apr 3 00:49:35 CEST 2009


Author: glen
Date: Fri Apr  3 00:49:35 2009
New Revision: 10289

Added:
   geninitrd/trunk/mod-fbsplash.sh
Modified:
   geninitrd/trunk/Makefile
   geninitrd/trunk/geninitrd
Log:
- fbsplash modularized

Modified: geninitrd/trunk/Makefile
==============================================================================
--- geninitrd/trunk/Makefile	(original)
+++ geninitrd/trunk/Makefile	Fri Apr  3 00:49:35 2009
@@ -1,6 +1,6 @@
 # when making release, make sure you do it as RELEASE document describes
 VERSION		:= 10000.3
-MODS		:= ide luks multipath dmraid lvm md blkid udev tuxonice suspend
+MODS		:= ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash
 FILES_MODS  := $(MODS:%=mod-%.sh)
 FILES		:= Makefile geninitrd.sysconfig geninitrd functions $(FILES_MODS) geninitrd.8 geninitrd.8.xml ChangeLog
 prefix		:= /usr

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Fri Apr  3 00:49:35 2009
@@ -34,8 +34,6 @@
 # requires bootsplash package to operate
 BOOT_SPLASH=no
 # requires splashutils package to operate
-FB_SPLASH=no
-# requires splashutils package to operate
 FB_CON_DECOR=no
 
 # internal variables
@@ -741,42 +739,6 @@
 	done
 }
 
-initrd_gen_fbsplash() {
-	debug "Generating fbsplash"
-
-	if [ ! -x /usr/bin/splash_geninitramfs -a ! -x /usr/sbin/splash_geninitramfs ]; then
-		warn "Failed to find splash_geninitramfs. Is splashutils package installed?"
-		return
-	fi
-	splash_geninitramfs_bin=/usr/sbin/splash_geninitramfs
-	[ -f /usr/bin/splash_geninitramfs ] && splash_geninitramfs_bin=/usr/bin/splash_geninitramfs
-
-	if [ -r /etc/sysconfig/fbsplash ]; then
-		. /etc/sysconfig/fbsplash
-	fi
-
-	if [ -z "$SPLASH_THEME" ]; then
-		warn "Please configure your /etc/sysconfig/fbsplash first."
-		warn "Generating fbsplashes skipped."
-		return
-	fi
-
-	if [ -z "$FB_SPLASH_RESOLUTIONS" ]; then
-		warn "No FB_SPLASH_RESOLUTIONS specified in /etc/sysconfig/fbsplash."
-		warn "Not adding fbsplash to initramfs."
-		return
-	fi
-
-	for res in $FB_SPLASH_RESOLUTIONS; do
-		if [ -f "/etc/splash/$SPLASH_THEME/$res.cfg" ]; then
-			$splash_geninitramfs_bin -c $DESTDIR -r $res $SPLASH_THEME && \
-			debug "Added $res $SPLASH_THEME theme to initramfs."
-		else
-			warn "/etc/splash/$SPLASH_THEME/$res.cfg doesn't exist, skipped"
-		fi
-	done
-}
-
 initrd_gen_fbcondecor() {
 	debug "Generating fbcondecor"
 
@@ -1224,10 +1186,6 @@
 fi
 
 if [ "$INITRDFS" != "initramfs" ]; then
-	if is_yes "$FB_SPLASH"; then
-		warn "Using fbsplash requires INITRDFS=initramfs; skipping fbsplash generation"
-		FB_SPLASH=no
-	fi
 	if is_yes "$FB_CON_DECOR"; then
 		warn "Using fbcondecor requires INITRDFS=initramfs; skipping fbcondecor generation"
 		FB_CON_DECOR=no
@@ -1276,9 +1234,7 @@
 	find_module "-lzf"
 fi
 
-if is_yes "$FB_SPLASH"; then
-	find_module "-evdev"
-fi
+find_modules_fbsplash
 
 if [ -n "$ifneeded" -a -z "$MODULES" ]; then
 	debug "No modules are needed -- not building initrd image."

Added: geninitrd/trunk/mod-fbsplash.sh
==============================================================================
--- (empty file)
+++ geninitrd/trunk/mod-fbsplash.sh	Fri Apr  3 00:49:35 2009
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# geninitrd mod: fbsplash
+
+# requires splashutils package to operate
+FB_SPLASH=no
+
+# setup geninitrd module
+# @access	public
+setup_mod_fbsplash() {
+	if is_yes "$FB_SPLASH" && [ "$INITRDFS" != "initramfs" ]; then
+		warn "Using fbsplash requires INITRDFS=initramfs; skipping fbsplash generation"
+		FB_SPLASH=no
+	fi
+
+	# NOTE: this check must be also in bootsplash module as the order of module load may change
+	if is_yes "$FB_SPLASH"  && is_yes "$BOOT_SPLASH"; then
+		warn "bootsplash and fbsplash are exclusive!"
+	fi
+}
+
+# find modules for for fbsplash
+# @access	public
+find_modules_fbsplash() {
+	if ! is_yes "$FB_SPLASH"; then
+		return
+	fi
+
+	find_module "-evdev"
+}
+
+# generate initrd fragment
+# @access	public
+initrd_gen_fbsplash() {
+	debug "Generating fbsplash"
+
+	if [ ! -x /usr/bin/splash_geninitramfs -a ! -x /usr/sbin/splash_geninitramfs ]; then
+		warn "Failed to find splash_geninitramfs. Is splashutils package installed?"
+		return
+	fi
+	local splash_geninitramfs_bin=/usr/sbin/splash_geninitramfs
+	[ -f /usr/bin/splash_geninitramfs ] && splash_geninitramfs_bin=/usr/bin/splash_geninitramfs
+
+	if [ -r /etc/sysconfig/fbsplash ]; then
+		. /etc/sysconfig/fbsplash
+	fi
+
+	if [ -z "$SPLASH_THEME" ]; then
+		warn "Please configure your /etc/sysconfig/fbsplash first."
+		warn "Generating fbsplashes skipped."
+		return
+	fi
+
+	if [ -z "$FB_SPLASH_RESOLUTIONS" ]; then
+		warn "No FB_SPLASH_RESOLUTIONS specified in /etc/sysconfig/fbsplash."
+		warn "Not adding fbsplash to initramfs."
+		return
+	fi
+
+	for res in $FB_SPLASH_RESOLUTIONS; do
+		if [ -f "/etc/splash/$SPLASH_THEME/$res.cfg" ]; then
+			$splash_geninitramfs_bin -c $DESTDIR -r $res $SPLASH_THEME && \
+			debug "Added $res $SPLASH_THEME theme to initramfs."
+		else
+			warn "/etc/splash/$SPLASH_THEME/$res.cfg doesn't exist, skipped"
+		fi
+	done
+}


More information about the pld-cvs-commit mailing list