]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
download: Don't use an hardcoded exclude list
authorStéphane Graber <stgraber@ubuntu.com>
Tue, 14 Jan 2014 19:12:33 +0000 (14:12 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 14 Jan 2014 20:57:59 +0000 (15:57 -0500)
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@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
templates/lxc-download.in

index 4f28d0c001713fe9327fb4f5bc88f9867a1b4d77..2298a9be5877b71a0f2e253af88468acba85278c 100644 (file)
@@ -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)