All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] liblxc: handle interruption/failure of lxc-debian more gracefully
@ 2009-02-05  9:22 Matt Helsley
  2009-02-05  9:32 ` [PATCH] liblxc: Update lxc-debian to use the lenny release Matt Helsley
  2009-02-05 12:05 ` [PATCH] liblxc: handle interruption/failure of lxc-debian more gracefully Daniel Lezcano
  0 siblings, 2 replies; 9+ messages in thread
From: Matt Helsley @ 2009-02-05  9:22 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: Containers

If lxc-debian fails or is interrupted during debootstrap then the next
invocation of lxc-debian breaks because it only checks for the existence
of the directory. This forces the user to remove the cache by hand to
retry the create step.

Let's allow the user to re-run lxc-debian to resume/retry. Store the
cache in a partial-$ARCH directory until debootstrap succeeds. Then move
the valid cache to its final destination.

Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 scripts/lxc-debian.in |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: lxc/scripts/lxc-debian.in
===================================================================
--- lxc.orig/scripts/lxc-debian.in
+++ lxc/scripts/lxc-debian.in
@@ -217,19 +217,20 @@ create() {
 		
 		echo "not cached"
 		
-		mkdir -p "$CACHE/rootfs-$ARCH"
+		mkdir -p "$CACHE/partial-$ARCH"
 		
 	        # download a mini debian into a cache
 		echo "Downloading debian minimal ..."
 		debootstrap --verbose --variant=minbase --arch=$ARCH \
 		    --include apache,netbase,net-tools,iproute,openssh-server \
-		    etch $CACHE/rootfs-$ARCH http://ftp.debian.org/debian
+		    etch $CACHE/partial-$ARCH http://ftp.debian.org/debian
 		
 		RESULT=$?
 		if [ "$RESULT" != "0" ]; then
 		    echo "Failed to download the rootfs, aborting."
 		    exit 1
 		fi
+		mv "$CACHE/partial-$ARCH" "$CACHE/rootfs-$ARCH"
 		echo "Download complete."
 	    else
 		echo "Found."

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-03-08 16:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-05  9:22 [PATCH] liblxc: handle interruption/failure of lxc-debian more gracefully Matt Helsley
2009-02-05  9:32 ` [PATCH] liblxc: Update lxc-debian to use the lenny release Matt Helsley
2009-02-09 17:14   ` Daniel Lezcano
     [not found]     ` <49906491.8050200-GANU6spQydw@public.gmane.org>
2009-02-09 20:58       ` Matt Helsley
2009-02-09 21:45         ` Daniel Lezcano
     [not found]           ` <4990A410.3040701-GANU6spQydw@public.gmane.org>
2009-02-09 23:43             ` Dan Smith
     [not found]               ` <87d4dr41o0.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-02-10  8:28                 ` [PATCH] liblxc: add scripts/lxc-fedora.in (WAS: Re: [PATCH] liblxc: Update lxc-debian to use the lenny release) Matt Helsley
2009-03-08 16:34                   ` Daniel Lezcano
2009-02-05 12:05 ` [PATCH] liblxc: handle interruption/failure of lxc-debian more gracefully Daniel Lezcano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.