Commit 81e38b00 by Felix Abecassis

lxc-oci: cleanup temporary download directory if umoci is interrupted

parent 63707931
...@@ -38,8 +38,11 @@ LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@" ...@@ -38,8 +38,11 @@ LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@"
# Some useful functions # Some useful functions
cleanup() { cleanup() {
if [ -d "$DOWNLOAD_TEMP" ]; then if [ -d "${DOWNLOAD_TEMP}" ]; then
rm -Rf $DOWNLOAD_TEMP rm -Rf "${DOWNLOAD_TEMP}"
fi
if [ -d "${LXC_ROOTFS}.tmp" ]; then
rm -Rf "${LXC_ROOTFS}.tmp"
fi fi
} }
...@@ -244,7 +247,6 @@ fi ...@@ -244,7 +247,6 @@ fi
umoci unpack ${umoci_args[@]} --image "${DOWNLOAD_TEMP}:latest" "${LXC_ROOTFS}.tmp" umoci unpack ${umoci_args[@]} --image "${DOWNLOAD_TEMP}:latest" "${LXC_ROOTFS}.tmp"
rmdir "${LXC_ROOTFS}" rmdir "${LXC_ROOTFS}"
mv "${LXC_ROOTFS}.tmp/rootfs" "${LXC_ROOTFS}" mv "${LXC_ROOTFS}.tmp/rootfs" "${LXC_ROOTFS}"
rm -rf "${LXC_ROOTFS}.tmp"
OCI_CONF_FILE=$(getconfigpath ${DOWNLOAD_TEMP} latest) OCI_CONF_FILE=$(getconfigpath ${DOWNLOAD_TEMP} latest)
LXC_CONF_FILE="${LXC_PATH}/config" LXC_CONF_FILE="${LXC_PATH}/config"
......
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