From f3daf974bbcf3bd548bdd6e94bbf1289b33200df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Perttil=C3=A4?= Date: Fri, 26 Oct 2018 19:40:02 +0300 Subject: Let udevil define ISOMNT instead of hard-coding. /etc/udevil/udevil.conf defines "allowed_media_dirs" that may not include /media. This should figure out which loop device got used and where it was mounted. --- functions.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/functions.sh b/functions.sh index 158be0b..efb27a4 100644 --- a/functions.sh +++ b/functions.sh @@ -44,7 +44,7 @@ process_distro() { # FIXME # As a workaround, now we set $ISOFILE before using this function. # Maybe we have a better solution for this. - ISOMNT="/media/$ISOFILE" + # ISOMNT="/media/$ISOFILE" } gen_grubcfg() { @@ -95,11 +95,19 @@ download_iso() { } mount_iso() { - if findmnt "$ISOMNT" > /dev/null + LOOPDEV=$(/sbin/losetup -n -O NAME -j "$ISOPATH/$ISOFILE") + if [[ -n "$LOOPDEV" ]] then + ISOMNT="$LOOPDEV" umount_iso fi - udevil mount "$ISOPATH/$ISOFILE" "$ISOMNT" + + udevil mount "$ISOPATH/$ISOFILE" + LOOPDEV=$(/sbin/losetup -n -O NAME -j "$ISOPATH/$ISOFILE") + if [[ -n "$LOOPDEV" ]] + then + ISOMNT=$(findmnt -n -o TARGET "$LOOPDEV") + fi } umount_iso() { -- cgit v1.2.3