From 5ba72ab315b02f62bc6f3723152aea10d65ba6b8 Mon Sep 17 00:00:00 2001 From: Michael Chus Date: Fri, 17 Apr 2026 23:52:47 +0300 Subject: [PATCH] Add rsync to initramfs for toram progress output live-boot already uses rsync --progress when /bin/rsync exists; without it the copy falls back to silent cp -a. Add rsync to the ISO package list and install an initramfs-tools hook (bee-rsync) that copies the rsync binary + shared libs into the initrd via copy_exec. The hook then rebuilds the initramfs so the change takes effect in the ISO's initrd.img. Co-Authored-By: Claude Sonnet 4.6 --- .../hooks/normal/9011-toram-rsync.hook.chroot | 46 +++++++++++++++++++ .../config/package-lists/bee.list.chroot | 1 + 2 files changed, 47 insertions(+) create mode 100755 iso/builder/config/hooks/normal/9011-toram-rsync.hook.chroot diff --git a/iso/builder/config/hooks/normal/9011-toram-rsync.hook.chroot b/iso/builder/config/hooks/normal/9011-toram-rsync.hook.chroot new file mode 100755 index 0000000..2771757 --- /dev/null +++ b/iso/builder/config/hooks/normal/9011-toram-rsync.hook.chroot @@ -0,0 +1,46 @@ +#!/bin/sh +# 9011-toram-rsync.hook.chroot +# +# Adds rsync to the initramfs so that live-boot's toram code takes the +# rsync --progress path instead of the silent "cp -a" fallback. +# +# live-boot's 9990-toram-todisk.sh already contains: +# if [ -x /bin/rsync ]; then +# rsync -a --progress ... 1>/dev/console +# else +# cp -a ... # no output +# fi +# +# We install an initramfs-tools hook that calls copy_exec /usr/bin/rsync, +# which copies the binary + all shared-library dependencies into the initrd. + +set -e + +HOOK_DIR="/etc/initramfs-tools/hooks" +HOOK="${HOOK_DIR}/bee-rsync" + +mkdir -p "${HOOK_DIR}" + +cat > "${HOOK}" << 'EOF' +#!/bin/sh +# initramfs hook: include rsync for live-boot toram progress output +PREREQ="" +prereqs() { echo "$PREREQ"; } +case "$1" in prereqs) prereqs; exit 0 ;; esac + +. /usr/share/initramfs-tools/hook-functions + +if [ -x /usr/bin/rsync ]; then + copy_exec /usr/bin/rsync /bin +fi +EOF + +chmod +x "${HOOK}" + +echo "9011-toram-rsync: installed initramfs hook at ${HOOK}" + +# Rebuild initramfs so the hook takes effect in the ISO's initrd.img +KVER=$(ls /lib/modules | sort -V | tail -1) +echo "9011-toram-rsync: rebuilding initramfs for kernel ${KVER}" +update-initramfs -u -k "${KVER}" +echo "9011-toram-rsync: done" diff --git a/iso/builder/config/package-lists/bee.list.chroot b/iso/builder/config/package-lists/bee.list.chroot index f30b79a..2de340a 100644 --- a/iso/builder/config/package-lists/bee.list.chroot +++ b/iso/builder/config/package-lists/bee.list.chroot @@ -3,6 +3,7 @@ dmidecode smartmontools nvme-cli pciutils +rsync ipmitool util-linux e2fsprogs