Well, other than run interactively, you can try
fsck -y like my answer in the other question :-P
If you want to
dd an image on top of the rootfs, your best bet is going to be to do that from your initramfs before mounting the rootfs.
You can do it with the system booted to that rootfs, but this is one of those things where Unix gives you the rope (with the loop already nicely tied for you). The filesystem will not like it at all ("hey, I expected an inode there, what is this junk?!"). Make sure that its truly read-only, e.g., no journal replay going.
If you avoid filesystem access, you'll probably get away with it. This implies that your source image can't be on the rootfs. That'd be a really bad idea.
After running dd,
shutdown -r now is not going to work (nor is much else, including
cat). Instead, I'd suggest that you either use a watchdog (even softdog) to force a reset, or alternatively use
echo is normally a shell builtin, so you should still be able to run
I'm not sure what you're doing, but it sounds like you may be building some sort of appliance. You ought to consider keeping a read-only rootfs, and using an overlay (union mounts, aufs, etc.) to make your changes, similar to how a livecd works. Or, alternatively, have a backup or recovery-only rootfs (similar to how many Android phones work).