#!/bin/bash create_disk_img () { local datadir=$1 local imgfile=$2 local fstype=$3 local extrasize=$4 local imgtype=$5 [ -n "$fstype" ] && fstype="-f $fstype" || fstype="-f vfat" [ -n "$extrasize" ] && extrasize="-s $extrasize" [ -n "$imgtype" ] && imgtype="-t $imgtype" sudo diskimg-manage -c -i "$imgfile" -d "$datadir" -u "$(whoami)" $fstype $extrasize $imgtype # set variable to pass to the RTE and then QEMU DATA_DISK_FORMAT="raw" } extract_disk_img () { local imgfile=$1 local datadir=$2 local basepath=$3 [ -n "$basepath" ] && basepath="-b \"$basepath\"" sudo diskimg-manage -e -i "$imgfile" -d "$datadir" -u "$(whoami)" $basepath }