diff options
Diffstat (limited to 'tools/daisy-img-modify.sh')
-rwxr-xr-x | tools/daisy-img-modify.sh | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/daisy-img-modify.sh b/tools/daisy-img-modify.sh index 43fd186b..6d2ff53f 100755 --- a/tools/daisy-img-modify.sh +++ b/tools/daisy-img-modify.sh @@ -99,7 +99,10 @@ raw_imgfile="${workdir}/centos7.raw" # download and checksum base image, conditionally if local copy is outdated download() { - test -d $workdir || mkdir -p $workdir + test -d $workdir || { + mkdir -p $workdir + test -z $SUDO_USER || chown -R $SUDO_USER:$SUDO_USER $workdir + } cd $workdir rm -f sha256sum.txt wget $sha256sum_url @@ -162,8 +165,8 @@ resize() { kpartx -av $raw_imgfile sleep 2 dmsetup ls - fdisk -l /dev/${loopdevice:0:5} || true - growpart /dev/${loopdevice:0:5} 1 + fdisk -l /dev/${loopdevice:0:-2} || true + growpart /dev/${loopdevice:0:-2} 1 dmsetup clear $loopdevice kpartx -dv $raw_imgfile || eliminate } @@ -176,8 +179,14 @@ setup() { kpartx -av $raw_imgfile sleep 2 dmsetup ls - fdisk -l /dev/${loopdevice:0:5} || true - mount /dev/mapper/$loopdevice $mountdir + fdisk -l /dev/${loopdevice:0:-2} || true + + if [ "xfs" = "$(blkid -o value -s TYPE /dev/mapper/$loopdevice)" ]; then + mountopts="-o nouuid" + else + mountopts="" + fi + mount $mountopts /dev/mapper/$loopdevice $mountdir mount -t proc none ${mountdir}/proc if [[ -n $img_size ]]; then |