#!/bin/bash create_disk_img () { local datadir=$1 local imgfile=$2 local fstype=$3 local extrasize=$4 local imgtype=$5 [ -z "$fstype" ] && fstype="vfat" [ -z "$extrasize" ] && extrasize="100G" [ -z "$imgtype" ] && imgtype="qcow2" virt-make-fs --format=$imgtype --size=+$extrasize --partition --type=$fstype "$datadir" "$imgfile" # set variable to pass to the RTE and then QEMU DATA_DISK_FORMAT="$imgtype" } extract_disk_img () { local imgfile=$1 local datadir=$2 local basepath=$3 [ -z "$basepath" ] && basepath="/" [ "${basepath:0:1}" != "/" ] && basepath="/${basepath}" guestfish -a $imgfile <