
Signed-Off-By: Bernardo Innocenti <bernie@develer.com>

diff -Nrup system-config-netboot/diskless/disklessrc system-config-netboot.initramfs/diskless/disklessrc
--- system-config-netboot/diskless/disklessrc	2006-06-08 00:28:54.000000000 +0200
+++ system-config-netboot.initramfs/diskless/disklessrc	2006-10-29 13:02:36.000000000 +0100
@@ -89,7 +89,7 @@ findhardware() {
 #  over the root directory.
 #
 mountfile () {
-    snapshotfile=/.snapshot/${2}${1}
+    snapshotfile=/mnt/.snapshot/${2}${1}
     dir=`dirname $snapshotfile`
 #
 #  Check if file already exists in snapshot directory.  If not attempt to copy
@@ -98,9 +98,9 @@ mountfile () {
     if [ ! -e $snapshotfile ]; then
 	mkdir -p $dir
 	echo "${1} missing from client specific area."
-	if [ -e ${1} ] ; then 
+	if [ -e /mnt/${1} ] ; then 
 	    echo "Copying ${1}"
-	    rsync -a ${1} $snapshotfile
+	    rsync -a /mnt/${1} $snapshotfile
 	else 
 	    echo "Creating ${1}"
 	    touch $snapshotfile
@@ -111,13 +111,13 @@ mountfile () {
 #   snapshot directory.
 	if [ ${1} == "/dev" -a ${1} -nt ${dir}/dev ]; then
 	    echo "RSYNC-ing /dev";
-	    rsync -a ${1} $snapshotfile
+	    rsync -a /mnt/${1} $snapshotfile
 	fi
     fi
 #
 #  Mount the snapshotfile over the root file so the client will have r/w access
 #
-    mount -n -o bind /.snapshot/${2}${1} ${1} 
+    mount -n -o bind /mnt/.snapshot/${2}${1} /mnt/${1} 
 }
 
 echo "==============================================================================="
@@ -308,7 +308,7 @@ NFS_DIR=`echo ${NFSROOT} | cut -d : -f 2
 if [ -w /proc/progress ]; then echo 55 "Mounting root filesystem" >/proc/progress; fi
 echo "Mounting root filesystem: ${NFS_DIR}/root from: ${NFS_IP}"
 
-mount -n -o nolock,ro ${NFS_IP}:${NFS_DIR}/root /mnt
+mount -n -o nolock,ro,rsize=32768,async,intr ${NFS_IP}:${NFS_DIR}/root /mnt
 
 if [ $? -ne 0 ]; then
     if [ -w /proc/progress ]; then echo f >/proc/progress; fi
@@ -327,20 +327,8 @@ fi
 
 if [ "${INITRD_DBG}" = "5" ]; then exec /bin/bash; fi
 
-#
-# Now that the NFS root partition has been mounted do a pivot_root to switch
-# the memory resident root with the NFS one.
-#
-if [ -w /proc/progress ]; then echo 60 "Pivoting root" >/proc/progress; fi
-
-umount /proc
-echo "Doing the pivot_root"
-
-cd /mnt
-/sbin/pivot_root . .oldroot
-
-cd /
-mount -n -t proc /proc /proc
+export LD_LIBRARY_PATH=/mnt/usr/lib64:/mnt/usr/lib:/mnt/lib64:/mnt/lib
+export PATH=/mnt/usr/sbin:/mnt/usr/bin:/mnt/sbin:/mnt/bin:$PATH
 
 #
 #  Mount the snapshot directory from the server and then mount files 
@@ -349,23 +337,24 @@ mount -n -t proc /proc /proc
 
 if [ "${INITRD_DBG}" = "6" ]; then exec /bin/bash; fi
 echo Mounting Snapshot directories
-mount -t nfs $NFS_IP:${NFS_DIR}/snapshot /.snapshot -o rw,nolock &&
+#bernie
+mount -t nfs $NFS_IP:${NFS_DIR}/snapshot /mnt/.snapshot -o rw,nolock,rsize=32768,wsize=32768,async,intr &&
 {
-    for i in `grep -v "^#" /.snapshot/files`; do 
-	if [ -e $i ]; then 
+    for i in `grep -v "^#" /mnt/.snapshot/files`; do 
+	if [ -e /mnt/$i ]; then 
 	    mountfile $i ${SNAPSHOT}
 	fi;
     done
-    if [ -e /.snapshot/files.custom ]; then
-	for i in `grep -v "^#" /.snapshot/files.custom`; do 
-	    if [ -e $i ]; then
+    if [ -e /mnt/.snapshot/files.custom ]; then
+	for i in `grep -v "^#" /mnt/.snapshot/files.custom`; do 
+	    if [ -e /mnt/$i ]; then
 		mountfile $i ${SNAPSHOT}
 	    fi;
 	done
     fi
     RELEASE=`uname -r`
-    for i in `ls /lib/modules/$RELEASE/modules.*`; do
-	if [ -e $i ]; then
+    for i in `ls /mnt/lib/modules/$RELEASE/modules.*`; do
+	if [ -e /mnt/$i ]; then
 	    mountfile $i ${SNAPSHOT}
 	fi;
     done
@@ -375,14 +364,14 @@ mount -t nfs $NFS_IP:${NFS_DIR}/snapshot
 #
 # Copy the files written by dhclient to new root:
 #
-[ -e /.oldroot/etc/resolv.conf ] &&  cp -fp /.oldroot/etc/resolv.conf /etc/resolv.conf 2>/dev/null
-[ -e /.oldroot/etc/yp.conf ] && cp -fp /.oldroot/etc/yp.conf /etc/yp.conf 2>/dev/null
-[ -e /.oldroot/etc/ntp.conf ] && cp -fp /.oldroot/etc/ntp.conf /etc/ntp.conf 2>/dev/null
-[ -e /.oldroot/etc/ntp/step-kickers ] && cp -fp /.oldroot/etc/ntp/step-tickers /etc/ntp/step-tickers 2>/dev/null
+[ -e /etc/resolv.conf ] &&  cp -fp /etc/resolv.conf /mnt/etc/resolv.conf 2>/dev/null
+[ -e /etc/yp.conf ] && cp -fp /etc/yp.conf /mnt/etc/yp.conf 2>/dev/null
+[ -e /etc/ntp.conf ] && cp -fp /etc/ntp.conf /mnt/etc/ntp.conf 2>/dev/null
+[ -e /etc/ntp/step-kickers ] && cp -fp /etc/ntp/step-tickers /mnt/etc/ntp/step-tickers 2>/dev/null
 
 # This will allow dhclient to be re-run for nfs interface by initscripts (keep_old_ip=yes):
-cp -fp .oldroot/tmp/dhclient.leases /var/lib/dhcp/dhclient-eth0.leases 2>/dev/null
-cp -fp .oldroot/tmp/dhclient.leases /var/lib/dhclient/dhclient-eth0.leases 2>/dev/null
+cp -fp /tmp/dhclient.leases /mnt/var/lib/dhcp/dhclient-eth0.leases 2>/dev/null
+cp -fp /tmp/dhclient.leases /mnt/var/lib/dhclient/dhclient-eth0.leases 2>/dev/null
 
 if [ "${INITRD_DBG}" = "7" ]; then exec /bin/bash; fi
 
@@ -395,20 +384,18 @@ if [ "${INITRD_DBG}" = "7" ]; then exec 
 #
 if [ "${INITRD_DBG}" = "8" ]; then exec /bin/bash; fi
 
-/bin/kill -TERM `cat /.oldroot/tmp/dhclient.pid`
+/bin/kill -TERM `cat /tmp/dhclient.pid`
 
 echo "Running /sbin/init"
 
-umount /.oldroot/tmp
+umount /tmp
 
 echo 0x100 > /proc/sys/kernel/real-root-dev
 
-umount /proc
-
 # Some useful environment variables to stop initscripts / dhclient-script
 # doing silly things: 
 export keep_old_ip=yes
 export fastboot=yes
 export READONLY=yes
 
-exec /sbin/init
+exec switch_root /mnt /sbin/init
diff -Nrup system-config-netboot/diskless/files system-config-netboot.initramfs/diskless/files
--- system-config-netboot/diskless/files	2006-06-08 00:28:54.000000000 +0200
+++ system-config-netboot.initramfs/diskless/files	2006-10-29 12:53:42.000000000 +0100
@@ -19,8 +19,6 @@
 /etc/modules.conf
 /etc/fstab
 /etc/sysconfig/hwconf
-/etc/X11/XF86Config
-/etc/X11/XF86Config.backup
 /etc/X11/xorg.conf
 /etc/X11/xorg.conf.backup
 /etc/ssh/
diff -Nrup system-config-netboot/diskless/updateDiskless system-config-netboot.initramfs/diskless/updateDiskless
--- system-config-netboot/diskless/updateDiskless	2006-06-08 00:28:54.000000000 +0200
+++ system-config-netboot.initramfs/diskless/updateDiskless	2006-10-29 22:09:53.000000000 +0100
@@ -73,7 +73,7 @@ die(){ r=$?; [ $# -gt 0 ] && r=$1; [ "$r
 #
 #  Copy the diskless init script onto the image 
 #
-/bin/cp $INSTALLDIR/disklessrc $MNTPOINT/disklessrc || die;
+/bin/cp $INSTALLDIR/disklessrc $MNTPOINT/init || die;
 #
 #  create required directories on the image 
 #
@@ -114,7 +114,7 @@ __EOF
 done;
 #/bin/cp "$ROOT"/usr/share/hwdata/pcitable $MNTPOINT/usr/share/hwdata/ || die;
 # disklessrc now uses modules.pcimap, not pcitable
-BINS="/sbin/busybox.anaconda /sbin/insmod /sbin/modprobe /sbin/rmmod /sbin/dhclient /bin/bash /bin/mount /sbin/route /sbin/ip /usr/bin/expr /sbin/lspci /sbin/ifconfig /sbin/consoletype /sbin/pivot_root /bin/hostname /bin/domainname /usr/bin/host"
+BINS="/sbin/busybox.anaconda /sbin/insmod /sbin/modprobe /sbin/rmmod /sbin/dhclient /bin/bash /bin/mount /sbin/mount.nfs /sbin/mount.nfs4 /sbin/route /sbin/ip /usr/bin/expr /sbin/lspci /sbin/ifconfig /sbin/consoletype /sbin/pivot_root /bin/hostname /bin/domainname /usr/bin/host"
 # Set up links to all the busybox functions -
 # may be different for different versions of busybox!
 if [ ! -e $ROOT/sbin/busybox.anaconda ]; then 
@@ -265,78 +265,9 @@ if [ $? -ne 0 ]; then
     echo "Copying modules to initrd failed."
     die;
 fi;
-#
-#  Create a new image file
-#
-duks=(`/usr/bin/du -ks $MNTPOINT 2>/dev/null || echo ''`)
-dus=${duks[0]}
-imagesize=16000;
-if [ -n ${dus} ] && [ ${dus} -gt 1024 ]; then
-    imagesize=`echo -e 'scale=2\nr=('$dus'*1.05)\nr*=1024\nscale=0\nif((r%1024)>0){(r/1024)+1}else{r/1024}\n' | /usr/bin/bc`
-fi;
-if [ -z ${imagesize} ] || ! { echo "$imagesize" | /bin/egrep -q '^[0-9]+$'; }; then
-    imagesize=16000;
-fi;
-uncompressedimage=/tmp/image$$
-TMPDIR=$MNTPOINT
-MNTPOINT=/mnt/$$
-/bin/mkdir -p $MNTPOINT || die;
-rm -f $uncompressedimage;
-/bin/dd if=/dev/zero of=$uncompressedimage bs=1k count=$imagesize 2> /dev/null || die;
-chmod +rw $uncompressedimage;
-img=$uncompressedimage
-SIDEFFECTS="$MNTPOINT $uncompressedimage";
-SELINUX=
-SEMLS=
-sedir=`while read d dir type r; do if [ "$type" = "selinuxfs" ]; then echo $dir; break; fi; done < /proc/mounts`
-if [ -e $sedir/enforce ]; then
-   SELINUX=1
-#  SELinux is enabled; could be enforcing / permissive, doesn't matter
-   if [ -e $sedir/mls ] && [ `cat $sedir/mls` -eq 1 ]; then
-       SEMLS=':s0';
-   fi;
-fi
-if [ "$SELINUX" -eq 1 ]; then
-   /usr/bin/chcon -t fsadm_tmp_t $img >/dev/null 2>&1;
-   # under new SELinux, mke2fs/tune2fs can only create filesystems in files with this context
-fi
-# We have to "echo y |" so that it doesn't complain about $IMAGE not
-# being a block device
-mke2fsOut=`echo y | /sbin/mke2fs $img 2>&1`;
-if [ $? -ne 0 ]; then
-   echo -e "mke2fs failed:\n$mke2fsOut";
-   die;
-fi;
-/sbin/tune2fs -i0 $img >/dev/null 2>&1 || die;
-if [ -n "$SELINUX" ]; then
-    /usr/bin/chcon -t mount_tmp_t $img >/dev/null 2>&1;
-#   new SELinux mount cannot mount files unless they have this context 
-    /bin/mount -t ext2 -o loop,context=system_u:object_r:removable_t${SEMLS} $img $MNTPOINT || die;
-#   do NOT enable creation of SELinux xattr labels in the initrd; new SELinux requires ':s0', old does not :-(
-else
-#  SELinux is disabled / not present; no labels will be created
-    /bin/mount -t ext2 -o loop $img $MNTPOINT || die;
-fi
-CLEANUP="/bin/umount -f $MNTPOINT"
-#
-# We don't need this directory, so let's save space
-/bin/rm -rf $MNTPOINT/'lost+found'
-#
-#  Copy the temp directory to the initrd:
-#
-if ! (cd $TMPDIR; /bin/tar -cpf - . || die ) | (cd $MNTPOINT; /bin/tar -xpf -) ; then
-   echo "Creation of initrd failed."
-   die
-fi;
-/bin/rm -rf $TMPDIR;
-SIDEFFECTS=$uncompressedimage
 # 
 #  Unmount and compress image file to be ready to boot
 #
-/bin/sync
-/bin/umount $MNTPOINT
-CLEANUP=''
-/bin/rmdir  $MNTPOINT
 /bin/mkdir -p "$DESTDIR" ;
 if [ ! -d "$DESTDIR" ]; then
    echo "Cannot create $DESTDIR directory.";
@@ -345,11 +276,8 @@ fi
 if [ -e "$IMAGEFILE" ]; then
     /bin/mv -f "$IMAGEFILE" "$IMAGEFILE".backup;
 fi
-if ! /usr/bin/gzip -c -9 $uncompressedimage > "$IMAGEFILE"; then
-   echo " gzip -c -9 $uncompressedimage > $IMAGEFILE failed.";
-   die;
-fi
-/bin/rm -f $uncompressedimage
+( cd "$MNTPOINT"; /usr/bin/find . | cpio -c -o | /usr/bin/gzip -9 >"$IMAGEFILE" ) || die;
+/bin/rm -rf $MNTPOINT;
 SIDEFFECTS=$IMAGEFILE
 if ! /bin/cp -a "$KERNEL" "$DESTDIR"/vmlinuz; then
    echo "/bin/cp -a $KERNEL $DESTDIR/vmlinuz failed.";
Binary files system-config-netboot/diskless.pyc and system-config-netboot.initramfs/diskless.pyc differ
Binary files system-config-netboot/firsttime.pyc and system-config-netboot.initramfs/firsttime.pyc differ
Binary files system-config-netboot/netboot_gtk.pyc and system-config-netboot.initramfs/netboot_gtk.pyc differ
Binary files system-config-netboot/netboot_util.pyc and system-config-netboot.initramfs/netboot_util.pyc differ
Binary files system-config-netboot/pxeboot.pyc and system-config-netboot.initramfs/pxeboot.pyc differ
Binary files system-config-netboot/pxeos.pyc and system-config-netboot.initramfs/pxeos.pyc differ
Binary files system-config-netboot/pxeosdialog.pyc and system-config-netboot.initramfs/pxeosdialog.pyc differ
