From: Felix Abecassis Date: Tue, 21 Nov 2017 21:49:25 +0000 (-0800) Subject: lxc-oci: support unprivileged umoci unpacking X-Git-Tag: lxc-3.0.0.beta1~176^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51c80577e0def5cd1be761fa03fe21dce5859754;p=thirdparty%2Flxc.git lxc-oci: support unprivileged umoci unpacking Signed-off-by: Felix Abecassis --- diff --git a/templates/lxc-oci.in b/templates/lxc-oci.in index 4c4d10393..dac3eebec 100755 --- a/templates/lxc-oci.in +++ b/templates/lxc-oci.in @@ -190,7 +190,11 @@ skopeo copy "${OCI_URL}" "oci:${DOWNLOAD_TEMP}:latest" # Unpack the rootfs echo "Unpacking the rootfs" -umoci unpack --image "${DOWNLOAD_TEMP}:latest" "${LXC_ROOTFS}.tmp" +umoci_args=("") +if [ -n "$LXC_MAPPED_UID" ] && [ "$LXC_MAPPED_UID" != "-1" ]; then + umoci_args+=(--rootless) +fi +umoci unpack ${umoci_args[@]} --image "${DOWNLOAD_TEMP}:latest" "${LXC_ROOTFS}.tmp" rmdir "${LXC_ROOTFS}" mv "${LXC_ROOTFS}.tmp/rootfs" "${LXC_ROOTFS}" entrypoint=$(getep ${DOWNLOAD_TEMP} latest)