[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#742671: seeding base-installer/debootstrap_script with an absolute path emits a warning, and just a codename results in an error



Package: base-installer
Version: 1.145

While reading through the code to figure out the format of the values
expected for "base-installer/debootstrap_script", I noticed that the
code in base-installer prepends "/usr/share/debootstrap/scripts" when it
checks this value, so I assumed the expected format must be something
like "sid".  When something like "sid" is sent, base-installer doesn't
complain, but debootstrap fatal errors because it can't find the script.
When something like "/usr/share/debootstrap/scripts/sid" is given,
base-installer throws a warning (which I can't figure out why it's a
warning and not an error, since the code uses the "error" helper), but
debootstrap is happy and the install continues successfully.

I've attached a patch that makes either of these values work as expected
by prepending "/usr/share/debootstrap/scripts" if the given value exists
within that directory, and only throwing a warning if the value given
either isn't an absolute path that exists or isn't inside the
debootstrap scripts directory.

My proposed d/changelog update is as follows:

  [ Tianon Gravi ]
  * Fix warning given for absolute path "debootstrap_script" values.
  * Update "debootstrap_script" logic to allow bareword script names
    like "sid" as well as absolute paths.

Of course, I'm open to tweaking any aspect of this, especially to better
fit the expected contribution style or scripting preferences. :)

♥,
- Tianon
diff --git a/debian/bootstrap-base.postinst b/debian/bootstrap-base.postinst
index ed2e0ab..7e12a5f 100755
--- a/debian/bootstrap-base.postinst
+++ b/debian/bootstrap-base.postinst
@@ -23,7 +23,9 @@ EXCLUDES="$(printf '%s' "$RET" | sed 's/ /,/g')" || true
 # Check if a specific script should be used
 db_get base-installer/debootstrap_script
 DEBOOTSTRAP_SCRIPT="$RET"
-if [ ! -e /usr/share/debootstrap/scripts/"$DEBOOTSTRAP_SCRIPT" ]; then
+if [ -e /usr/share/debootstrap/scripts/"$DEBOOTSTRAP_SCRIPT" ]; then
+	DEBOOTSTRAP_SCRIPT=/usr/share/debootstrap/scripts/"$DEBOOTSTRAP_SCRIPT"
+elif [ ! -e "$DEBOOTSTRAP_SCRIPT" ]; then
 	error "debootstrap script '$DEBOOTSTRAP_SCRIPT' doesn't exist"
 fi
 

Reply to: