From: Felix Abecassis Date: Fri, 1 Dec 2017 06:51:38 +0000 (-0800) Subject: lxc-oci: cleanup temporary download directory if umoci is interrupted X-Git-Tag: lxc-3.0.0.beta1~145^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81e38b00597be6880d232d8807cde33159b3dd68;p=thirdparty%2Flxc.git lxc-oci: cleanup temporary download directory if umoci is interrupted Signed-off-by: Felix Abecassis --- diff --git a/templates/lxc-oci.in b/templates/lxc-oci.in index f98c38bcd..1c7e0721f 100755 --- a/templates/lxc-oci.in +++ b/templates/lxc-oci.in @@ -38,8 +38,11 @@ LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@" # Some useful functions cleanup() { - if [ -d "$DOWNLOAD_TEMP" ]; then - rm -Rf $DOWNLOAD_TEMP + if [ -d "${DOWNLOAD_TEMP}" ]; then + rm -Rf "${DOWNLOAD_TEMP}" + fi + if [ -d "${LXC_ROOTFS}.tmp" ]; then + rm -Rf "${LXC_ROOTFS}.tmp" fi } @@ -244,7 +247,6 @@ fi umoci unpack ${umoci_args[@]} --image "${DOWNLOAD_TEMP}:latest" "${LXC_ROOTFS}.tmp" rmdir "${LXC_ROOTFS}" mv "${LXC_ROOTFS}.tmp/rootfs" "${LXC_ROOTFS}" -rm -rf "${LXC_ROOTFS}.tmp" OCI_CONF_FILE=$(getconfigpath ${DOWNLOAD_TEMP} latest) LXC_CONF_FILE="${LXC_PATH}/config"