livecd: remaster/livecd_gen_initrd, remaster/livecd_gen_iso - use ...

havner havner at pld-linux.org
Wed Jul 12 14:11:43 CEST 2006


Author: havner                       Date: Wed Jul 12 12:11:43 2006 GMT
Module: livecd                        Tag: HEAD
---- Log message:
- use show/run_cmd from pld functions
- clean output

---- Files affected:
livecd/remaster:
   livecd_gen_initrd (1.16 -> 1.17) , livecd_gen_iso (1.25 -> 1.26) 

---- Diffs:

================================================================
Index: livecd/remaster/livecd_gen_initrd
diff -u livecd/remaster/livecd_gen_initrd:1.16 livecd/remaster/livecd_gen_initrd:1.17
--- livecd/remaster/livecd_gen_initrd:1.16	Wed Jul 12 12:53:08 2006
+++ livecd/remaster/livecd_gen_initrd	Wed Jul 12 14:11:38 2006
@@ -3,6 +3,7 @@
 # Lukasz Pawelczyk <havner at pld-linux.org> 2005
 # $Id$
 
+. /etc/rc.d/init.d/functions
 . /etc/rc.d/init.d/functions-live
 
 check_root
@@ -11,17 +12,16 @@
 
 cd $INITRD/lib/modules
 
-echo -n "Purging old kernel stuff... "
-rm -rf *
-echo done
+run_cmd "Purging old kernel stuff" rm -rf *
 
-echo -n "Preparing new directory tree... "
+show "Preparing new directory tree"; busy
 if rpm --root $ROOTFS -q kernel-grsecurity > /dev/null; then
 	KERNEL=kernel-grsecurity
 elif rpm --root $ROOTFS -q kernel > /dev/null; then
 	KERNEL=kernel
 else
 	echo -e "\nThere is no kernel installed in $ROOTFS"
+	fail
 	exit 1
 fi
 VR=`rpm --root $ROOTFS --qf "%{VERSION}-%{RELEASE}" -q $KERNEL`
@@ -30,36 +30,32 @@
 for i in $INITRD_MODULES; do 
 	mkdir -p `dirname "$i"`;
 done
-echo done
+ok
 
-echo -n "Copying kernel modules... "
+show "Copying kernel modules"; busy
 for i in $INITRD_MODULES; do
 	cp -r $ROOTFS/lib/modules/$VR/kernel/$i `dirname "$i"`;
 done
 find . -name "*.gz" | xargs gunzip
-echo done
+ok
 
-echo -n "Calculating dependencies... "
-depmod -a -b $INITRD -F $ROOTFS/boot/System.map $VR
-echo done
+run_cmd "Calculating dependencies" depmod -a -b $INITRD -F $ROOTFS/boot/System.map $VR
 
-echo -n "Copying kernel/memtest/isolinux images... "
+show "Copying kernel/memtest/isolinux images"; busy
 cp -f $ROOTFS/boot/vmlinuz $CD/boot
 cp -f $ROOTFS/boot/memtest86+ $CD/boot/memtest
 cp -f $ROOTFS/usr/lib/syslinux/isolinux.bin $CD/boot/isolinux/
-echo done
+ok
 
-echo -n "Copying pci-database files... "
+show "Copying pci-database files"; busy
 rm -f $INITRD/pci/*
 cp -f $ROOTS/usr/share/pci-database/ide.pci $ROOTS/usr/share/pci-database/scsi.pci $ROOTS/usr/share/pci-database/sata.pci $INITRD/pci
-echo done
+ok
 
-echo -n "Generating initrd... "
+show "Generating initrd"; busy
 rm -rf $CD/boot/initrd.gz
-genromfs -f $CD/boot/initrd -d $INITRD -V "LiveCD initrd"
-[ "$?" != 0 ] && echo fail && exit 1
-busybox gzip $CD/boot/initrd
-[ "$?" != 0 ] && echo fail && exit 1
+genromfs -f $CD/boot/initrd -d $INITRD -V "LiveCD initrd" || (fail; exit 1)
+busybox gzip $CD/boot/initrd || (fail; exit 1)
 # bootsplash
 if [ -r $ROOTFS/etc/sysconfig/bootsplash ] ; then
 	. $ROOTFS/etc/sysconfig/bootsplash
@@ -86,5 +82,4 @@
 		fi
 	fi
 fi
-
-echo done
+ok

================================================================
Index: livecd/remaster/livecd_gen_iso
diff -u livecd/remaster/livecd_gen_iso:1.25 livecd/remaster/livecd_gen_iso:1.26
--- livecd/remaster/livecd_gen_iso:1.25	Wed Jul 12 13:09:45 2006
+++ livecd/remaster/livecd_gen_iso	Wed Jul 12 14:11:38 2006
@@ -3,12 +3,15 @@
 # $Id$
 
 # Source function library
+. /etc/rc.d/init.d/functions
 . /etc/rc.d/init.d/functions-live
 
 # parameters variables (can be added to ~/.livecd_remaster)
 NOSQUASHFS=
 LOCALES_UPDATE=
 SYMLINKS=
+INITRD=
+ISO_ONLY=
 
 check_root
 load_config
@@ -18,6 +21,8 @@
 	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"
 }
 
 while [ "$#" -gt "0" ]; do
@@ -38,11 +43,11 @@
 done
 
 fix_dirs() {
-rmdir $ROOTFS/bin 
-rmdir $ROOTFS/sbin 
-rmdir $ROOTFS/lib 
-rmdir $ROOTFS/usr 
-rmdir $ROOTFS/boot 
+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
@@ -52,33 +57,28 @@
 mv $SQUASHFS/* $ROOTFS/live/
 
 rmdir $SQUASHFS
-}
 
+echo -e "\nInterrupted, exiting..."
+
+exit 1
+}
 
 # preparation, external scripts
 
-#echo "Running livecd_gen_initrd to prepare/fix livecd internal initrd."
-#if [ ! -x "`which livecd_gen_initrd`" ]; then
-#	echo "There is no livecd_gen_initrd script."
-#	exit 1
-#fi
-#if ! livecd_gen_initrd; then
-#	echo "Initrd preparation script failed."
-#	exit 1
-#fi
+if [ ! -f $CD/boot/initrd.gz -o "$INITRD" = "yes" ]; then
+	livecd_gen_initrd || exit 1
+fi
 
 if [ -x $ROOTFS/usr/local/bin/fix_live ]; then
-	echo -n "Running fix_live... "
-	chroot $ROOTFS /usr/local/bin/fix_live
-	echo done
+	run_cmd "Running fix_live" chroot $ROOTFS /usr/local/bin/fix_live || exit 1
 fi
 
 trap fix_dirs INT
 
 # try to fix directory structure
-if ! mkdir $SQUASHFS; then
-	fix_dirs
-fi
+[ -d $SQUASHFS ] && (run_cmd "Fixing directory structure" fix_dirs || exit 1)
+
+mkdir $SQUASHFS
 
 mv $ROOTFS/bin $SQUASHFS/bin-bind
 mv $ROOTFS/sbin $SQUASHFS/sbin-bind
@@ -93,29 +93,27 @@
 mkdir $ROOTFS/usr
 mkdir $ROOTFS/boot
  
-echo -n "Generating ramdisk.tgz... "
+show "Generating ramdisk.tgz"; busy
 rm -f $CD/ramdisk.tgz
 cd $ROOTFS
-busybox tar -czf $CD/ramdisk.tgz *
-[ "$?" != 0 ] && echo fail && exit 1
-echo done
+busybox tar -czf $CD/ramdisk.tgz * || (fail; exit 1)
+ok
 
 if [ ! "$NOSQUASHFS" = "yes" ]; then
-	echo "Generating squashfs... "
+	show "Generating squashfs"; busy
 	rm -f $CD/squashfs
-	mksquashfs $SQUASHFS/ $CD/squashfs #-info
-	[ "$?" != 0 ] && echo fail && exit 1
+	mksquashfs $SQUASHFS/ $CD/squashfs >/dev/null || (fail; exit 1)
 	chmod 644 $CD/squashfs
 	cd $CD
 	md5sum squashfs > $CD/squashfs.md5
-	echo done
+	ok
 fi
 
-rmdir $ROOTFS/bin 
-rmdir $ROOTFS/sbin 
-rmdir $ROOTFS/lib 
-rmdir $ROOTFS/usr 
-rmdir $ROOTFS/boot 
+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
@@ -128,11 +126,10 @@
 
 trap - INT
  
-echo "Generating livecd.iso... "
+show "Generating livecd.iso"; busy
 rm -f $MAINDIR/livecd.iso
 cd $CD
 mkisofs -J -R -V "$LIVECD_VERSION" -o $ISODIR/livecd.iso \
 -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
--no-emul-boot -boot-load-size 4 -boot-info-table .
-[ "$?" != 0 ] && echo fail && exit 1
-echo done
+-no-emul-boot -boot-load-size 4 -boot-info-table -quiet . || (fail; exit 1)
+ok
================================================================

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



More information about the pld-cvs-commit mailing list