bootstrap-vz/bootstrapvz/plugins/minimize_size/assets/bootstrap-script.sh
Anders Ingemann 6ae859f886 Implement locale filter in minimize_size plugin
This filter is rather aggressive, since it also hooks into the
bootstrapping process itself to prevent debootstrap from unpacking
specific locale files
2015-12-13 19:41:16 +01:00

26 lines
1,008 B
Bash

#!/bin/sh
# This script does not override anything defined in /usr/share/debootstrap/scripts
# Instead we use it to redefine extract_dpkg_deb_data(), so that we may exclude
# certain files during bootstrapping.
extract_dpkg_deb_data () {
local pkg="$1"
local excludes_file="/tmp/bootstrap-vz-excludes-$$"
# List all files in $pkg and run them through the filter (avoid exit status >0 if no matches are found)
dpkg-deb --fsys-tarfile "$pkg" | tar -t | BOOTSTRAP_FILES_FILTER_PATH > "$excludes_file" || true
dpkg-deb --fsys-tarfile "$pkg" | tar --exclude-from "$excludes_file" -xf -
rm "$excludes_file"
}
# Direct copypasta from the debootstrap script where it determines
# which script to run. We do exactly the same but leave out the
# if [ "$4" != "" ] part so that we can source the script that
# should've been sourced in this scripts place.
SCRIPT="$DEBOOTSTRAP_DIR/scripts/$SUITE"
if [ -n "$VARIANT" ] && [ -e "${SCRIPT}.${VARIANT}" ]; then
SCRIPT="${SCRIPT}.${VARIANT}"
fi
. $SCRIPT