Debootstrap does not work on an Arch Linux LiveCD instance because `ar' is not available. The following patch fixes this.
>From ced56c5b06bc52009c0d6fc6cc8b6132e898f3c5 Mon Sep 17 00:00:00 2001 From: Alex Austin <[email protected]> Date: Thu, 10 Apr 2014 14:19:56 -0500 Subject: [PATCH] Add bsdtar support This allows debootstrap to work on non-debian-based live boot instances that don't have binutils installed. Example: Arch Linux LiveCD --- functions | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/functions b/functions index 4e3955a..553f28f 100644 --- a/functions +++ b/functions @@ -785,7 +785,7 @@ get_debs () { ################################################################ extraction -EXTRACTORS_SUPPORTED="dpkg-deb ar" +EXTRACTORS_SUPPORTED="dpkg-deb ar bsdtar" # Native dpkg-deb based extractors extract_dpkg_deb_field () { @@ -829,6 +829,33 @@ extract_ar_deb_data () { fi } +extract_bsdtar_deb_field () { + local pkg="$1" + local field="$2" + + bsdtar -O -xf "$pkg" control.tar.gz | zcat | + bsdtar -O -xf - control ./control 2>/dev/null | + grep -i "^$field:" | sed -e 's/[^:]*: *//' | head -n 1 +} + +extract_bsdtar_deb_data () { + local pkg="$1" + local tarball=$(bsdtar tf "$pkg" | grep "^data.tar.[bgx]z") + + case "$tarball" in + data.tar.gz) cat_cmd=zcat ;; + data.tar.bz2) cat_cmd=bzcat ;; + data.tar.xz) cat_cmd=xzcat ;; + *) error 1 UNKNOWNDATACOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;; + esac + + if type $cat_cmd >/dev/null 2>&1; then + bsdtar -O -xf "$pkg" "$tarball" | $cat_cmd | bsdtar -xf - + else + error 1 UNPACKCMDUNVL "Extracting %s requires the %s command, which is not available" "$pkg" "$cat_cmd" + fi +} + valid_extractor () { local extractor="$1" -- 1.9.1

