From: Stéphane Graber Date: Tue, 14 Jan 2014 19:12:33 +0000 (-0500) Subject: download: Don't use an hardcoded exclude list X-Git-Tag: lxc-1.0.0.beta2~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fecf101cc4352e9bf60ed3477196146a65b5c4f6;p=thirdparty%2Flxc.git download: Don't use an hardcoded exclude list Instead of hardcoding --exclude=./dev/*, use a new metadata file "excludes" which lists all the paths or patterns to exclude during extraction (one per line). Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- diff --git a/templates/lxc-download.in b/templates/lxc-download.in index 4f28d0c00..2298a9be5 100644 --- a/templates/lxc-download.in +++ b/templates/lxc-download.in @@ -341,14 +341,20 @@ fi # Unpack the rootfs echo "Unpacking the rootfs" -if [ "$DOWNLOAD_MODE" = "system" ]; then - tar --numeric-owner -xpJf ${LXC_CACHE_PATH}/rootfs.tar.xz -C ${LXC_ROOTFS} -else - tar --anchored --exclude="./dev/*" --numeric-owner -xpJf \ - ${LXC_CACHE_PATH}/rootfs.tar.xz -C ${LXC_ROOTFS} - mkdir -p ${LXC_ROOTFS}/dev/pts/ + +EXCLUDES="" +excludelist=$(relevant_file excludes) +if [ -f "${excludelist}" ]; then + while read line; do + EXCLUDES="$EXCLUDES --exclude=$line" + done < $excludelist fi +tar --anchored ${EXCLUDES} --numeric-owner -xpJf \ + ${LXC_CACHE_PATH}/rootfs.tar.xz -C ${LXC_ROOTFS} + +mkdir -p ${LXC_ROOTFS}/dev/pts/ + # Setup the configuration configfile=$(relevant_file config) fstab=$(relevant_file fstab)