livecd: remaster/livecd_gen_initrd, remaster/livecd_gen_iso, remas...

havner havner at pld-linux.org
Sat Jul 22 01:24:44 CEST 2006


Author: havner                       Date: Fri Jul 21 23:24:44 2006 GMT
Module: livecd                        Tag: HEAD
---- Log message:
- more options, nicer output
- livecd_create merged with livecd_gen_iso

---- Files affected:
livecd/remaster:
   livecd_gen_initrd (1.17 -> 1.18) , livecd_gen_iso (1.26 -> 1.27) , livecd_create (1.5 -> NONE)  (REMOVED)

---- Diffs:

================================================================
Index: livecd/remaster/livecd_gen_initrd
diff -u livecd/remaster/livecd_gen_initrd:1.17 livecd/remaster/livecd_gen_initrd:1.18
--- livecd/remaster/livecd_gen_initrd:1.17	Wed Jul 12 14:11:38 2006
+++ livecd/remaster/livecd_gen_initrd	Sat Jul 22 01:24:38 2006
@@ -8,11 +8,13 @@
 
 check_root
 load_config
-check_deps initrd-busybox genromfs /usr/share/pci-database/ide.pci /boot/memtest86+ /usr/lib/syslinux/isolinux.bin
+check_deps /usr/share/pci-database/ide.pci /boot/memtest86+ /usr/lib/syslinux/isolinux.bin splash.bin
+check_deps_local busybox genromfs
 
 cd $INITRD/lib/modules
-
-run_cmd "Purging old kernel stuff" rm -rf *
+show "Purging old kernel stuff"; busy
+rm -rf 2*
+ok
 
 show "Preparing new directory tree"; busy
 if rpm --root $ROOTFS -q kernel-grsecurity > /dev/null; then
@@ -25,6 +27,7 @@
 	exit 1
 fi
 VR=`rpm --root $ROOTFS --qf "%{VERSION}-%{RELEASE}" -q $KERNEL`
+cd $INITRD/lib/modules
 mkdir -p $VR/kernel
 cd $VR/kernel
 for i in $INITRD_MODULES; do 
@@ -53,7 +56,7 @@
 ok
 
 show "Generating initrd"; busy
-rm -rf $CD/boot/initrd.gz
+rm -f $CD/boot/initrd.gz
 genromfs -f $CD/boot/initrd -d $INITRD -V "LiveCD initrd" || (fail; exit 1)
 busybox gzip $CD/boot/initrd || (fail; exit 1)
 # bootsplash
@@ -61,16 +64,14 @@
 	. $ROOTFS/etc/sysconfig/bootsplash
 fi
 if [ "$BOOT_SPLASH" = "yes" ]; then
-	if [ ! -x /bin/splash.bin ]; then
-		echo "Failed to execute /bin/splash.bin. Is bootsplash package installed?" 1>&2
-	elif [ -z "$THEME" ]; then
+	if [ -z "$THEME" ]; then
 		echo "Please configure your /etc/sysconfig/bootsplash first." 1>&2
 		echo "Generating bootsplashes skipped." 1>&2
 	else
 		if [ -n "$BOOT_SPLASH_RESOLUTIONS" ]; then
 			for res in $BOOT_SPLASH_RESOLUTIONS; do
 				if [ -f "$ROOTFS/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" ]; then
-					/bin/splash.bin -s -f "$ROOTFS/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" >> $CD/boot/initrd.gz && \
+					$ROOTFS/bin/splash.bin -s -f "$ROOTFS/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" >> $CD/boot/initrd.gz && \
 					[ -n "$verbose" ] && echo "Added $res $THEME theme to initrd."
 				else
 					echo "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg doesn't exist, skipped" 1>&2

================================================================
Index: livecd/remaster/livecd_gen_iso
diff -u livecd/remaster/livecd_gen_iso:1.26 livecd/remaster/livecd_gen_iso:1.27
--- livecd/remaster/livecd_gen_iso:1.26	Wed Jul 12 14:11:38 2006
+++ livecd/remaster/livecd_gen_iso	Sat Jul 22 01:24:38 2006
@@ -2,16 +2,21 @@
 # Lukasz Pawelczyk <havner at pld-linux.org> 2004
 # $Id$
 
+# TODO: locales remove, GL
+
 # Source function library
 . /etc/rc.d/init.d/functions
 . /etc/rc.d/init.d/functions-live
 
 # parameters variables (can be added to ~/.livecd_remaster)
+POLDEK_OPTS=
+
 NOSQUASHFS=
-LOCALES_UPDATE=
-SYMLINKS=
-INITRD=
+FORCE_LOCALES_UPDATE=
+FORCE_INITRD=
+FORCE_ROOTPASS=
 ISO_ONLY=
+LEAVE_DOCS=
 
 check_root
 load_config
@@ -19,26 +24,31 @@
 
 usage() {
 	echo "--nosquashfs, -ns		- dont recreate squashfs"
-	echo "--locales-update, -lu	- update locales inside rootfs (localedb)"
-	echo "--symlinks, -s		- update livecd symlinks"
-	echo "--initrd, -i		- update inirtd (through livecd_gen_initrd)"
-	echo "--iso-only, -io		- only create livecd.iso"
+	echo "--locales-update, -lu	- force updating locales inside rootfs (localedb)"
+	echo "--initrd, -i		- force updating initrd (through livecd_gen_initrd)"
+	echo "--change-root-pass, -cr	- force changing livecd root password"
+#	echo "--iso-only, -io		- only create livecd.iso"
+	echo "--leave-docs, -ld		- dont remove /usr/share/doc/* and /usr/src/examples/*"
 }
 
 while [ "$#" -gt "0" ]; do
 	case "$1" in
 		--nosquash | -ns )
-		NOSQUASHFS=yes
-		shift
-		;;
+			NOSQUASHFS=yes; shift ;;
+		--locales-update | -lu )
+			FORCE_LOCALES_UPDATE=yes; shift ;;
+		--initrd | -i )
+			FORCE_INITRD=yes; shift ;;
+		--change-root-pass | -cr )
+			FORCE_ROOTPASS=yes; shift ;;
+		--iso-only | -io )
+			ISO_ONLY=yes; shift ;;
+		--leave-docs | -ld )
+			LEAVE_DOCS=yes; shift ;;
 		--help )
-		usage
-		exit 1
-		;;
+			usage; exit 1 ;;
 		* )
-		echo "Unknown parameter"
-		exit 1
-		;;
+			echo "Unknown parameter"; exit 1 ;;
 	esac
 done
 
@@ -57,26 +67,100 @@
 mv $SQUASHFS/* $ROOTFS/live/
 
 rmdir $SQUASHFS
+}
 
+sigint_action() {
+fix_dirs
 echo -e "\nInterrupted, exiting..."
-
 exit 1
 }
 
-# preparation, external scripts
+# try to fix directory structure
+[ -d $SQUASHFS ] && (fix_dirs || exit 1)
 
-if [ ! -f $CD/boot/initrd.gz -o "$INITRD" = "yes" ]; then
+# preparation, external scripts
+if [ ! -f $CD/boot/initrd.gz -o "$FORCE_INITRD" = "yes" ]; then
 	livecd_gen_initrd || exit 1
 fi
 
-if [ -x $ROOTFS/usr/local/bin/fix_live ]; then
-	run_cmd "Running fix_live" chroot $ROOTFS /usr/local/bin/fix_live || exit 1
+if [ ! -f $ROOTFS/usr/lib/locale/locale-archive -o "$FORCE_LOCALES_UPDATE" = "yes" ]; then
+	show "Generating locales"; busy
+	poldek $POLDEK_OPTS --root=$ROOTFS --install localedb-src || (fail; exit 1)
+	chroot $ROOTFS localedb-gen || (fail; exit 1)
+	rpm --root $ROOTFS -e localedb-src || (fail; exit 1)
+	ok
+fi
+
+if [ -f $ROOTFS/etc/shadow ]; then
+	grep "^root::" $ROOTFS/etc/shadow && NOROOTPASS=yes
+else
+	grep "^root::" $ROOTFS/etc/passwd && NOROOTPASS=yes
 fi
+if [ "$NOROOTPASS" = "yes" -o "$FORCE_ROOTPASS" = "yes" ]; then
+	show "Set livecd root password"; busy
+	echo -en "\nNew password: "
+	read ROOTPASS
+	echo "root:$ROOTPASS" | chroot $ROOTFS chpasswd
+	ok
+fi
+
+show "Creating LiveCD symlinks"; busy
+cd $ROOTFS
+for I in $SYMLINKS; do
+	if [ -e "./$I" -a ! -h "./$I" -a ! -f "live/$I" ]; then
+		DIR=`dirname $I`
+		#FILE=`basename $I`
+		DEEP=`echo $DIR | sed "s/[^\/]//g" | wc -c`
+		mkdir -p "live/$DIR"
+		mv "./$I" "live/$DIR"
+		RECURSE=""
+		while [ "$((--DEEP))" != "0" ]; do
+			RECURSE="../$RECURSE"
+		done
+		ln -s "${RECURSE}live/${I}" "./$I"
+	fi
+done
+ok
 
-trap fix_dirs INT
+if [ ! "$LEAVE_DOCS" = "yes" ]; then
+	show "Clearing /usr/share/doc and /usr/src/examples"; busy
+	rm -rf $ROOTFS/usr/share/doc/*
+	rm -rf $ROOTFS/usr/src/examples/*
+	ok
+fi
 
-# try to fix directory structure
-[ -d $SQUASHFS ] && (run_cmd "Fixing directory structure" fix_dirs || exit 1)
+#if [ -x $ROOTFS/usr/local/bin/fix_live ]; then
+show "Running several rootfs fixes"; busy
+cat > $ROOTFS/tmp/fix_users << EOF
+#!/bin/sh
+for U in \`ls /home/users\`; do
+	for F in \`ls -A /etc/skel\`; do
+		[ -f /home/users/\$U/\$F ] || cp -r /etc/skel/\$F /home/users/\$U/
+	done
+	chown -R \$U:users /home/users/\$U
+done
+
+for F in \`ls -A /etc/skel\`; do
+	[ -f /root/\$F ] || cp -r /etc/skel/\$F /root
+done
+chown -R root:root /root
+EOF
+chmod 755 $ROOTFS/tmp/fix_users
+chroot $ROOTFS /tmp/fix_users
+rm -f $ROOTFS/tmp/fix_users
+
+chroot $ROOTFS ldconfig
+if [ -x "$ROOTFS/etc/rc.d/init.d/vfmg" ]; then
+	chroot $ROOTFS /etc/rc.d/init.d/vfmg start >/dev/null 2>&1
+	chroot $ROOTFS chkconfig --level 35 vfmg off
+fi
+rm -f $ROOTFS/var/lib/rpm/__db*
+rm -f $ROOTFS/boot/*.old
+rm -f $ROOTFS/boot/initrd*
+ok
+#fi
+
+trap sigint_action INT
 
 mkdir $SQUASHFS
 
@@ -109,20 +193,7 @@
 	ok
 fi
 
-rmdir $ROOTFS/bin
-rmdir $ROOTFS/sbin
-rmdir $ROOTFS/lib
-rmdir $ROOTFS/usr
-rmdir $ROOTFS/boot
-
-mv $SQUASHFS/bin-bind $ROOTFS/bin
-mv $SQUASHFS/sbin-bind $ROOTFS/sbin
-mv $SQUASHFS/lib-bind $ROOTFS/lib
-mv $SQUASHFS/usr-bind $ROOTFS/usr
-mv $SQUASHFS/boot-bind $ROOTFS/boot
-mv $SQUASHFS/* $ROOTFS/live/
-
-rmdir $SQUASHFS
+fix_dirs
 
 trap - INT
  
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/livecd/remaster/livecd_gen_initrd?r1=1.17&r2=1.18&f=u
    http://cvs.pld-linux.org/livecd/remaster/livecd_gen_iso?r1=1.26&r2=1.27&f=u



More information about the pld-cvs-commit mailing list