Hello,

pls find following some patches to the live-intramfs code for initial Ubuntu (<=Jaunty) support.

Issues tackled are:

* lack of 'wc' support in initrd busybox
* lack of /lib/udev/cdrom_id in Jaunty
* invalid mangling of /etc/event.d/tty*

Hopefully you will find them proper and forward upstream for inclusion.

As per Ubuntu Karmic, being only unionfs-fuse currently supported live-initramfs cannot work without substantial modifications. Hopefully this is only a temporary situation.

Best regards

Luigi Capriotti
diff --git a/scripts/live b/scripts/live
index 683afa2..4a09fed 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1149,7 +1149,16 @@ setup_unionfs ()
        if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
        then
                # Load USB modules
-               num_block=$(ls -l /sys/block | wc -l)
+               if [ -x /usr/bin/wc ]; then
+                       num_block=$(ls -l /sys/block | wc -l)
+               else
+                       num_block=0
+                       for word in `ls  /sys/block`;
+                       do
+                               num_block=$(( $num_block + 1 ))
+                       done
+               fi
+
                for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
                do
                        modprobe -q -b ${module}
@@ -1173,8 +1182,17 @@ setup_unionfs ()
                for timeout in 5 4 3 2 1
                do
                        sleep 1
+                       if [ -x /usr/bin/wc ]; then
+                               num_curr_block=$(ls -l /sys/block | wc -l)
+                       else
+                               num_curr_block=0
+                               for word in `ls /sys/block`;
+                               do
+                                       num_curr_block=$(( $num_curr_block + 1 
))
+                               done
+                       fi
 
-                       if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
+                       if [ ${num_curr_block} -gt ${num_block} ]
                        then
                                break
                        fi
@@ -1252,7 +1270,15 @@ setup_unionfs ()
                        panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on 
/cow"
        fi
 
-       rofscount=$(echo ${rofslist} |wc -w)
+       if [ -x /usr/bin/wc ]; then
+               rofscount=$(echo ${rofslist} |wc -w)
+       else
+               rofscount=0
+               for word in ${rofslist};
+               do
+                       rofscount=$(( $rofscount+ 1 ))
+               done
+       fi
 
        if [ -n "${EXPOSED_ROOT}" ]
        then
@@ -1455,7 +1481,14 @@ find_livefs ()
                devname=$(sys2dev "${sysblock}")
                fstype=$(get_fstype "${devname}")
 
-               if /lib/udev/cdrom_id ${devname} > /dev/null
+               cdrom="1"
+               if [ -x /lib/udev/cdrom_id ] 
+               then
+                       /lib/udev/cdrom_id ${devname} > /dev/null
+                       cdrom=$?
+               fi
+
+               if [ "$cdrom" -eq "0" ]
                then
                        if check_dev "null" "${devname}"
                        then
diff --git a/scripts/live-bottom/25configure_init 
b/scripts/live-bottom/25configure_init
index b0ac498..f55dd0e 100755
--- a/scripts/live-bottom/25configure_init
+++ b/scripts/live-bottom/25configure_init
@@ -77,7 +77,8 @@ then
                then
                        for f in /root/etc/event.d/tty*
                        do
-                               sed -i -e "s|^respawn.*|respawn /bin/login -f 
${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
+                               sed -i -e "/^respawn$/!s|^respawn.*|respawn 
/bin/login -f ${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 
2>\&1|" ${f}
+                               sed -i -e "s|^exec.*|exec /bin/login -f 
${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
                        done
                fi
        fi

Reply via email to