From: Daniel Robbins Date: Mon, 12 Jan 2004 06:46:55 +0000 (+0000) Subject: new escaping paradigm X-Git-Tag: CATALYST_1_0_1~97 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f5d113578aa9aacebac425cf6d490e64304211c0;p=catalyst.git new escaping paradigm git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@143 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/modules/targets.py b/modules/targets.py index 2e3dc389..3f1a42a9 100644 --- a/modules/targets.py +++ b/modules/targets.py @@ -417,11 +417,10 @@ class livecd_stage1_target(generic_stage_target): generic_stage_target.__init__(self,spec,addlargs) def run_local(self): - mypack=self.settings["livecd/packages"][:] - for x in range(0,len(mypack)): - #surround args with quotes for passing to bash, allows things like "<" to remain intact - mypack[x]="'"+mypack[x]+"'" - mypack=string.join(mypack) + mypack=string.join(self.settings["livecd/packages"]) + #escape ">" and "<" for the shell (using backslash) + mypack=string.replace(mypack,">","\\>") + mypack=string.replace(mypack,"<","\\<") try: cmd("/bin/bash "+self.settings["sharedir"]+"/targets/livecd-stage1/livecd-stage1.sh run "+mypack) except CatalystError: diff --git a/targets/livecd-stage1/livecd-stage1.sh b/targets/livecd-stage1/livecd-stage1.sh index 35fb6a1e..9f540487 100755 --- a/targets/livecd-stage1/livecd-stage1.sh +++ b/targets/livecd-stage1/livecd-stage1.sh @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/Attic/livecd-stage1.sh,v 1.4 2004/01/12 06:35:05 drobbins Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/Attic/livecd-stage1.sh,v 1.5 2004/01/12 06:46:55 drobbins Exp $ case $1 in enter) @@ -20,15 +20,12 @@ run) USE="build" emerge portage #turn off auto-use: export USE_ORDER="env:conf:defaults" - for x in "$@" - do - if [ -n "${clst_PKGCACHE}" ] - then - emerge --usepkg --buildpkg --noreplace "\$x" || exit 1 - else - emerge --noreplace "\$x" || exit 1 - fi - done + if [ -n "${clst_PKGCACHE}" ] + then + emerge --usepkg --buildpkg --noreplace $* || exit 1 + else + emerge --noreplace $* || exit 1 + fi EOF [ $? -ne 0 ] && exit 1 ;;