diff options
| author | jandob | 2016-01-28 16:16:09 +0100 |
|---|---|---|
| committer | jandob | 2016-01-28 16:16:09 +0100 |
| commit | d58aa4e7e93630639aa5f292d9c2c9089870daf3 (patch) | |
| tree | ee84c6f2f6383f1728f54f3a3be1e075fed3833f /builder/dnbd3-rootfs | |
| parent | dependecy check update (diff) | |
| parent | Improve debugging configurations. (diff) | |
| download | systemd-init-d58aa4e7e93630639aa5f292d9c2c9089870daf3.tar.gz systemd-init-d58aa4e7e93630639aa5f292d9c2c9089870daf3.tar.xz systemd-init-d58aa4e7e93630639aa5f292d9c2c9089870daf3.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'builder/dnbd3-rootfs')
| -rwxr-xr-x | builder/dnbd3-rootfs/hooks/prepare-root-partition.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh index b9355cc3..c527062a 100755 --- a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh +++ b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh @@ -36,21 +36,25 @@ if [[ $return_code != 0 ]]; then exit 1 fi # endregion + # region scan partitions read_only_device="" -if ! qemu-img info --output json "$SLX_DNBD3_DEVICE" | grep '"format": "raw"' +if utils.dependency_check qemu-img && ! qemu-img qemu-img info --output json \ + "$SLX_DNBD3_DEVICE" | grep '"format": "raw"' then read_only_device="$(container-unpack-xmount $SLX_DNBD3_DEVICE)" else - # workaround to detect partitions on raw disks - # can be omited when the dnbd3 kernel module supports it (like the nbd - # kernel module with parameter 'max_part') - loop_device="$(losetup -f)" + # Workaround to detect partitions on raw disks can be omitted when the + # dnbd3 kernel module supports it (like the nbd kernel module with + # parameter "max_part"). + loop_device="$(losetup --find)" losetup "$loop_device" "$SLX_DNBD3_DEVICE" --partscan read_only_device="$loop_device" touch $read_only_device udevadm settle fi +# Fail fast if no device could be determined. +[ -z "$read_only_device" ] && exit 1 # endregion # region find read-only partition |
