Commit aa7f2d84 authored by Michael Shigorin's avatar Michael Shigorin

tar2fs: chgrp and failsafe kpartx

The current state made vm images belong to root group, no reason to not change those to the primary group of the user building an image. kpartx -d -s could fail in some circumstances, make a safety cleanup call more verbose.
parent 209c610f
......@@ -138,7 +138,10 @@ exit_handler() {
umount ${BOOTFS:+"$BOOTFS"} "$ROOTFS"{/dev,/proc,/sys,}
if [ -n "$LOOPDEV" ]; then
kpartx -d -s "$LOOPDEV"
kpartx -d -s "$LOOPDEV" || {
sleep 10
kpartx -d -s -v "$LOOPDEV"
}
losetup --detach "$LOOPDEV"
fi
rm -r -- "$ROOTFS"
......@@ -272,5 +275,5 @@ image=/boot/vmlinuz
fi
if [ -n "$SUDO_USER" ]; then
chown "$SUDO_USER" "$IMG" "$ROOTFS" "$WORKDIR"
chown "$SUDO_USER:$(id -g "$SUDO_USER")" "$IMG" "$ROOTFS" "$WORKDIR" ||:
fi
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