Option to update the config without flashing the image again

This commit is contained in:
2026-06-01 22:47:03 +08:00
parent a2e5c2aa7a
commit 4e8e1896cf
+20 -18
View File
@@ -239,33 +239,35 @@ log "Expected config partition after flash: $TARGET_CONFIG_PART"
log "Target disk info:" log "Target disk info:"
diskutil info "$TARGET_DISK" || die "Unable to inspect target disk" diskutil info "$TARGET_DISK" || die "Unable to inspect target disk"
echo if ! [ "$1" == "config" ]; then
printf "Type 'YES' to continue: " echo
read -r CONFIRM printf "Type 'YES' to continue: "
[ "$CONFIRM" = "YES" ] || die "Aborted." read -r CONFIRM
[ "$CONFIRM" = "YES" ] || die "Aborted."
log "Unmounting target disk..." log "Unmounting target disk..."
diskutil unmountDisk force "$TARGET_DISK" || die "Failed to unmount $TARGET_DISK" diskutil unmountDisk force "$TARGET_DISK" || die "Failed to unmount $TARGET_DISK"
log "Flashing image with progress..." log "Flashing image with progress..."
pv -s "$IMG_SIZE_BYTES" "$IMG" \ pv -s "$IMG_SIZE_BYTES" "$IMG" \
| gunzip \ | gunzip \
| dd of="$TARGET_RAW_DISK" bs=4m | dd of="$TARGET_RAW_DISK" bs=4m
log "Syncing writes..." log "Syncing writes..."
sync sync
log "Ejecting and re-reading disk..." log "Ejecting and re-reading disk..."
diskutil eject "$TARGET_DISK" >/dev/null 2>&1 || true diskutil eject "$TARGET_DISK" >/dev/null 2>&1 || true
sleep 2 sleep 2
log "Waiting for disk to come back..." log "Waiting for disk to come back..."
if ! wait_for_disk "$TARGET_DISK" 15; then if ! wait_for_disk "$TARGET_DISK" 15; then
warn "Disk node did not reappear quickly. You may need to replug the drive." warn "Disk node did not reappear quickly. You may need to replug the drive."
fi fi
log "Disk layout after flashing:" log "Disk layout after flashing:"
diskutil list "$TARGET_DISK" || warn "Could not list flashed disk yet" diskutil list "$TARGET_DISK" || warn "Could not list flashed disk yet"
fi
ENV_FILES="$(find "$SEARCH_DIR" -maxdepth 1 -type f -name '*.env' | sort || true)" ENV_FILES="$(find "$SEARCH_DIR" -maxdepth 1 -type f -name '*.env' | sort || true)"