#!/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"