slitaz-tools rev 673

bootfloppybox: fix loram case
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Nov 01 16:58:06 2011 +0100 (2011-11-01)
parents 66d99c2f8615
children 363218fafbcc
files tinyutils/bootfloppybox
line diff
     1.1 --- a/tinyutils/bootfloppybox	Fri Sep 02 20:02:36 2011 +0200
     1.2 +++ b/tinyutils/bootfloppybox	Tue Nov 01 16:58:06 2011 +0100
     1.3 @@ -274,7 +274,8 @@
     1.4  insmod /lib/modules/*/kernel/drivers/block/floppy.ko.gz 2> /dev/null
     1.5  # loram may put floppy.ko.gz module in /lib
     1.6  insmod /lib/floppy.ko.gz 2> /dev/null
     1.7 -if [ ! -x /sbin/blkid ]; then
     1.8 +case "\$(blkid 2>&1)" in
     1.9 +*not\ found*)
    1.10  	cat <<EOT
    1.11  
    1.12  You can preinstall SliTaz in an ext3 partition with this floppy set.
    1.13 @@ -283,8 +284,8 @@
    1.14  leave it blank to skip :
    1.15  EOT
    1.16  	read -t 60 device < /dev/tty0
    1.17 -	[ -n "\$device" ] && mount \$device /mnt && mkdir /mnt/slitaz
    1.18 -elif blkid | grep -q 'TYPE="ext'; then
    1.19 +	[ -n "\$device" ] && mount \$device /mnt && mkdir /mnt/slitaz ;;
    1.20 +*TYPE=\"ext*)
    1.21  	cat <<EOT
    1.22  
    1.23  You can preinstall SliTaz in one of these ext3 partitions:
    1.24 @@ -294,8 +295,8 @@
    1.25  leave it blank to skip :
    1.26  EOT
    1.27  	read -t 60 device < /dev/tty0
    1.28 -	[ -n "\$device" ] && mount \$device /mnt && mkdir /mnt/slitaz
    1.29 -else
    1.30 +	[ -n "\$device" ] && mount \$device /mnt && mkdir /mnt/slitaz ;;
    1.31 +*)
    1.32  	cat <<EOT
    1.33  
    1.34  You can preinstall SliTaz in an ext3 partition with this floppy set.
    1.35 @@ -303,7 +304,7 @@
    1.36  format it with 'mke2fs -j' and reboot from the floppies again.
    1.37  
    1.38  EOT
    1.39 -fi
    1.40 +esac
    1.41  umount /proc
    1.42  while read name min num count file md5; do
    1.43  	[ -e \$file ] && continue
    1.44 @@ -321,6 +322,7 @@
    1.45  	fi
    1.46  	rootfslist="\$rootfslist \$num"
    1.47  	rm -f /tmp/rootfs*
    1.48 +	mkdir /sbin 2> /dev/null
    1.49  done <<EOT
    1.50  $(while read line; do echo $line; done)
    1.51  EOT
    1.52 @@ -399,8 +401,8 @@
    1.53  	[ \$(stat -c %s /mnt/slitaz/bzImage) -eq \$size ] ||
    1.54  	mv -f /mnt/slitaz /mnt/slitaz-aborted
    1.55  fi
    1.56 -mv -f /init.org /init || sh
    1.57 -exec /init
    1.58 +[ -d /sbin ] && mv -f /init.org /init && exec /init
    1.59 +exec /bin/ash < /dev/tty0 > /dev/tty0 2>&1
    1.60  EOTEOT
    1.61  	chmod +x $1/init
    1.62  }
    1.63 @@ -605,7 +607,7 @@
    1.64  	else
    1.65  	# This is a loram rootfs.gz, extract loram bootstrap
    1.66  		echo "Splitting loram rootfs..."
    1.67 -		offset=$(awk '/07070100/ { o+=index($0,"07070100"); print o/4 ; exit } { o+=1+length() }' < $rootfs)
    1.68 +		offset=$(awk '/07070100/ { o+=index($0,"07070100"); print int(o/4) ; exit } { o+=1+length() }' < $rootfs)
    1.69  		dd if=$rootfs skip=$(($offset / 1024)) bs=4k count=1 2> /dev/null | \
    1.70  		dd skip=$(($offset % 1024)) bs=4 of=/tmp/rootfs$$/1/root 2> /dev/null
    1.71  		dd if=$rootfs skip=$((1 + ($offset / 1024) )) bs=4k \