(c)dialog start-up script not working

On FreeBSD 8.2-RELEASE, I cannot get dialog (or the system cdialog) to display prompts during boot.

I have a python script that uses python's dialog module (using cdialog) to prompt the user for certain settings that I often change at boot. After changing them, I have to reboot. So, I want this script to run during boot to avoid forcing a reboot. The script works when I execute it at command line and I even have it working on ttyv1. But, during boot, once the rc system starts the script, I get a black screen with a centered arrow that won't move. I can break out of it and the boot process proceeds.

I've tested and found that a shell script calling either dialog or cdialog directly has the same problem during boot.

Any suggestions as to what is causing this and how I can fix it?

Thanks!
 
And if you force the boot to do single user mode, and then call the script? And when your user select the options, force the shell return to multiuser mode.. it's an idea :)

Like this:

1. insert /etc/gettytab
Code:
youruser:\
        :ht:np:sp#115200:youruser:

2. edit /etc/ttys
Code:
ttyv1   "/usr/libexec/getty youruser" cons25r on  secure

3 [CMD=]cd /home/HouseMD[/CMD]

Code:
if  ($tty == ttyv1) then
  sh /path/script.py
  logout
endif

Good luck!
 
That was an interesting idea. But, when I'm in single user mode, I don't seem to be able to change ttys. The only active tty I seem to be able to reach in single user mode is /dev/console.

This is similar to my fall-back plan, where I will have the script run before the console menu system that it runs. But, it will require a restart if the network stuff changed and then it will start again ... making a rather undesired loop.

Thanks for the idea, though.

I'm still trying to figure out if there are some dependencies that dialog requires which aren't in place during boot. I haven't been able to find much on the subject.
 
Just curious what settings you are changing that require a reboot in order to take effect. For example, if you are changing network settings, why not just execute the ifconfig(8) commands directly? Or the network-related RC scripts under /etc/rc.d/?

Other than some tunables that can only be set in /boot/loader.conf, there shouldn't be any reason to reboot a system to "make the changes stick".
 
Solved - boot environment needed to know what TERM to use

Phoenix, I'll answer you in a second.

The missing ingredient was exporting TERM=cons25 in my rc.d script before calling dialog or cdialog either directly or via my python script. It's working now, which is great. Thanks to Dan on the mailing list for coming up with that pretty quickly.

The script prompts for networking details that are needed not only for OS level things, but also for critical custom processes that start on boot. There is currently an issue when the server moves into or out of a VLAN. At least one of the services does not handle that well and until we spend further development time on those processes, this solution is pretty comfortable for the users that set up the servers. We will eventually iron out the flaw, but not before I need to be off working on other things. Plus, it flows really well for users that rarely have to set up the box.
 
Back
Top