Package: casper
Version: 1.63+debian-2
Severity: normal
Tags: patch

The correct parameters are stillnot being given to the unionfs mount command 
when an NFS root is used. 
This patch detects the filesystem of a directory and passes the correct 
argument "nfsro" to the unionfs 
mount in rofsstring in then event of the directory being on NFS.

NB: patch is to casper script for version 1.63+debian-2

Regards
Alex Owen




-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=locale: Cannot set 
LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
ANSI_X3.4-1968)

Versions of packages casper depends on:
ii  initramfs-tools               0.73e      tools for generating an initramfs
ii  user-setup                    1.4        Set up initial user and password

Versions of packages casper recommends:
pn  live-package                  <none>     (no description available)

-- debconf information excluded
--- casper.orig 2006-08-16 14:37:33.000000000 +0000
+++ casper      2006-08-16 16:36:48.000000000 +0000
@@ -157,6 +157,23 @@
        panic "No loop devices available"
 }
 
+lastline(){ while read junk ; do line=$junk ; done; echo "$line"; } 
+
+get_dir_fstype() {
+testpath="$1"
+mounts="`awk '{print $2,$3}' /proc/mounts`"
+testpath=`realpath $1`
+while true ; do 
+       if echo "$mounts" | grep -qs "^${testpath} " ; then
+               set -- `echo "$mounts" |grep "^${testpath} " | lastline` 
+               echo $2
+               break
+       else
+               testpath=`dirname $testpath`    
+       fi
+done
+}
+
 get_fstype() {
        #FIXME# one use of this function expects "unknown" another does not!
        # which is it???
@@ -349,9 +366,13 @@
                for image in "${image_directory}"/*."${image_type}"; do
                        imagename=$(basename "${image}")
                        if [ -d "${image}" ]; then
-                               # it is a plain directory: do nothing
+                               # it is a plain directory: do nothing unless nfs
+                               if [ `get_dir_fstype "${image}"` = "nfs" ] ; 
then
+                                       
rofsstring="${image}=nfsro:${rofsstring}"
+                               else
+                                       rofsstring="${image}=ro:${rofsstring}"
+                               fi
                                rofslist="${image} ${rofslist}"
-                               rofsstring="${image}=ro:${rofsstring}"
                        elif [ -f "${image}" ]; then
                                backdev=$(get_backing_device "$image")
                                fstype=$(get_fstype "${backdev}")

Reply via email to