All of lore.kernel.org
 help / color / mirror / Atom feed
From: adrian15 <adrian15sgd@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: How one is supposed to write kind-of-library cfg files?
Date: Sun, 16 Mar 2014 05:21:20 +0100	[thread overview]
Message-ID: <532526C0.2090808@gmail.com> (raw)
In-Reply-To: <53251F44.3000505@gmail.com>

El 16/03/14 04:49, adrian15 escribió:
> ( Using 2.02~beta2-7 from Debian Unstable  )
>
>    I have tried to write some cfg files to kind of organise them as
> libraries but it does not work as expected.
>
>    It seems as the sourced cfg files are being interpreted.

I have managed to write a minimal working example. It would seem that 
the problem is having a function inside another function.


Is it perhaps not officially supported?

The problem happens when one selects: "This is a submenu..." .

error: syntax error
error: Incorrect command.
error: syntax error
...
can't find command thisisanunknowncommand
...
error: syntax error



Thank you.

############### caller.cfg

function process_option {

   set option_cfg="$1"
   source "${option_cfg}"
   menuentry "${option_title}" {
     source "${option_cfg}"
     run_option
   }

}

menuentry $"Languages..." {
   configfile "${prefix}/language_select.cfg"
}

submenu $"This is a submenu..." {

   process_option "${prefix}/called.cfg"

}

menuentry $"Everything" {
   configfile "${prefix}/everything.cfg"
}

################ called.cfg

set option_title=$"The called option"

function run_option {

     function freebsd_ufs_variants {
	set device=$1
	set fstype=$2
	set uuid=$3

	menuentry "${finaloption_tab_str}FreeBSD ($fstype $device) (Default 
boot loader)" $device $uuid {
	    set root=$2

	    kfreebsd /boot/loader
	}
     }

   thisisanunknowncommand
   menuentry "menuinsideoption" {
     source "${prefix}/topbootmenu.cfg"
     set root="(hd0,0)"
     chainloader +1
   }

}



adrian15
-- 
Support free software. Donate to Super Grub Disk. Apoya el software 
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/


  reply	other threads:[~2014-03-16  4:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-16  3:49 How one is supposed to write kind-of-library cfg files? adrian15
2014-03-16  4:21 ` adrian15 [this message]
2014-03-16  5:49   ` Andrey Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532526C0.2090808@gmail.com \
    --to=adrian15sgd@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.