new escaping paradigm
authorDaniel Robbins <drobbins@gentoo.org>
Mon, 12 Jan 2004 06:46:55 +0000 (06:46 +0000)
committerDaniel Robbins <drobbins@gentoo.org>
Mon, 12 Jan 2004 06:46:55 +0000 (06:46 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@143 d1e1f19c-881f-0410-ab34-b69fee027534

modules/targets.py
targets/livecd-stage1/livecd-stage1.sh

index 2e3dc3898f01bb3111658f6385694b9dfa8c2507..3f1a42a9a87752c4bec1761c585f28d97ef33a9d 100644 (file)
@@ -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:
index 35fb6a1e0aa1b3f59f638d7741b0b94b9b3e83d6..9f54048795cd74c13708ea1507ed82e714138f5c 100755 (executable)
@@ -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
        ;;