grub --batch not returning exit code to calling shell?

View: New views
2 Messages — Rating Filter:   Alert me  

grub --batch not returning exit code to calling shell?

by Amit Dor-Shifer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

reposting, +bug-grub.
Any takers?

<shell>
cm.stargate ~ # cat /tmp/grub.inst
root (hd1,0)
setup --prefix=/no/such/place (hd1)
cm.stargate ~ # cat /tmp/grub.inst |grub --batch --device-map
/tmp/device_map.grub


    GNU GRUB  version 0.97  (640K lower / 7168K upper memory)

[ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename. ]
grub> root (hd1,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup --prefix=/no/such/place (hd1)
Checking if "/no/such/place/stage1" exists... no

Error 15: File not found
grub> cm.stargate ~ # echo $?
0
</shell>

I expected grub to return the error code (15), or at least indicate
through its return code that something went wrong.
How can I get a real exit code from grub?
10x,
Amit



_______________________________________________
Bug-grub mailing list
Bug-grub@...
http://lists.gnu.org/mailman/listinfo/bug-grub

Re: grub --batch not returning exit code to calling shell?

by Felix Zielcke-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Dienstag, den 10.11.2009, 11:35 +0200 schrieb Amit Dor-Shifer:

> reposting, +bug-grub.
> Any takers?
>
> <shell>
> cm.stargate ~ # cat /tmp/grub.inst
> root (hd1,0)
> setup --prefix=/no/such/place (hd1)
> cm.stargate ~ # cat /tmp/grub.inst |grub --batch --device-map
> /tmp/device_map.grub
>
>
>     GNU GRUB  version 0.97  (640K lower / 7168K upper memory)
>
> [ Minimal BASH-like line editing is supported.  For the first word,
> TAB
>    lists possible command completions.  Anywhere else TAB lists the
> possible
>    completions of a device/filename. ]
> grub> root (hd1,0)
> Filesystem type is ext2fs, partition type 0x83
> grub> setup --prefix=/no/such/place (hd1)
> Checking if "/no/such/place/stage1" exists... no
>
> Error 15: File not found
> grub> cm.stargate ~ # echo $?
> 0
> </shell>
>
> I expected grub to return the error code (15), or at least indicate
> through its return code that something went wrong.
> How can I get a real exit code from grub?
> 10x,
> Amit
>

Just use grub2.
There you won't have the problem that a failing command still returns an
exit code of 0
It just doestn't have anymore that broken grub shell.

--
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer



_______________________________________________
Bug-grub mailing list
Bug-grub@...
http://lists.gnu.org/mailman/listinfo/bug-grub