From dbf15fb393e8f3d3a4b3201d66138a620f3be01c Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 1 Mar 2010 13:46:46 +0000 Subject: [PATCH] Backport supermin hostfiles / bash quoting fix from libguestfs. This also makes small rearrangements to the code to bring it closer to what is in libguestfs's supermin-split.sh.in script. --- febootstrap-to-supermin.sh | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/febootstrap-to-supermin.sh b/febootstrap-to-supermin.sh index 3d79ca5..e8e49e8 100755 --- a/febootstrap-to-supermin.sh +++ b/febootstrap-to-supermin.sh @@ -77,50 +77,62 @@ while read path <&7; do dir=$(dirname "$path") file=$(basename "$path") + # For quoting problems with the bash =~ operator, see bash FAQ + # question E14 here http://tiswww.case.edu/php/chet/bash/FAQ and + # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487387#25 + # (RHBZ#566511). + # Ignore fakeroot.log. if [ "$path" = "./fakeroot.log" ]; then : - # Kernel modules are always copied in from the host, including all - # the dependency information files. - elif [[ "$path" =~ '^\./lib/modules/' ]]; then - : - # All we're going to keep are the special files /init, the daemon, # configuration files (/etc), devices and modifiable stuff (/var). elif [ "$path" = "./init" ]; then echo "$path" >&5 - elif [[ "$path" =~ '^\./etc' || "$path" =~ '^./dev' || "$path" =~ '^\./var' ]]; then + elif [[ "$path" =~ ^\./etc || "$path" =~ ^\./dev || "$path" =~ ^\./var ]] + then echo "$path" >&5 + # Kernel modules are always copied in from the host, including all + # the dependency information files. + elif [[ "$path" =~ ^\./lib/modules/ ]]; then + : + + # On mock/Koji, exclude bogus /builddir directory which for some + # reason contains some yum temporary files (RHBZ#566512). + elif [[ "$path" =~ ^\./builddir ]]; then + : + # Always write directory names to both output files. elif [ -d "$path" ]; then echo "$path" >&5 echo "$path" >&6 # Some libraries need fixed version numbers replaced by wildcards. - elif [[ "$file" =~ '^ld-[.0-9]+\.so$' ]]; then + + elif [[ "$file" =~ ^ld-[.0-9]+\.so$ ]]; then echo "$dir/ld-*.so" >&6 # Special case for libbfd - elif [[ "$file" =~ '^libbfd-.*\.so$' ]]; then + elif [[ "$file" =~ ^libbfd-.*\.so$ ]]; then echo "$dir/libbfd-*.so" >&6 # Special case for libgcc_s--.so.N - elif [[ "$file" =~ '^libgcc_s-.*\.so\.([0-9]+)$' ]]; then + elif [[ "$file" =~ ^libgcc_s-.*\.so\.([0-9]+)$ ]]; then echo "$dir/libgcc_s-*.so.${BASH_REMATCH[1]}" >&6 # libfoo-1.2.3.so - elif [[ "$file" =~ '^lib(.*)-[-.0-9]+\.so$' ]]; then + elif [[ "$file" =~ ^lib(.*)-[-.0-9]+\.so$ ]]; then echo "$dir/lib${BASH_REMATCH[1]}-*.so" >&6 # libfoo-1.2.3.so.1.2.3 (but NOT '*.so.N') - elif [[ "$file" =~ '^lib(.*)-[-.0-9]+\.so\.([0-9]+)\.' ]]; then + elif [[ "$file" =~ ^lib(.*)-[-.0-9]+\.so\.([0-9]+)\. ]]; then echo "$dir/lib${BASH_REMATCH[1]}-*.so.${BASH_REMATCH[2]}.*" >&6 # libfoo.so.1.2.3 (but NOT '*.so.N') - elif [[ "$file" =~ '^lib(.*)\.so\.([0-9]+)\.' ]]; then + elif [[ "$file" =~ ^lib(.*)\.so\.([0-9]+)\. ]]; then echo "$dir/lib${BASH_REMATCH[1]}.so.${BASH_REMATCH[2]}.*" >&6 else -- 1.8.3.1