Re: ybin and NetBSD [Was: GNU/Linux, NetBSD and Mac OS X]
On Tue, Jul 17, 2001 at 12:29:48AM -0800, Ethan Benson wrote:
> > What about this syntax:
> >
> > bsd=/dev/hda10 hd:11,/netbsd
>
> that is a non-trivial change and would require completly rewriting the
> config file parsing of ybin. (which i wouldn't mind doing so i could
> use a image= style section format for these, but i have yet to find a
> way that will work in the confines of limited busybox boot-floppies.
I did it :-)
Note that I use "busybox expr" in place of expr.
--
Edouard G. Parmelan
http://egp.free.fr
--- /usr/sbin/ybin Sat Jun 9 02:43:45 2001
+++ ybin.egp Tue Jul 17 13:34:45 2001
@@ -96,6 +96,8 @@
;;
mkofboot)
;;
+ ybin.egp)
+ ;;
*)
echo 1>&2 "This program must be called as either \`ybin' or \`mkofboot'"
exit 1
@@ -1092,22 +1094,22 @@
[ "$brokenosx" = no ] && OSXBOOT="${BS}${BS}:tbxi"
## assign variables for configured menu options.
- [ "$usemount" = no -a "$bless" = yes ] && YB="yaboot GNU l $ofboot ,${BS}${BS}yaboot"
- [ "$usemount" = yes -o "$bless" = no ] && YB="yaboot GNU l $ofboot ,${OFDIR}yaboot"
- [ -n "$bsd" ] && OS=$(($OS + 1)) && BSD="bsd BSD b $bsd ,${BS}ofwboot.elf"
- [ -n "$macos" ] && OS=$(($OS + 1)) && MAC="macos MacOS m $macos ,${BS}${BS}:tbxi"
- [ -n "$macosx" ] && OS=$(($OS + 1)) && MX="macosx MacOSX x $macosx ,${OSXBOOT}"
- [ -n "$darwin" ] && OS=$(($OS + 1)) && DW="darwin Darwin d $darwin ,${BS}${BS}:tbxi"
- [ "$cdrom" = yes ] && OS=$(($OS + 1)) && CD="cd CDROM c cd: ,${BS}${BS}:tbxi"
+ [ "$usemount" = no -a "$bless" = yes ] && YB="yaboot GNU l $ofboot ',${BS}${BS}yaboot'"
+ [ "$usemount" = yes -o "$bless" = no ] && YB="yaboot GNU l $ofboot ',${OFDIR}yaboot'"
+ [ -n "$bsd" ] && OS=$(($OS + 1)) && BSD="bsd BSD b $bsd ',${BS}ofwboot.elf $bsd_options'"
+ [ -n "$macos" ] && OS=$(($OS + 1)) && MAC="macos MacOS m $macos ',${BS}${BS}:tbxi'"
+ [ -n "$macosx" ] && OS=$(($OS + 1)) && MX="macosx MacOSX x $macosx ',${OSXBOOT}'"
+ [ -n "$darwin" ] && OS=$(($OS + 1)) && DW="darwin Darwin d $darwin ',${BS}${BS}:tbxi'"
+ [ "$cdrom" = yes ] && OS=$(($OS + 1)) && CD="cd CDROM c cd: ',${BS}${BS}:tbxi'"
[ "$network" = yes ] && OS=$(($OS + 1)) && NET="net Network n enet: 0"
[ "$of" = yes ] && OS=$(($OS + 1)) && OF="of OpenFirmware o quit now"
[ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: OS=$OS"
## call ofboot,
## Usage: OS-count defaultos timeout fgc bgc osname oslabel oskey osdev osfile ...
- [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: /bin/sh $magicboot $OS $defaultos $delay $fbc $bgc $YB $BSD $MAC $MX $DW $CD $NET $OF\n"
- FIRST=`/bin/sh "$magicboot" "$OS" "$defaultos" "$delay" $fgc $bgc ${YB} ${BSD} ${MAC} ${MX} ${DW} ${CD} ${NET} ${OF}` || return 1
-
+ cmd="/bin/sh '$magicboot' '$OS' '$defaultos' '$delay' $fgc $bgc ${YB} ${BSD} ${MAC} ${MX} ${DW} ${CD} ${NET} ${OF}"
+ [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: $cmd\n"
+ FIRST=`eval $cmd` || return 1
return 0
}
@@ -1207,6 +1209,7 @@
## take out the trash.
cleanup()
{
+ [ "$DEBUG" = 1 ] && return 0
if [ -n "$TMPCONF" ] ; then rm -f "$TMPCONF" ; fi
if [ -n "$FIRST" ] ; then rm -f "$FIRST" ; fi
if [ -d "$TMP/bootstrap.$$" ] ; then rmdir "$TMP/bootstrap.$$" ; fi
@@ -1458,7 +1461,11 @@
[ $(parseconf ck mntpoint) = 0 ] && mntpoint=`parseconf str mntpoint`
[ $(parseconf ck delay) = 0 ] && delay=`parseconf str delay`
[ $(parseconf ck timeout) = 0 ] && timeout=`parseconf str timeout`
-[ $(parseconf ck bsd) = 0 ] && bsd=`parseconf str bsd`
+if [ $(parseconf ck bsd) = 0 ]; then
+ tmp=`parseconf str bsd`
+ bsd=`busybox expr "$tmp" : '\([^ ]*\)'`
+ bsd_options=`busybox expr "$tmp" : "$bsd"'[ ]*\(.*\)'`
+fi
[ $(parseconf ck macos) = 0 ] && macos=`parseconf str macos`
[ $(parseconf ck macosx) = 0 ] && macosx=`parseconf str macosx`
[ $(parseconf ck darwin) = 0 ] && darwin=`parseconf str darwin`
Reply to: