Update of /cvsroot/devil-linux/build/config/etc/initrd
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv681
Modified Files:
mount_cdrom
Log Message:
- one more step to squashfs'ed image support
Index: mount_cdrom
===================================================================
RCS file: /cvsroot/devil-linux/build/config/etc/initrd/mount_cdrom,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- mount_cdrom 7 Jan 2009 06:37:14 -0000 1.46
+++ mount_cdrom 23 Jan 2009 01:55:59 -0000 1.47
@@ -131,8 +131,6 @@
## FIXME
# we should probably define these somewhere more central
local RAMDISK=/shm/sys # this has to be under /shm as this one is mount moved in linuxrc
- local FILEMOUNT=/cd
- local ISOFILE=bootcd.iso
# show that we are configured to run from ram
$YELLOW; echo 'System is configured to run from ram'; $NORMAL
@@ -141,7 +139,7 @@
# get size of image so we can estimate the needed ramdisk space
case ${MEDIATYPE} in
CDROM ) IMAGE_SIZE=$(df ${mountpoint} | grep "${mountpoint}" | awk '{print $(NF-4)}');;
- FILE ) IMAGE_SIZE=$(du -k ${FILEMOUNT}/${ISOFILE} | awk '{print $1}');;
+ FILE ) IMAGE_SIZE=$(du -k ${FILEMOUNT}/${IMAGE} | awk '{print $1}');;
esac
let IMAGE_SIZE_MB=IMAGE_SIZE*10/1024+5 # do correct rounding
let IMAGE_SIZE_MB=IMAGE_SIZE_MB/10
@@ -161,7 +159,7 @@
dd if=$disk of=${RAMDISK}/${ISOFILE} bs=2048 >/dev/null 2>&1 || COPY2RAM='fail'
;;
FILE ) # it's a file so copy will do
- cp ${FILEMOUNT}/${ISOFILE} ${RAMDISK}/${ISOFILE} >/dev/null 2>&1 || COPY2RAM='fail'
+ cp ${FILEMOUNT}/${IMAGE} ${RAMDISK}/${IMAGE} >/dev/null 2>&1 || COPY2RAM='fail'
;;
esac
busy_stop
@@ -180,7 +178,7 @@
# check if ramdisk is full, then this is an indication that the image was to big during
# copying - this should never happen, but better save than sorry
# if [ "$(df ${RAMDISK} | grep "${RAMDISK}" | awk '{print $(NF-2)}')" -eq 0 ]; then
- if [ x"$COPY2RAM" = "xfail" ]; then
+ if [ "x$COPY2RAM" = "xfail" ]; then
$RED;
echo "ERROR: ramdisk size calculation error"
echo " the image to copy was bigger than expected"
@@ -193,7 +191,7 @@
fi
# get size of the copied image
- local REAL_SIZE=$(du -k ${RAMDISK}/${ISOFILE} | awk '{print $1}')
+ local REAL_SIZE=$(du -k ${RAMDISK}/${IMAGE} | awk '{print $1}')
let REAL_SIZE=REAL_SIZE*10/1024+5 # do correct rounding
let REAL_SIZE=REAL_SIZE/10
@@ -217,7 +215,7 @@
/sbin/mount -n -o remount,ro,size=${RAMDISK_SIZE}k shmfs ${RAMDISK}
# loop mount final ISO image from ramdisk
- /sbin/mount -n -t iso9660 -o loop,ro ${RAMDISK}/${ISOFILE} ${mountpoint}
+ /sbin/mount -n -t ${IMAGEFS} -o loop,ro ${RAMDISK}/${IMAGE} ${mountpoint}
if [ $? -ne 0 ]; then
$RED;
echo "FATAL-ERROR: mounting the copied image failed"
@@ -360,9 +358,28 @@
sync
$NORMAL
fi
- if [ -e /cd/bootcd.iso ] ; then
+ if [[ $(ls /cd/bootcd.* 2>/dev/null) != "" ]]; then
echo $disk > /shm/DL_DEVICE
+ FILEMOUNT="/cd"
+ if [ -e /cd/bootcd.squash ] ; then
+ IMAGE="bootcd.squash"
+ IMAGEFS="squashfs"
+ elif [ -e /cd/bootcd.iso ] ; then
+ IMAGE="bootcd.iso"
+ IMAGEFS="iso9660"
+ else
+ $RED
+ echo "ERROR: image file not found!"
+ echo
+ echo 'Please report to bu...@de...'
+ echo
+ $NORMAL
+ sleep 10
+ exit 1
+
+ fi
+
# run from ram if correct variable is set
if ! run_from_ram --file; then
# since this could be flash disk, lets make read-only.
@@ -371,7 +388,7 @@
# because bootcd.iso is still mounted inside it.
# RO will make it less painfull.
/sbin/mount -o remount,ro,noatime $disk 2> /dev/null
- /sbin/mount -o loop -t iso9660 /cd/bootcd.iso ${mountpoint} || return 1
+ /sbin/mount -o loop -t ${IMAGEFS} ${FILEMOUNT}/${IMAGE} ${mountpoint} || return 1
dl_version=`cat /cd/DEVIL-LINUX 2> /dev/null`
if [ ! $silent ]; then
$YELLOW
|