Commit 5cf397c9 authored by Colin Watson's avatar Colin Watson

* Extensive quoting fixes, allowing installation to a target containing

  spaces (closes: #387673).

r48817
parent 5d11a875
......@@ -6,6 +6,8 @@ debootstrap (1.0.2) UNRELEASED; urgency=low
dep-resolved by default.
[ Colin Watson ]
* Extensive quoting fixes, allowing installation to a target containing
spaces (closes: #387673).
* scripts/debian/sid: Handle libc0.3 on hurd-i386 (thanks, Michael Banck;
closes: #314304).
......
......@@ -246,9 +246,9 @@ else
TARGET="${TARGET%/}"
if [ "${TARGET#/}" = "${TARGET}" ]; then
if [ "${TARGET%/*}" = "$TARGET" ] ; then
TARGET="$(echo `pwd`/$TARGET)"
TARGET="$(echo "`pwd`/$TARGET")"
else
TARGET="$(cd ${TARGET%/*}; echo `pwd`/${TARGET##*/})"
TARGET="$(cd "${TARGET%/*}"; echo "`pwd`/${TARGET##*/}")"
fi
fi
......@@ -319,7 +319,7 @@ else
# stdout: I:/W:/etc information
# $TARGET/debootstrap/debootstrap.log: full log of debootstrap run
exec 4>&1
exec >>$TARGET/debootstrap/debootstrap.log
exec >>"$TARGET/debootstrap/debootstrap.log"
exec 2>&1
fi
......@@ -430,17 +430,17 @@ if am_doing_phase first_stage; then
first_stage_install
if ! am_doing_phase second_stage; then
cp "$0" $TARGET/debootstrap/debootstrap
cp $DEBOOTSTRAP_DIR/functions $TARGET/debootstrap/functions
cp $SCRIPT $TARGET/debootstrap/suite-script
echo "$ARCH" >$TARGET/debootstrap/arch
echo "$SUITE" >$TARGET/debootstrap/suite
cp "$0" "$TARGET/debootstrap/debootstrap"
cp $DEBOOTSTRAP_DIR/functions "$TARGET/debootstrap/functions"
cp $SCRIPT "$TARGET/debootstrap/suite-script"
echo "$ARCH" >"$TARGET/debootstrap/arch"
echo "$SUITE" >"$TARGET/debootstrap/suite"
[ "" = "$VARIANT" ] ||
echo "$VARIANT" >$TARGET/debootstrap/variant
echo "$required" >$TARGET/debootstrap/required
echo "$base" >$TARGET/debootstrap/base
echo "$VARIANT" >"$TARGET/debootstrap/variant"
echo "$required" >"$TARGET/debootstrap/required"
echo "$base" >"$TARGET/debootstrap/base"
chmod 755 $TARGET/debootstrap/debootstrap
chmod 755 "$TARGET/debootstrap/debootstrap"
fi
fi
......@@ -463,28 +463,28 @@ if am_doing_phase second_stage; then
rm -f "$TARGET/etc/apt/sources.list"
fi
if [ "${MIRRORS#http://}" != "$MIRRORS" ]; then
setup_apt_sources ${MIRRORS%% *}
mv_invalid_to ${MIRRORS%% *}
setup_apt_sources "${MIRRORS%% *}"
mv_invalid_to "${MIRRORS%% *}"
else
setup_apt_sources $DEF_MIRROR
mv_invalid_to $DEF_MIRROR
setup_apt_sources "$DEF_MIRROR"
mv_invalid_to "$DEF_MIRROR"
fi
if [ -e $TARGET/debootstrap/debootstrap.log ]; then
if [ -e "$TARGET/debootstrap/debootstrap.log" ]; then
if [ "$KEEP_DEBOOTSTRAP_DIR" = true ]; then
cp $TARGET/debootstrap/debootstrap.log $TARGET/var/log/bootstrap.log
cp "$TARGET/debootstrap/debootstrap.log" "$TARGET/var/log/bootstrap.log"
else
# debootstrap.log is still open as stdout/stderr and needs to remain
# so, but after unlinking it some NFS servers implement this by a
# temporary file in the same directory, which makes it impossible to
# rmdir that directory. Moving it instead works around the problem.
mv $TARGET/debootstrap/debootstrap.log $TARGET/var/log/bootstrap.log
mv "$TARGET/debootstrap/debootstrap.log" "$TARGET/var/log/bootstrap.log"
fi
fi
sync
if [ "$KEEP_DEBOOTSTRAP_DIR" = true ]; then
if [ -x $TARGET/debootstrap/debootstrap ]; then
if [ -x "$TARGET/debootstrap/debootstrap" ]; then
chmod 644 "$TARGET/debootstrap/debootstrap"
fi
else
......
This diff is collapsed.
......@@ -42,7 +42,7 @@ first_stage_install () {
local pkg=$1
local deb="$(debfor $pkg)"
local ver="$(
ar -p $TARGET/$deb control.tar.gz | zcat |
ar -p "$TARGET/$deb" control.tar.gz | zcat |
tar -O -xf - control ./control 2>/dev/null |
sed -ne 's/^Version: *//Ip' | head -n 1
)"
......
......@@ -151,7 +151,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTBASE "Installing base system" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTBASE "Installing base system" #3
x_core_install dpkg
......@@ -166,7 +166,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTBASE "Installing base system" #5
x_core_install perl-base
p; progress $baseprog $bases INSTBASE "Installing base system" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTBASE "Installing base system" #7
x_core_install debconf
......
......@@ -112,7 +112,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTBASE "Installing base system" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTBASE "Installing base system" #3
x_core_install dpkg
......@@ -127,7 +127,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTBASE "Installing base system" #5
x_core_install perl-base
p; progress $baseprog $bases INSTBASE "Installing base system" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTBASE "Installing base system" #7
......
......@@ -116,7 +116,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTBASE "Installing base system" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTBASE "Installing base system" #3
x_core_install dpkg
......@@ -133,7 +133,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTBASE "Installing base system" #5
x_core_install perl-base
p; progress $baseprog $bases INSTBASE "Installing base system" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTBASE "Installing base system" #7
......
......@@ -52,8 +52,8 @@ first_stage_install () {
chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
if [ -x $TARGET/usr/bin/md5sum.textutils -a \! -e $TARGET/usr/bin/md5sum ]; then
cp $TARGET/usr/bin/md5sum.textutils $TARGET/usr/bin/md5sum
if [ -x "$TARGET/usr/bin/md5sum.textutils" -a \! -e "$TARGET/usr/bin/md5sum" ]; then
cp "$TARGET/usr/bin/md5sum.textutils" "$TARGET/usr/bin/md5sum"
fi
if doing_variant fakechroot; then
......@@ -111,7 +111,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -131,7 +131,7 @@ second_stage_install () {
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
......
......@@ -136,7 +136,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTBASE "Installing base system" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTBASE "Installing base system" #3
x_core_install dpkg
......@@ -151,7 +151,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTBASE "Installing base system" #5
x_core_install perl-base
p; progress $baseprog $bases INSTBASE "Installing base system" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTBASE "Installing base system" #7
x_core_install debconf
......
......@@ -112,7 +112,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTBASE "Installing base system" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTBASE "Installing base system" #3
x_core_install dpkg
......@@ -127,7 +127,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTBASE "Installing base system" #5
x_core_install perl-base
p; progress $baseprog $bases INSTBASE "Installing base system" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTBASE "Installing base system" #7
......
......@@ -89,7 +89,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -105,7 +105,7 @@ second_stage_install () {
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
......
......@@ -96,7 +96,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -112,7 +112,7 @@ second_stage_install () {
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
......
......@@ -110,7 +110,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -130,7 +130,7 @@ second_stage_install () {
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
......@@ -152,7 +152,7 @@ second_stage_install () {
if doing_variant fakechroot; then
# fix initscripts postinst (no mounting possible, and wrong if condition)
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' $TARGET/var/lib/dpkg/info/initscripts.postinst
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
fi
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
......
......@@ -110,7 +110,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -130,7 +130,7 @@ second_stage_install () {
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
......@@ -152,10 +152,10 @@ second_stage_install () {
if doing_variant fakechroot; then
# fix initscripts postinst (no mounting possible, and wrong if condition)
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' $TARGET/var/lib/dpkg/info/initscripts.postinst
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
# kill libdevmapper postinst; it tries to create /dev/mapper/
rm $TARGET/var/lib/dpkg/info/libdevmapper1*.postinst
rm "$TARGET/var/lib/dpkg/info/libdevmapper1"*.postinst
fi
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
......
......@@ -100,7 +100,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -120,7 +120,7 @@ second_stage_install () {
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
......@@ -142,7 +142,7 @@ second_stage_install () {
if doing_variant fakechroot; then
# fix initscripts postinst (no mounting possible, and wrong if condition)
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' $TARGET/var/lib/dpkg/info/initscripts.postinst
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
fi
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
......
......@@ -109,7 +109,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -124,7 +124,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
x_core_install debconf
......
......@@ -105,7 +105,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -120,7 +120,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
......
......@@ -100,7 +100,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -115,7 +115,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
x_core_install debconf
......
......@@ -105,7 +105,7 @@ second_stage_install () {
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk $TARGET/usr/bin/awk
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-files base-passwd
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
......@@ -120,7 +120,7 @@ second_stage_install () {
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm $TARGET/usr/bin/awk
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment