[lxc-devel] [PATCH 2/4] download: Don't use an hardcoded exclude list

Serge Hallyn serge.hallyn at ubuntu.com
Tue Jan 14 20:30:26 UTC 2014


Quoting Stéphane Graber (stgraber at ubuntu.com):
> 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 <stgraber at ubuntu.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  templates/lxc-download.in | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/templates/lxc-download.in b/templates/lxc-download.in
> index 4f28d0c..2298a9b 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)
> -- 
> 1.8.5.2
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list