From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1WP2Zt-0003wj-Ix for mharc-grub-devel@gnu.org; Sun, 16 Mar 2014 00:21:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WP2Zm-0003ia-6v for grub-devel@gnu.org; Sun, 16 Mar 2014 00:21:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WP2Zg-00070D-AA for grub-devel@gnu.org; Sun, 16 Mar 2014 00:21:30 -0400 Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]:63673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WP2Zg-000709-2h for grub-devel@gnu.org; Sun, 16 Mar 2014 00:21:24 -0400 Received: by mail-we0-f169.google.com with SMTP id w62so3486045wes.28 for ; Sat, 15 Mar 2014 21:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=eFjwETp1YxzFuNaNb13iCHs4w5F26Tb2AFCati1WS2I=; b=MWzPZ9AXKUpeM6aGJjtE3Fiv+tEZOwoT3kEfunnd4SUT2Hxx8yoXvzY5Rfm9urrUJ6 E4Th3e9qllRSTb/Kks12z0Hhl+Q4FAnHfaAukF0l0HKISYNZ3FWpJyGXm9eAM4BaH5X8 uEHmFUtg/Y4jX5ZRWsZFAC/JdMG6DFnH1MhxFzFNnKE1rFNaKSc+E++26Bnity39q/1O 6h06vrrpJNbRF2h4dQQYKrWJcpPFQU/bxvtW+HbX+lV724674KDBceTsKyv4XXn3kmR2 cAw+mNkZuOmhyelAGP4oBjoLGqv6kvWi4P7mmVZR80WBoyn8G1mq+cDVeP0YxTt9zR88 f11g== X-Received: by 10.194.91.232 with SMTP id ch8mr13032784wjb.13.1394943683268; Sat, 15 Mar 2014 21:21:23 -0700 (PDT) Received: from [192.168.10.45] (136.Red-88-21-16.staticIP.rima-tde.net. [88.21.16.136]) by mx.google.com with ESMTPSA id q15sm26405384wjw.18.2014.03.15.21.21.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 15 Mar 2014 21:21:22 -0700 (PDT) Message-ID: <532526C0.2090808@gmail.com> Date: Sun, 16 Mar 2014 05:21:20 +0100 From: adrian15 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.3.0 MIME-Version: 1.0 To: The development of GRUB 2 Subject: Re: How one is supposed to write kind-of-library cfg files? References: <53251F44.3000505@gmail.com> In-Reply-To: <53251F44.3000505@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::229 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Mar 2014 04:21:36 -0000 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/