Jump to content











Photo
- - - - -

if some.iso not exists then hide this menu entry


  • Please log in to reply
80 replies to this topic

#1 tefole

tefole

    Member

  • Members
  • 49 posts
  • Location:Heidelberg
  •  
    Germany

Posted 10 November 2011 - 06:30 AM

Hi,
due the different sizes (and speeds) of flashdisks/harddisks, i dont copy all the stuff to every flashdisk.
Thats why i have different *.lst files, but its everytime a pain in the ass to update this files and consider them.

Could i not use the find command to hide a specific menu entry, if the corresponding ISO isnt on the flashdisk?

edit: hmm, probably could be done with fallback?!

Edited by tefole, 10 November 2011 - 07:12 AM.


#2 steve6375

steve6375

    Platinum Member

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

Posted 10 November 2011 - 09:35 AM

I don't think so. It would be nice to have a conditional title entry something like

if exist /iso/special.iso title my special iso
xxx
xxx


But what you could do is load the correct menu.lst file by having all of the menu files on the disk and then having your main menu.lst test for the existence of each file.


if exist /FD0-konboot-v1.1-2in1.img set A = 1 && set B = 1
#more lines here to test for files
if %A%%B%==11 set cfg=/menu1.lst
#more lines here
configfile %cfg%

#3 tefole

tefole

    Member

  • Members
  • 49 posts
  • Location:Heidelberg
  •  
    Germany

Posted 10 November 2011 - 10:21 AM

But what you could do is load the correct menu.lst file by having all of the menu files on the disk and then having your main menu.lst test for the existence of each file.

I thought about that too. But that would either mean, that you have to create a separare *.lst for each regarding entry. Its not the best one.

I am a frequently visitor of chenall's blog. As a non-chinese, with google and with some fantasy, i am able to understand the most things :)
Look here please
Probably you can find something interesting here for the mentioned feature?

Edited by tefole, 10 November 2011 - 10:24 AM.


#4 steve6375

steve6375

    Platinum Member

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

Posted 10 November 2011 - 12:10 PM

OK - here is one solution but it is not pretty!
P.S. This won't work under most emulators as writes to a physical device are blocked by most emulators - you must test it on a real h/w boot.


You need 3 menu's as below: IMPORTANT: The characters in --replace=" " must have TWO SPACES between the quotes (one is removed by forum's formatting!)

menu.lst

# prevent listing hex locations when using cat
debug 0
# prevent abort if error
errorcheck off
dd if=()/main.lst of=()/menu1.lst

if exist /FD0-konboot-v1.1-2in1.img cat --locate=K@ --replace=" " /menu1.lst
if exist /mt410.iso cat --locate=M@ --replace=" " /menu1.lst
# put more entries here

#load menu1
configfile /menu1.lst


main.lst

errorcheck on
debug on

K@ title KONBOOTnPress Enter once Kon-Boot starts to run then allow it to reboot your system to Windows
K@ map --mem /FD0-konboot-v1.1-2in1.img (fd0)
# If current grub4dos root drive (UDF)(stored at 0x8280 in memory) is 0x80 (=hd0), remap (hd0) to (hd1), else do nothing
K@ checkrange 0x80 read 0x8280 && map (hd0) (hd1)
# If current grub4dos root drive (UDF) (stored at 0x8280 in memory) is 0x80 (=hd0), remap (hd1) (=internal hard drive) to (hd0), else do nothing
K@ checkrange 0x80 read 0x8280 && map (hd1) (hd0)
K@ map --hook
K@ chainloader (fd0)+1
K@ rootnoverify (fd0)

M@ title MEMTEST86+
M@ find --set-root /mt410.iso
M@ map /mt410.iso (hd32)
M@ map --hook
M@ root (hd32)
M@ chainloader (hd32)

# put more entries here


menu1.lst
(exact duplicate of main.lst or longer than main.lst - MUST NOT BE SHORTER!)

#5 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 10 November 2011 - 12:19 PM

Maybe you have a look into the multiPE project.

The script PEFactoryConfigMultiBootEx.script works with a list of additionable images.

It adds the image to the media and makes an entry in the menu.lst, only when the images item is checked and exists.

Peter

#6 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 10 November 2011 - 07:41 PM

I would agree...A simple "project" to build a customized set of menu files and assemble the "ISO" or UFD is not too hard, and can easily be customized and updated...

#7 steve6375

steve6375

    Platinum Member

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

Posted 10 November 2011 - 08:33 PM

I would agree...A simple "project" to build a customized set of menu files and assemble the "ISO" or UFD is not too hard, and can easily be customized and updated...

i.e. XBOOT, pendrivelinux, YUMI, Universal Installer, Unetbootin, etc. etc.

#8 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 10 November 2011 - 08:41 PM

Post #1 is asking for one universal solution for XBOOT, pendrivelinux, etc. etc. :dubbio:

IMHO he wants to have a working solution for his (unique) configuration.

Peter

#9 steve6375

steve6375

    Platinum Member

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

Posted 10 November 2011 - 08:59 PM

Post #1 is asking for one universal solution for XBOOT, pendrivelinux, etc. etc. :dubbio:

IMHO he wants to have a working solution for his (unique) configuration.

Peter

Which I provided in post #4 :thumbsup:

#10 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 10 November 2011 - 09:14 PM

Which I provided in post #4 :thumbsup:

Just a further thought on it...Could you use an image you DD to a ram disk? Then it could work for an ISO/CD/DVD as well???

#11 steve6375

steve6375

    Platinum Member

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

Posted 10 November 2011 - 10:35 PM

Try this for the menu.lst







# prevent listing hex locations when using cat

debug 0

# prevent abort if error

errorcheck off

map --mem /main.lst (hd32)

map --hook  

if exist /FD0-konboot-v1.1-2in1.img cat --locate=K@ --replace=" " (hd32)+15

if exist /mt410.iso cat --locate=M@ --replace=" "  (hd32)+15

# put more entries here



#load menu in ram

configfile  (hd32)+15





#12 steve6375

steve6375

    Platinum Member

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

Posted 11 November 2011 - 10:45 AM

Improved version using # to start the line so it is treated as a comment. The menu.lst allows for a main.lst menu of 15*512 bytes in length - increase the (60)+15 if your menu is larger than 7.5K.

menu.lst
# prevent listing hex locations when using cat

debug 0

# prevent abort if error

errorcheck off

map --mem /main.lst (60)

map --hook  

# enable menu entries if payload file exists

if exist /FD0-konboot-v1.1-2in1.img cat --locate=#K --replace="  "   (60)+15

if exist /mt410.iso				 cat --locate=#M --replace="  "   (60)+15

# put more entries here

clear

echo Loading Main.lst

#load menu from ram

configfile  (60)+15


main.lst



map --unhook

map --unmap=60



#K title KONBOOTnPress Enter once Kon-Boot starts to run then allow it to reboot your system to Windows

#K errorcheck off

#K map --mem /FD0-konboot-v1.1-2in1.img (fd0)

# If current grub4dos root drive (UDF)(stored at 0x8280 in memory) is 0x80 (=hd0), remap (hd0) to (hd1), else do nothing

#K checkrange 0x80 read 0x8280 && map (hd0) (hd1)

# If current grub4dos root drive (UDF) (stored at 0x8280 in memory) is 0x80 (=hd0), remap (hd1) (=internal hard drive) to (hd0), else do nothing

#K checkrange 0x80 read 0x8280 && map (hd1) (hd0)

#K map --hook

#K chainloader (fd0)+1

#K rootnoverify (fd0)



#M title MEMTEST86+

#M find --set-root /mt410.iso

#M map /mt410.iso (hd32)

#M map --hook

#M root (hd32)

#M chainloader (hd32)



# add more entries here each with unique letter or number #a-#z and #A-#Z #0-#9


http://www.rmprepusb...c-grub4dos-menu

#13 tefole

tefole

    Member

  • Members
  • 49 posts
  • Location:Heidelberg
  •  
    Germany

Posted 12 November 2011 - 06:29 AM

OK - here is one solution but it is not pretty!

No, its a quite smart workaround! Especially the updated version on #12. Thank you man, i'm gonna try this.

The script PEFactoryConfigMultiBootEx.script works with a list of additionable images.
It adds the image to the media and makes an entry in the menu.lst, only when the images item is checked and exists.

Yes, but this would require an additional step on every new compilation.
In addition a quite big adaption/edit/extention with my menu existing menu entries are neccessary and they have to
be included to this kind of scripts. No desire he :)

#14 steve6375

steve6375

    Platinum Member

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

Posted 18 November 2011 - 10:41 AM

Here is a revision of this method but it uses only one menu.lst file!

There must be EXACTLY 5 SPACES after map, cat and configfile




map	 --mem /menu.lst (hd60)

map	 --hook

cat	 --locate="map	 --"	   --replace="#" (hd60)+50 >nul

cat	 --locate="cat	 --locate" --replace="#" (hd60)+50 >nul

cat	 --locate="configfile	 "  --replace="#" (hd60)+50 >nul



#PLACE ALL TEST ENTRIES HERE

if exist /trk3/menu.lst cat --locate=#TR --replace=" " (hd60)+50 >nul





#load menu from ram

echo Loading modified menu.lst...

configfile	 (hd60)+50





# MAIN MENU GOES HERE



map --unhook

map --unmap=hd60



color black/cyan yellow/cyan

timeout 5

default 1



#TR title Trinity Rescue v3.4

# You must set the drive volume label on the next line

#TR set VOL=RMPREPUSB

#TR configfile /trk3/menu.lst





title Hello!

root





Please copy and paste the example at http://sites.google....s-menu#addendum - do NOT copy the example above as the spaces come out wrong!
Note: This code has been updated to replace 60 with hd60 to avoid a floppy error message.

Edited by steve6375, 22 November 2011 - 08:13 PM.


#15 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 18 November 2011 - 03:28 PM

@steve6375
In the snippet you posted, there are some different number of spaces from what you stated.
I selected the contents of your codebox, pasted in Notepad, replaced " " ( 7 spaces) with "1234567", " " (6 spaces) with "123456" and " " (5 spaces) with "12345", etc..
Result (I bolded last of the replaced numbers :

map123456--mem /menu.lst (60)
map123456--hook
cat123456--locate="map123--"1234567--replace="###" (60)+50 >nul
cat123456--locate="cat123--locate" --replace="###" (60)+50 >nul
cat123456--locate="configfile1234"12--replace="###" (60)+50 >nul

#PLACE TEST ENTRIES HERE
if exist /trk3/menu.lst cat --locate=#TR --replace="123" (60)+50 >nul


#load menu from ram
echo Loading modified menu.lst
configfile1234567(60)+50


# MAIN MENU GOES HERE (do not use 5 spaces after map, cat or configfile)

map --unhook
map --unmap=60

#TR title Trinity Rescue v3.4
# You must set the drive volume label on the next line
#TR set VOL=RMPREPUSB
#TR configfile /trk3/menu.lst


title Hello!
root


Can you confirm/deny/correct? :dubbio: (and possibly also spend a few words to explain how it works and/or post a "complete" example)



:cheers:
Wonko

#16 steve6375

steve6375

    Platinum Member

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

Posted 18 November 2011 - 04:19 PM

It is the forum formatting! If I edit the post then the number of spaces are correct (5) in every case - if I copy and paste from the forum post, as you say, it comes out different!

See http://sites.google...s-menu#addendum for a better example that should copy and paste properly!

How it works is also explained on the website tutorial.

#17 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 18 November 2011 - 06:45 PM

I see. :)
Another issue with the stupid board software.

Quick instructions.
Copy and paste the following on Notepad:

mapSTEVE--mem /menu.lst (60)
mapSTEVE--hook
catSTEVE--locate="mapSTEVE--" --replace="#" (60)+50 >nul
catSTEVE--locate="catSTEVE--locate" --replace="#" (60)+50 >nul
catSTEVE--locate="configfileSTEVE" --replace="#" (60)+50 >nul

#PLACE ALL TEST ENTRIES HERE
if exist /trk3/menu.lst cat --locate=#TR --replace=" " (60)+50 >nul


#load menu from ram
echo Loading modified menu.lst...
configfileSTEVE(60)+50


# MAIN MENU GOES HERE

map --unhook
map --unmap=60

color black/cyan yellow/cyan
timeout 5
default 1

#TR title Trinity Rescue v3.4
# You must set the drive volume label on the next line
#TR set VOL=RMPREPUSB
#TR configfile /trk3/menu.lst


title Hello!
root

Replace STEVE with 5 spaces.

:cheers:
Wonko

#18 steve6375

steve6375

    Platinum Member

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

Posted 18 November 2011 - 06:52 PM

done! :2nd:

#19 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 18 November 2011 - 08:56 PM

Hi steve6375,

This is a nice idea but I'm having some trouble; can you check what I have here and tell me where I'm off? Thanks :)

http://www.sendspace.com/file/vjleka

#20 steve6375

steve6375

    Platinum Member

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

Posted 18 November 2011 - 09:24 PM

Works a treat! Are you using latest version of grub4dos as included in RMPrepUSB?

Attached Thumbnails

  • testmenu.jpg


#21 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 18 November 2011 - 09:36 PM

I thought so but will re-check, thanks ;)

#22 steve6375

steve6375

    Platinum Member

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

Posted 22 November 2011 - 12:29 PM

bump - is this working for you now?

#23 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 22 November 2011 - 04:58 PM

Yes, fantastic! Thank you :)

Updating the grldr did the trick for the two file method and I like it very much :good: I'm still going to try the one file option (you were still editing it last I checked) and will report if that's working for me as well. Thanks again for the fun and very useful menu options.

#24 steve6375

steve6375

    Platinum Member

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

Posted 22 November 2011 - 05:03 PM

I have converted my large menu.lst now to just a single large menu.lst and it seems to work well. It also means I can easily edit it using RMPrepUSB and pressing F4 (as RMPrepUSB does not have a function to load main.lst!) :loleverybody: .

#25 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 22 November 2011 - 07:14 PM

OK, both methods work well, there is a minor 'glitch' which I now realize occurs with both methods; there is a brief error that flashes just before the menu loads:

Autodetect Number-of-Heads Failed
Use Default Value 2

Autodetect Sectors-Per-Track Failed
Use Default Value 18


It only appears for a fraction of a second with the two file method but stays for a second or two with the single menu.lst.

Interesting to note, this is the same error I got before with the older version grldr but in that case the error never went away.

Current, single menu.lst I'm using is here:
http://www.mediafire...dbv4clsyrjstlri

Nothing serious but if there's a (simple) way to get rid of it would be nice ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users