diff options
| author | jandob | 2015-11-06 13:55:50 +0100 |
|---|---|---|
| committer | jandob | 2015-11-06 13:55:50 +0100 |
| commit | a8fed90324b7ee5b284167f40511e77231f4c210 (patch) | |
| tree | ecbd5eac0751ba273814a0ddfa72b35919f9be6e /builder | |
| parent | mount works (diff) | |
| parent | Improve debugging features. (diff) | |
| download | systemd-init-a8fed90324b7ee5b284167f40511e77231f4c210.tar.gz systemd-init-a8fed90324b7ee5b284167f40511e77231f4c210.tar.xz systemd-init-a8fed90324b7ee5b284167f40511e77231f4c210.zip | |
merge
Diffstat (limited to 'builder')
| -rwxr-xr-x | builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh | 18 | ||||
| -rwxr-xr-x | builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh | 17 |
2 files changed, 21 insertions, 14 deletions
diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh b/builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh index d70492bf..290bc213 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh @@ -26,19 +26,19 @@ fi # ok, let's source the setup script if ! . ${SETUP_ROOTFS_SCRIPT} ; then - warn "Could not source: ${SETUP_ROOTFS_SCRIPT}" - emergency_shell -n "Error in $0" - return 1 + warn "Could not source: ${SETUP_ROOTFS_SCRIPT}" + emergency_shell -n "Error in $0" + return 1 fi # just go over the functions in the right order ;-) for fun in connect_dnbd3 create_qcow export_qcow connect_qcow; do - if ! $fun; then - # something failed, drop a shell for debugging - warn "'$fun' failed with: $?" - emergency_shell -n "Error in $fun" - return 1 - fi + if ! $fun; then + # something failed, drop a shell for debugging + warn "'$fun' failed with: $?" + emergency_shell -n "Error in $fun" + return 1 + fi done # all good, we are done diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh index 2742e6bb..adcf02e0 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh @@ -7,11 +7,18 @@ declare -rg DNBD3_DEVICE="/dev/dnbd0" # Close previous connections to be able to run this script many times. dnbd3-client --device "$DNBD3_DEVICE" --close && \ -dnbd3-client --host "$DNBD3_SERVER" --image "$DNBD3_IMAGE" --device \ - "$DNBD3_DEVICE" --rid "$DNBD3_RID" && \ -qemu-nbd --connect=/dev/nbd0 "$DNBD3_DEVICE" --read-only && \ -local read_only_partition="$(utils_create_partition_via_offset \ - /dev/nbd0 system)" && \ +if ! dnbd3-client --host "$DNBD3_SERVER" --image "$DNBD3_IMAGE" --device \ + "$DNBD3_DEVICE" --rid "$DNBD3_RID" +then + warn "Failed to connect $DNBD3_IMAGE from $DNBD3_SERVER to $DNBD3_DEVICE" + emergency_shell -n "Error in $0" + return 1 +fi +local nbd_device='/dev/nbd0' && \ +qemu-nbd --connect="$nbd_device" "$DNBD3_DEVICE" --read-only && \ +# TODO make partition label configurable. +local read_only_partition="$(utils_create_partition_via_offset "$nbd_device" \ + system)" && \ # Make read-only partition writable. # TODO implement persistent available indicator. local persistent="N" # 'P' for persistent storage, 'N' for not persistent |
