Skip to content

Commit 5243d3b

Browse files
committed
Fix detection of device type (partition/full disk) in move_disk.sh
The version of stat available at that point does not support %Lr, so use instead its hexadecimal counterpar (%T)
1 parent 3f41cab commit 5243d3b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

steps/jump/move_disk.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ while ! dd if=/dev/${DISK} of=/dev/null bs=512 count=1; do
2222
done
2323

2424
# Create partition if it doesn't exist
25-
if [ $(($(stat -c "%Lr" "/dev/${DISK}") % 8)) -eq 0 ]; then
25+
# 'stat -c "%T"' prints the minor device type in hexadecimal.
26+
# The decimal version (with "%Lr") is not available in this version of stat.
27+
if [ $((0x$(stat -c "%T" "/dev/${DISK}") % 8)) -eq 0 ]; then
2628
echo "Creating partition table..."
2729
# Start at 1GiB, use -S32 -H64 to align to MiB rather than cylinder boundary
2830
echo "2097152;" | sfdisk -uS -S32 -H64 --force "/dev/${DISK}"

0 commit comments

Comments
 (0)