Today I shall mostly be working on initrd images.
We’ve got some software which will take a linux-kernel-vx.x.x..deb file and with one command turn that into a bootable initrd.img file complete with busybox-compiled tools, modules, and an init script.
This is used for network booting with PXE.
Pretty neat when it works. But the init script is a bash script which contains lots of code like:
mount -n proc /proc -t proc || abort "Failed to mount proc"
This all needs converting to:
- Run the command.
- If it fails and the error looks transient repeat say five times.
- If that fails drop into /bin/sh
This would be easy with perl/ruby/something else. But to keep the size and hackability of the image down its gotta be done in sh.