Commit 85248107 by dlezcano

handle interruption/failure of lxc-debian more gracefully

From: Matt Helsley <matthltc@us.ibm.com> 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: 's avatarMatt Helsley <matthltc@us.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent ff218c25
...@@ -212,19 +212,20 @@ create() { ...@@ -212,19 +212,20 @@ create() {
echo "not cached" echo "not cached"
mkdir -p "$CACHE/rootfs-$ARCH" mkdir -p "$CACHE/partial-$ARCH"
# download a mini debian into a cache # download a mini debian into a cache
echo "Downloading debian minimal ..." echo "Downloading debian minimal ..."
debootstrap --verbose --variant=minbase --arch=$ARCH \ debootstrap --verbose --variant=minbase --arch=$ARCH \
--include apache,netbase,net-tools,iproute,openssh-server \ --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=$? RESULT=$?
if [ "$RESULT" != "0" ]; then if [ "$RESULT" != "0" ]; then
echo "Failed to download the rootfs, aborting." echo "Failed to download the rootfs, aborting."
exit 1 exit 1
fi fi
mv "$CACHE/partial-$ARCH" "$CACHE/rootfs-$ARCH"
echo "Download complete." echo "Download complete."
else else
echo "Found." echo "Found."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment