View Single Post
Old 15th May 2008
l2fl2f's Avatar
l2fl2f l2fl2f is offline
Real Name: Yves Guerin
Port Guard
 
Join Date: May 2008
Location: Montreal, Quebec, Canada
Posts: 25
Smile Eureka, Bingo !

Hello,

I finally find the way to set, pass and retrieve a variable from the bootloader to my rc.d script file

the solution or the concept:
  1. WARNING: have a freebsd livecd (in case of error or typo in the beatie.4th, the pc won't boot, I warm you, I live this experience yesterday night )
  2. declare your variable into the loader.conf: myvar="toto"
  3. in the beastie.4th
    • declare a variable to handle the selection of your menu
    • add a menu item with your variable (copy and paste)
    • add a code to handle the selection of your menuitem
    • modify your variable (loader.conf) with the setenv function (copy and paste)
  4. in your rc.d script file use the kenv -q myvar to retrieve the value

the code:
  1. loader.conf
    • myvar="toto"
  2. beastie.4th, add in the declaration part
    • variable mymenuselection
    • in the :beastie-menu add this line:
      • printmenuitem ." Passing arg to rc.d file" mymenuselection !
    • in the :beastie-start add this code:
      • dup mymenuselection @ = if
        s" COUCOU" s" myvar" setenv
        0 boot
        then
  3. in your rc.d file:
    • VALUE=`kenv -a myvar` or kenv -q myvar
  4. Save and reboot

Now, I am able to choose from the startup of my laptop which network configuration I will use and I am able to see my splashscreen until X start

Thanks to all of you, who help me to find this solution (especially to richardpl and to ephemera)
Reply With Quote