--- yaboot-1.3.13/ybin/ybin.ext2 2005-07-29 13:22:40.000000000 +0100 +++ yaboot-1.3.13/ybin/ybin 2005-07-29 13:23:01.000000000 +0100 @@ -75,6 +75,8 @@ fi usemount=no if (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then fstype=raw +elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'Pegasos') ; then + fstype=ext2 else fstype=hfs fi @@ -277,13 +279,13 @@ checkconf() fi case "$fstype" in - hfs|msdos|raw) + hfs|msdos|raw|ext2) ;; *) if [ "$ARGFS" = 1 ] ; then - echo 1>&2 "$PRG: --filesystem must be either \`hfs', \`msdos', or \`raw'" + echo 1>&2 "$PRG: --filesystem must be either \`hfs', \`msdos', \`ext2' or \`raw'" else - echo 1>&2 "$PRG:$ERR \`fstype' must be either \`hfs', \`msdos', or \`raw'" + echo 1>&2 "$PRG:$ERR \`fstype' must be either \`hfs', \`msdos', \`ext2' or \`raw'" fi local CONFERR=1 ;; @@ -942,12 +944,16 @@ util_install() ## used by mnt_install so mntpoint= can be supported in a cleaner way. mnt() { + local mountopts="rw" + ## we can even create bootstrap filesystem images directly if you ## ever wanted too. if [ -f "$boot" ] ; then - local loop=",loop" + mountopts="$mountopts,loop" + fi + if [ "$fstype" = "msdos" ] ; then + mountopts="$mountopts,umask=077" fi - if [ -e "$TMP/bootstrap.$$" ] ; then echo 1>&2 "$PRG: $TMP/bootstrap.$$ exists, aborting." return 1 @@ -966,7 +972,7 @@ mnt() fi [ "$VERBOSE" = 1 ] && echo "$PRG: Mounting $boot..." - mount -t "$fstype" -o rw,umask=077$loop "$boot" "$TMP/bootstrap.$$" + mount -t "$fstype" -o rw,$mountopts$loop "$boot" "$TMP/bootstrap.$$" if [ $? != 0 ] ; then echo 1>&2 "$PRG: An error occured mounting $boot" return 1 @@ -1252,6 +1258,25 @@ mkoffs() fi return 0 ;; + ext2) + if (command -v mkfs.ext2 > /dev/null 2>&1) ; then + [ -x `command -v mkfs.ext2` ] || FAIL=1 ; else FAIL=1 ; fi + if [ "$FAIL" = 1 ] ; then + echo 1>&2 "$PRG: mkfs.ext2 is not installed or cannot be found" + return 1 + fi + + [ "$VERBOSE" = 1 ] && echo "$PRG: Creating ext2 filesystem on $boot..." + if (command -v dd > /dev/null 2>&1) ; then + dd if=/dev/zero of="$boot" bs=512 count=1600 > /dev/null 2>&1 + fi + mkfs.ext2 -L bootstrap "$boot" > /dev/null + if [ $? != 0 ] ; then + echo 1>&2 "$PRG: ext2 filesystem creation failed!" + return 1 + fi + return 0 + ;; esac }