From 90909d28eac257cfd6289992cf0d0663d6726da0 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Wed, 20 Feb 2008 10:29:32 +0000 Subject: [PATCH] Remove .debs from the instance filesystem MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch removes the .debs which were used in the debootstrap process via a find and xargs invocation (as opposed to chroot $TMPDIR apt-get clean). The main reason for this is that: - we don't want the created cache to contain the debs (it's unreasonably larger than needed) - but we want an instance created with the cache to be the same as without cache The patch also adds ‘-f’ to the rm and mv invocations which didn't have it. Reviewed-by: imsnah --- create | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/create b/create index 661f364..9bede89 100755 --- a/create +++ b/create @@ -60,7 +60,7 @@ mount $blockdev $TMPDIR # default due to the standard umask) if [ -f "$CACHE_FILE" ]; then find "$CACHE_FILE" -perm -0200 -daystart -mtime +14 -print0 | \ - xargs -r0 rm + xargs -r0 rm -f fi if [ -f "$CACHE_FILE" ]; then @@ -75,6 +75,10 @@ else debootstrap --include="$EXTRAPKG" etch $TMPDIR $MIRROR + # remove the downloaded debs, as they are no longer needed + find "$TMPDIR/var/cache/apt/archives" -type f -name '*.deb' -print0 | \ + xargs -r0 rm -f + # remove the persistent-net rules, otherwise it will remember the node's # interfaces as eth0, eth1, ... @@ -83,7 +87,7 @@ else if [ ! -e no_cache ]; then TMP_CACHE=`mktemp "${CACHE_FILE}.XXXXXX"` tar cf "$TMP_CACHE" -C $TMPDIR . - mv "$TMP_CACHE" "$CACHE_FILE" + mv -f "$TMP_CACHE" "$CACHE_FILE" fi fi -- 1.7.2.5