Hi folks,

LFS LiveCD

I have a compressed file, usr.sqfs, on the LFS LiveCD under root "/". I need it mounted automatically after the CD being successfully mounted during booting with following command line;

# mount -t squashfs -o loop usr.sqfs /usr

the script running to mount LFS LiveCD is;
Code:
#!/bin/sh
                                                                                
# ID is a file in root of the LFS boot CD, used to identify the CD.

ID="livecd"

TMP_MOUNT="/mnt"
                                                                                
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
                                                                                
CHECK_TYPE="try_mount"
                                                                                
# MOUNT KERNEL FILESYSTEMS

# Create the proc directory if it does not exist

if [ ! -d "/proc/" ]; then
  mkdir /proc
fi

# Mount the proc filesystem

mount -n proc /proc -t proc

# If sysfs is listed as a valid filesystem type in /proc
# then mount it (if it doesnt then udev wont work
# and you wont have the devices you need)
                                                                              
if grep -q '[[:space:]]sysfs' /proc/filesystems; then
    if [ ! -d /sys/block ]; then
    mount -n sysfs /sys -t sysfs
    fi
fi
                                                                                
# Create some things that sysfs does not, and should not export for us.  
Feel
# free to add devices to this list.

make_extra_nodes() {
        ln -s /proc/self/fd /dev/fd
        ln -s /proc/self/fd/0 /dev/stdin
        ln -s /proc/self/fd/1 /dev/stdout
        ln -s /proc/self/fd/2 /dev/stderr
        ln -s /proc/kcore /dev/core
        mkdir /dev/pts
        mkdir /dev/shm
}
                                                                                
                                                                                
if [ ! -x /sbin/hotplug ]; then
    echo /sbin/udev > /proc/sys/kernel/hotplug
fi
                                                                                
# Mount a temporary file system over /dev, so that any devices
# made or removed during this boot don't affect the next one.
# The reason we don't write to mtab is because we don't ever
# want /dev to be unavailable (such as by `umount -a').
                                                                                
mount -n ramfs /dev -t ramfs
                                                                                
/sbin/udevstart
                                                                                
make_extra_nodes                                                                

# Detecting the live CD is pretty complicated, 
# but is a very logical process
                                                                                
# Search for cdrom devices and add them to CDROM_LIST
                                                                                
CDROM_LIST=""
                                                                                
# Search in proc tree for ide cdrom devices
# There used to be a section for devfs, but this was
# edited for udev. Actually we should probably not
# use /proc anymore, but use sysfs instead...
# Perhaps in the future;)
    
# Check for ide channels.
 
for ide_channel in /proc/ide/ide[0-9]
do

# If there are no ide channels found, then skip this

  if [ ! -d "$ide_channel" ]; then
    break
  fi

# Try each ide device to see if we can find the cd-rom drive

  for ide_device in hda hdb hdc hdd hde hdf hdg hdh hdi hdj hdk hdl hdm 
hdn
  do
    device_media_file="$ide_channel/$ide_device/media"
    if [ -e "$device_media_file" ]; then
      grep -i "cdrom" $device_media_file > /dev/null 2>&1
      if [ $? -eq 0 ]; then
        CDROM_LIST="$CDROM_LIST /dev/$ide_device"
      fi
    fi
  done
done

# Check for scsi cds

for scsi_cdrom in /dev/scd[0-99]
do
  if [ -e "$scsi_cdrom" ]; then
    CDROM_LIST="$CDROM_LIST $scsi_cdrom"
  fi
done
                                                                                
# Now we try to find the LFS boot CD (we use ID as identification)
                                                                                
LFS_CDROM_DEVICE=""

for cdrom_device in $CDROM_LIST
do
  if [ "$CHECK_TYPE" = "try_mount" ]; then
    mount -n -t iso9660 ${cdrom_device} $TMP_MOUNT
    # > /dev/null 2>&1
    media_found=$?
  fi

  if [ $media_found -eq 0 ]; then
    echo -n "media found"
    if [ "$CHECK_TYPE" = "try_mount" ]; then
      [ -e "$TMP_MOUNT/$ID" ]
      media_lfs=$?
    fi
    
    if [ "$CHECK_TYPE" = "try_mount" ]; then
      umount -n $cdrom_device > /dev/null 2>&1
    fi
                                                                                
    if [ $media_lfs -eq 0 ]; then
      echo ", LFS boot CD found. Ready!"
      LFS_CDROM_DEVICE="$cdrom_device"
      break;
    else
      echo ", not LFS boot CD."
    fi
                                                                                
  else
    echo "no media "
  fi
done
                                                                                
# Mount LFS CD as / (root fs)
if [ "$LFS_CDROM_DEVICE" = "" ]; then
  echo "No LFS boot CD found!!!"
  exit 1
else
  echo "Booting from $LFS_CDROM_DEVICE..."
Additionally, if mounting OK following notice popup;

Mount: usr.sqfs successful

Please advise where shall I insert the abovementioned command line and how?

TIA

B.R.
satimis