From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Idwpq-0007vM-Mk for garchives@archives.gentoo.org; Fri, 05 Oct 2007 23:43:59 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.1/8.14.0) with SMTP id l95NXnZe017135; Fri, 5 Oct 2007 23:33:49 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by robin.gentoo.org (8.14.1/8.14.0) with ESMTP id l95NVogY014820 for ; Fri, 5 Oct 2007 23:31:51 GMT Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 8A43364D2B for ; Fri, 5 Oct 2007 23:31:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Score: -1.795 X-Spam-Level: X-Spam-Status: No, score=-1.795 required=5.5 tests=[AWL=0.804, BAYES_00=-2.599] Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CEFKaF0gzVS5 for ; Fri, 5 Oct 2007 23:31:44 +0000 (UTC) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 87A0764861 for ; Fri, 5 Oct 2007 23:31:43 +0000 (UTC) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Idwdi-0005UK-A5 for gentoo-dev@gentoo.org; Fri, 05 Oct 2007 23:31:26 +0000 Received: from static24-72-113-196.yorkton.accesscomm.ca ([24.72.113.196]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Oct 2007 23:31:26 +0000 Received: from dirtyepic by static24-72-113-196.yorkton.accesscomm.ca with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Oct 2007 23:31:26 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-dev@lists.gentoo.org From: Ryan Hill Subject: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in eclass: gnustep-base.eclass Date: Fri, 05 Oct 2007 17:31:10 -0600 Message-ID: References: <20071005180356.GK29572@supernova> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: static24-72-113-196.yorkton.accesscomm.ca User-Agent: Thunderbird 2.0.0.6 (X11/20070923) In-Reply-To: <20071005180356.GK29572@supernova> Sender: news X-Archives-Salt: aed94203-26dc-4bd4-ae9d-cc97874f46cb X-Archives-Hash: 330f7f56a71e7783f65a77059b10a882 Donnie Berkholz wrote: > On 10:51 Fri 05 Oct , Bernard Cafarelli (voyageur) wrote: >> 1.4 eclass/gnustep-base.eclass >> >> file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?rev=1.4&view=markup >> plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?rev=1.4&content-type=text/plain >> diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?r1=1.3&r2=1.4 > >> @@ -166,8 +166,43 @@ >> >> local cfile=config-${PN}.sh >> >> - echo '#!/usr/bin/env bash' > "${T}"/${cfile} >> - echo "echo Applying ${P} default configuration ..." >> "${T}"/${cfile} >> + cat << EOF > "${T}"/${cfile} >> +#!/usr/bin/env bash >> +gnustep_append_default() { >> + if [[ -z \$1 || -z \$2 || -z \$3 ]]; then >> + echo "warning: invalid script invocation" >> + return >> + fi >> + dom=\$1 >> + key=\$2 >> + val=\$3 >> + cur=\$(defaults read \${dom} \${key}) 2> /dev/null >> + if [[ -z \$cur ]] ; then >> + echo " * setting \${dom} \${key}" >> + defaults write \${dom} \${key} "( \${val} )" >> + elif [[ \${cur} != *\${val}* ]] ; then >> + echo " * adding \${val} to \${dom} \${key}" >> + echo "\${cur%)\'}, \"\${val}\" )'" | defaults write >> + else >> + echo " * \${val} already present in \${dom} \${key}" >> + fi >> +} >> + >> +gnustep_set_default() { >> + if [[ -z \$1 || -z \$2 || -z \$3 ]]; then >> + echo "warning: invalid script invocation" >> + return >> + fi >> + dom=\$1 >> + key=\$2 >> + val=\$3 >> + echo " * setting \${dom} \${key}" >> + defaults write \${dom} \${key} \${val} >> +} >> + >> +echo "Applying ${P} default configuration ..." >> +EOF >> + > > There's gotta be a better way of doing this. All those escapes really > start to obfuscate the code. Anyone got a better idea? > > Thanks, > Donnie If there aren't any variables that you actually need expanded in the script (i didn't see any but could have easily missed it), just escape the termination marker, ie. cat << \EOF > "${T}"/${cfile} or cat << 'EOF' > "${T}"/${cfile} This turns off parameter and arithmetic expansion and command substitution. -- fonts / wxWindows / gcc-porting / treecleaners EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662 (0xF9A40662) -- gentoo-dev@gentoo.org mailing list