I've never tried this but I am guessing the script is not connected to any terminal. In that case the read command would generate an error and the script would continue executing (which is consistent with what you report about the reboot command).
Assuming at that point in the boot the display is /dev/tty1, you could try redirecting I/O using an
exec command at the beginning of the script:
Code:
exec > /dev/tty1 2>&1 < /dev/tty1
Just as a general comment about troubleshooting situations like this where you can't directly observe the script, I sometimes find it useful to redirect stderr to a file and enable tracing (removing those commands after I have it working). Then I can check the file after the fact to see what happened:
Code:
exec 2> /tmp/somefilename
set -x
ONE CAVEAT: The last I checked, Ubuntu used
dash (instead of
bash) for /bin/sh. I just checked the
man page and I
think the above will work in
dash but am not absolutely certain. If not, you could (if you haven't already) specify /bin/bash instead of /bin/sh for your script.