Skip to content

Commit ed170bc

Browse files
committed
feat(updater): step lines for the six stages of an install
The factory marked its own steps and then went silent for the minutes the updater takes - unpacking a rootfs and writing a boot chain looked like a hang on the terminal, because everything perform_update.sh printed went to the log. Six lines now: clearing the slot, fetching, unpacking, first boot, kernel and boot chain, and the slot that came out. They carry the same "==>" marker as image-factory/create_image.sh and are not indented - tool.sh's nested_step adds the indent when it lifts a factory line to the terminal, so indenting here would double it. On a device the marker is a prefix in the journal. The steps sit in main(), not in the functions, so the functions stay quiet for the tests that read their output. Verified by running main() end to end against mocked docker, tar, btrfs, df and a stand-in rootfs: slot B in, slot A written, fstab with subvol=@os/system-A in the slot, first-run.sh and install-kernel.sh called with the slot and digest, exit 0. That path has no test of its own - it is the main() gap the suite leaves open. Signed-off-by: Simon Walz <contact@simonwalz.de>
1 parent 8e3e911 commit ed170bc

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎updater/perform_update.sh‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ raise_info() {
3333
exit "$code"
3434
}
3535

36+
# One line per step, marked for whoever is watching. cuos-release/tool.sh puts
37+
# lines carrying this marker on the terminal - indented by itself, so this one
38+
# does not - and everything else in output/NAME.build.log. On a device the
39+
# marker is just a prefix in the journal. Keep it in step with
40+
# image-factory/create_image.sh and log_is_step_line() over there.
41+
step() {
42+
echo "==> $*"
43+
}
44+
3645
# Fields counted from the end: df puts a device name that does not fit on a
3746
# line of its own.
3847
disk_usage() {
@@ -323,8 +332,12 @@ main() {
323332
raise_info 102 "No OS update available"
324333
fi
325334

335+
step "Clearing slot ${SLOT}"
326336
prepare_slot
327337

338+
if ! is_local_build; then
339+
step "Fetching ${IMAGE}"
340+
fi
328341
pull_image
329342

330343
NEW_DIGEST="$(repo_digest)"
@@ -345,12 +358,15 @@ main() {
345358
raise 105 "Failed to get image digest"
346359
fi
347360

361+
step "Unpacking the system into slot ${SLOT}"
348362
export_rootfs
349363

350364
write_fstab
351365

366+
step "Preparing the first boot"
352367
run_first_run
353368

369+
step "Installing the kernel and the boot chain"
354370
install_kernel
355371

356372
report_disk_usage "after"
@@ -361,6 +377,8 @@ main() {
361377
check_boot_reserve
362378
fi
363379

380+
step "Slot ${SLOT} installed: ${IMAGE}"
381+
364382
exit 0
365383
}
366384

0 commit comments

Comments
 (0)