mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-28 15:36:29 +00:00
* Check if Busybox supports oflag It seems that Busybox' dd shipped with OS release 5 and earlier does not support oflag. Check if the flag is supported before making use of it. * Exit if a command in the update scripts returns an error This makes sure that the update isn't marked as successful in case there is an error in the update script.
This commit is contained in:
parent
580e541f77
commit
55c9b54b13
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
##
|
##
|
||||||
# Hooks
|
# Hooks
|
||||||
|
|
||||||
@ -65,12 +67,17 @@ if [ "${RAUC_SLOT_CLASS}" = "spl" ]; then
|
|||||||
DEVICE_ROOT="/dev/$(lsblk -no pkname "${DEVICE_CHILD}")"
|
DEVICE_ROOT="/dev/$(lsblk -no pkname "${DEVICE_CHILD}")"
|
||||||
PART_TABLE="$(sfdisk -lqJ "${DEVICE_ROOT}")"
|
PART_TABLE="$(sfdisk -lqJ "${DEVICE_ROOT}")"
|
||||||
PART_LABEL="$(echo "${PART_TABLE}" | jq -r '.partitiontable.label')"
|
PART_LABEL="$(echo "${PART_TABLE}" | jq -r '.partitiontable.label')"
|
||||||
|
FLAGS=""
|
||||||
|
|
||||||
|
if dd oflag=direct if=/dev/null 2> /dev/null; then
|
||||||
|
FLAGS="oflag=direct"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${PART_LABEL}" = "gpt" ]; then
|
if [ "${PART_LABEL}" = "gpt" ]; then
|
||||||
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc oflag=direct bs=512 seek=2 skip=2
|
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=512 seek=2 skip=2
|
||||||
else
|
else
|
||||||
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc oflag=direct bs=1 count=440
|
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=1 count=440
|
||||||
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc oflag=direct bs=512 seek=1 skip=1
|
dd if="${RAUC_IMAGE_NAME}" of="${DEVICE_ROOT}" conv=notrunc ${FLAGS} bs=512 seek=1 skip=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user