Jump to content











Photo
- - - - -

if some.iso not exists then hide this menu entry


  • Please log in to reply
80 replies to this topic

#51 Sphinx114

Sphinx114

    Newbie

  • Members
  • 19 posts
  • Location:Siberia, Russia

Posted 03 December 2011 - 09:57 PM

steve, your grldr works, but where internal grldr menu? I can't edit it by bootice or notepad.

IMHO with [command] in post #43 is better. Command can be various, for example [ls /fred.iso], [is64bit], [geometry (hd1)] or anything else.

#52 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 03 December 2011 - 10:08 PM

I am currently coding this and have just got it to work! The syntax is

title [IFEXIST filespec] your title goes here
dsd
sds


This version is latest chenall build 2011-12-02 with title [IFEXIST filespec] code addition and some small bugfixes to tolerate spaces etc.
Let me know if you try it!

Is this addressed only at chenall? If not, you need to give us more to go on... for testing, an example will help.

Based on Sphinx114 comment, I also suggest an easy to edit menu without need of special editor or utility ;)

--
Any thoughts on the background splash in new (maybe now old) menu?

#53 steve6375

steve6375

    Platinum Member

  • Developer
  • 7567 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 03 December 2011 - 10:30 PM

steve, your grldr works, but where internal grldr menu? I can't edit it by bootice or notepad.

IMHO with [command] in post #43 is better. Command can be various, for example [ls /fred.iso], [is64bit], [geometry (hd1)] or anything else.

I have sent code to chenall and he may add it to a build.

Adding a general IF test inside the [ ] brackets may be possible but it is tricky to code and may have limitations.

P.S. If you used RMPrepUSB to install grub4dos MBR then it will probably not work with bootice. The version of grubinst that I used with RMPrepUSB is a special version which is patched to put a more compatible MBR or PBR on the disk (PBR works with MS-DOS unlike standard grubinst PBR!) - it is not compatible with bootice. Use a normal version of grubinst to install the grub4dos MBR and then copy over my new grldr file.

#54 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 December 2011 - 10:40 PM

Hey peeps, let's make it easy, OK? :)

Forget about "internal menues".

Have *any* VM with a floppy image or hard disk image (or both) ALREADY working with a "normal" grldr and your own menu.lst.


Boot and go to grub4dos command line.
Issue:
find --set-root /IO.SYS
[ENTER]
grub4dos will reply with the actual drive where it found /IO.SYS, as an example (fd0) or (hd0,0).
Replace in the following <drive> wit the actual (fd0) or (hd0,0) or whatever you got.

Add to your EXISTING/TESTED menu.lst TWO COPIES of *any* entry that you know for sure worked on that VM/configuration.
Example say that in your menu.lst there is an entry for MS-DOS, like:

title find MS-DOS root
find --set-root /IO.SYS
chainloader /IO.SYS

Copy it to:

title [IFEXIST <drive>/ifexist.txt] MS-DOS IFEXIST 1

find --set-root /IO.SYS
chainloader /IO.SYS

and

title [ifexist <drive>/ifexist.txt] MS-DOS IFEXIST2
find --set-root /IO.SYS
chainloader /IO.SYS



Try booting and selecting these newly added entries (IF you can see them).

Now create an empty ifexist.txt file from DOS (on the SAME drive you got before and where you have IO.SYS:
type nul>ifexist.txt
Replace the grldr with the one from steve6375
Try booting and selecting these newly added entries (IF you can see them).

Now delete the ifexist.txt file and boot again and try and selecting these newly added entries (IF you can see them).

What happens?

:cheers:
Wonko

P.S. @steve6375 The command is CaSe SeNsItIvE (as expected), maybe it should either be explicitly specified that it needs to be in CAPITAL LETTERS as grub4dos commands are usually lower case. (or decide to re-code it as lower case :unsure:)
I kust did what I described above on an old floppy with the boot code invoking grldr coming from 0.4.4 and the IFEXIST worked EXACTLY as "advertised" :thumbup:

#55 steve6375

steve6375

    Platinum Member

  • Developer
  • 7567 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 03 December 2011 - 10:48 PM

You don't need to specify a drive if the file is on the same drive as the boot drive. You can use:
title [IFEXIST /fred.iso ] Hello

or
title [ IFEXIST	  (bd)/fred.iso		  ]Hello

(note odd spacing in 2nd example!) - both should work as expected...

#56 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 December 2011 - 10:55 PM

You don't need to specify a drive if the file is on the same drive as the boot drive. You can use:

title [IFEXIST /fred.iso ] Hello

or
title [ IFEXIST	  (bd)/fred.iso		  ]Hello

(note odd spacing in 2nd example!) - both should work as expected...

Sure :), but what if (like in my case) I boot the VM from floppy (fd0) which is "root" BUT the /IO.SYS is in on (hd0,0)?

Or, is it possible to have something like:
[IFEXIST find  /ifexist.txt]
or even:
[IFEXIST find --set-root /ifexist.txt]
:unsure:

:cheers:
Wonko

#57 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 03 December 2011 - 11:36 PM

Yup, works fine and resolves my splash issue, thanks ;)

title [IFEXIST /pmagic-6.7.iso ] Parted Magic 6.7



#58 patsch

patsch

    Silver Member

  • Advanced user
  • 785 posts
  •  
    Germany

Posted 04 December 2011 - 10:10 AM

works for me too, many thx

#59 chenall

chenall

    Member

  • Members
  • 60 posts
  •  
    China

Posted 04 December 2011 - 01:24 PM

the new grldr. I think this will be better

please test.

add command iftitle
usage:
iftitle [command] titleinfontitlehelp

Must have at least one space after ']'

grldr

or download from
http://code.google.c...es/detail?id=53


iftitle [if exist (hd0,0)/test.img] (hd0,0)/test.img

map --mem (hd0,0)/test.img (fd0)

map --hook

chainloader (fd0)+1



iftitle [find --set-root /test.img] /test.img

find --set-root /test.img

map --mem /test.img (fd0)

map --hook

chainloader (fd0)+1



iftitle [is64bit] for 64bit system

....

...

Edited by chenall, 04 December 2011 - 01:29 PM.


#60 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 December 2011 - 02:56 PM

the new grldr. I think this will be better

please test.


Perfect. :thumbup:


The iftitle seems like a better option.

If I get it right, the generic syntax is:
iftitle [<command>] Actual Title displayed\nOptional help line


If I may, it could be nice if the "if exist" could use also disks and partitions as argument.
I.e. this works:
iftitle [if exist (hd0,0)/io.sys] If you see me DOS is on (hd0)
But it would be nice if we could have something like:
iftitle [if exist (hd1)] If you see me you have two hard disks

iftitle [if exist (hd1,0)] If you see me you have two hard disks and the second one is partitioned

Or is it already possible *somehow*? :unsure:

:cheers:
Wonko

#61 chenall

chenall

    Member

  • Members
  • 60 posts
  •  
    China

Posted 04 December 2011 - 03:42 PM

iftitle [if exist (hd1)+1] If you see me you have two hard disks

#62 steve6375

steve6375

    Platinum Member

  • Developer
  • 7567 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 December 2011 - 03:44 PM

iftitle [ ls (hd0,0) ] dddd works but ls (hd0,0) > nul does not so cannot stop it displaying on screen.

#63 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 December 2011 - 04:05 PM

iftitle [if exist (hd1)+1] If you see me you have two hard disks


:thumbup:
@steve6375

iftitle [if exist (hd1,0)+1] If you see me you have two hard disks AND first partition on it exists


:)

:cheers:
Wonko

#64 chenall

chenall

    Member

  • Members
  • 60 posts
  •  
    China

Posted 04 December 2011 - 04:11 PM

iftitle [ ls (hd0,0) ] dddd works but ls (hd0,0) > nul does not so cannot stop it displaying on screen.

use this,do not have more space here after "nul".
iftitle [ls (hd0,0)/ > nul] xxxxxx

here is the new test,will stop display on screen.
grldrfortest

@Wonko the Sane
:good:
the generic syntax is:
iftitle [<command>] Actual Title displayednOptional help line

the command can use like menu-init command.

iftitle [checkrange 0x80 read 0x8290] you are boot from harddisk
clear

Edited by chenall, 04 December 2011 - 04:24 PM.


#65 steve6375

steve6375

    Platinum Member

  • Developer
  • 7567 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 December 2011 - 04:31 PM

title reload configure

configfile /menu.lst



iftitle [ ls /grldr ] here is grldr using ls E  YES

boot



iftitle [ ls /grldrx ] here is grldrx using ls F - IF SPACE BEFORE ] like this then stops previous menu from appearing!

boot

@chenall this exact menu gives a strange problem. The 2nd menu item and 3rd menu item are not displayed, but if you remove the space before the ] then it works as expected. There should be no file called grldx present when you test this.

#66 steve6375

steve6375

    Platinum Member

  • Developer
  • 7567 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 December 2011 - 04:37 PM

Should this work - it doesn't...?


SET A=help
iftitle [if "%A%"=="help"] here is grldr using if variable A YES
boot

#67 chenall

chenall

    Member

  • Members
  • 60 posts
  •  
    China

Posted 04 December 2011 - 04:49 PM

Should this work - it doesn't...?


SET A=help
iftitle [if "%A%"=="help"] here is grldr using if variable A YES
boot


it doesn't.

#68 steve6375

steve6375

    Platinum Member

  • Developer
  • 7567 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 December 2011 - 06:03 PM

@Wonko This works



iftitle [find /test.txt ] test find test.txt

echo found test.txt

find --set-root /test.txt

cat /test.txt

pause

root ()


#69 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 December 2011 - 06:35 PM

@Wonko This works

:thumbsup:

:cheers:
Wonko

#70 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 04 December 2011 - 07:09 PM

OK, couple things in recent grldr tests from chenall.

1) foreground/background colors not supported (with splashimage).

2) strange behavior if regular title entries in menu e.g. where not using iftitle entries.

title Boot hard drive
rootnoverify (hd0,0)
hiddenflag (hd0,0) && rootnoverify (hd0,1)
chainloader +1

title CommandLine
commandline

title Shutdown
halt

title Reboot
reboot

Causes countdown timer to start from boot.ini (not menu.lst) and once started, any selection, even iftitle just restarts counter.

3) No PXE Stack warning at load screen (don't know if this is glitch or feature).

Thanks for the hard work ;)

#71 chenall

chenall

    Member

  • Members
  • 60 posts
  •  
    China

Posted 05 December 2011 - 05:25 AM

@amalux
1.the bug will fix next release.
2.???
3.because in embeded menu of grldr the first line is "pxe detect",this is for pxe boot..

#72 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 05 December 2011 - 05:30 AM

2.???

What info can I give you?

What additional info do you need? Can you reproduce this behavior?

Here is the menu where issue occurs Attached File  menu.rar   2.34KB   370 downloads

When you scroll through the list, everything seems OK until you reach one of the title entries without if before it e.g. 'title Boot hard drive'. Then, just by highlighting the entry (not selecting it), a countdown begins but it's the 5 sec. count from my boot.ini, not the 10 sec. count from the menu.lst. Once this occurs, scrolling to next and all subsequent entries just resets the 5 sec. countdown.

#73 chenall

chenall

    Member

  • Members
  • 60 posts
  •  
    China

Posted 05 December 2011 - 06:04 AM

What info can I give you?

What additional info do you need? Can you reproduce this behavior?

Here is the menu where issue occurs Attached File  menu.rar   2.34KB   370 downloads

When you scroll through the list, everything seems OK until you reach one of the title entries without if before it e.g. 'title Boot hard drive'. Then, just by highlighting the entry (not selecting it), a countdown begins but it's the 5 sec. count from my boot.ini, not the 10 sec. count from the menu.lst. Once this occurs, scrolling to next and all subsequent entries just resets the 5 sec. countdown.



in grub4dos_readme.txt


******************************************************************************

***			    Use a single key to select menu item				    ***

******************************************************************************

Some machines have a simplified keyboard. The keyborad might have only the

number keys 0 .. 9 plus a few other keys. When the menu displayed, the user

can strike a key for 8 times. When the menu handler detects the continuous

single keypress, it will assume the user want to use this key to select a menu

item and boot. This single key will act as the RIGHT-ARROW key for the user to

select a menu item. And 5 seconds later after the user stops the keypress,

the selected menu item will automatically boot. Any normal keys can be used as

a single key for this purpose, except for a few functional keys like b, e,

Enter, etc. Once another key is pressed, the feature of Single-Key-Selection

will disappear immediately.



#74 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 05 December 2011 - 07:25 AM

Nope, sorry, this doesn't explain it (good try though) ;)

The countdown doesn't appear, even after 20-30 'continuous single' keystrokes (down arrow) until you land on the first 'title' line. This works going either way around; down to 'title Boot hard drive' or up to 'title Reboot' i.e. only occurs when first non iftitle is reached. This behavior does not occur with old menu/grldr setup even with same menu list and number of keystrokes invoked. Also, it's not a normal countdown; if the timer is allowed to zero out, the selected entry is not launched but rather you are presented with boot.ini options again.

#75 chenall

chenall

    Member

  • Members
  • 60 posts
  •  
    China

Posted 05 December 2011 - 09:23 AM

sorry, I don't know how is going.
How can I reproduce this behavior?
can you please make a iso or image for this?
I use qemu to test.

and you can try the new release(testonly) first
http://grub4dos-chen...b-2011-12-05.7z




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users