9.0 dialog and it's STDIN

In target port, this presents a dialog:
# /usr/bin/make config

Instead via keyboard, I want to send ENTER key to dialog (piped to STDIN of above cmd):
Code:
#!/bin/sh

# ENTER confirms and closes dialog
echo 'CODE_HERE' | /usr/bin/make config
 
If you only want to send enter, meaning accept the default options, then the command-line is:
# make -DBATCH install clean

Or, if you prefer to be verbose:
# make BATCH=yes install clean
 
I see, but what if a sequence is a little bit more complex?
Send it:
Button down
Space
Enter

This would [de]select second option and confirm
 
When you say "target port", do you mean a FreeBSD port? Options can be enabled by setting the WITH_ or WITHOUT_ values:
Code:
# cd /usr/ports/x11-servers/xorg-server
# make -DWITHOUT_HAL install clean

Might need to combine that with BATCH as phoenix shows to prevent the options dialog from appearing.
 
Yes, FreeBSD port, those in /usr/ports/* tree

It is NOT a point of specifying variables to make or finding alternative solutions, BUT automated interaction with 9.0's dialog via STDIN, (changed from keyboard).

So, # cd ... | make config
 
Such automation by feeding the dialog "command codes" via stdin doesn't work, the problem is that the dialog program expects an stdin that it can handle in "raw" mode and process the keystrokes unbuffered, a pipe certainly does not qualify as such input.
 
I'm not an expert on this, so I am having hard times understanding you.
... "raw" mode and process the keystrokes unbuffered ...
How does it differ from pipe?!
Is there some other kind of piping
Seems as there are other ways for STDIN, to receive data.
Can it be mimicked?
 
The "raw" mode means that the application receives the keystroke as soon as you press a key and it can process each keystroke indidually. The opposite of this is the way input usually works, you type something and end it with enter, the application will not receive any input until you've pressed the enter key.
 
I see now. Thanks.

My aim is to just set a default preselected options (no build, install, or anything else).
This is the only target:
[CMD="make"]config[/CMD]
I've tried with both -DBATCH and BATCH=yes and nada
When this succeeds, I'll send prompt which goes to STDOUT to /dev/null
Idea, anyone?
 
kpa said:
Set BATCH in the environment

# env BATCH=1 make whatever

That doesn't work either
Code:
#!/bin/sh

env BATCH=1 /usr/bin/make config
Dialog hangs ..., until I press ESC or ENTER
 
You're trying to solve the wrong problem. :)

The problem you are trying to solve is "how do I manipulate the OPTIONS dialog automatically by sending keystrokes to libdialog".

The correct problem description is "how do I pre-set OPTIONS for a port so that I don't have to muck around with the OPTIONS dialog".

And the solution to that is, read the Makefile, find the OPTIONS section, figure out the name of the variables, then set either WITH_VARNAME (enable) or WITHOUT_VARNAME (disable) for each of the variables. To set them only once, you specify them on the command-line as options to make:
# cd /usr/ports/whatever; make -DWITH_VAR1 -DWITH_VAR2 -DWITHOUT_VAR3 ... install clean

To set them permanently, store them in /var/db/ports/<portname>/options, which can be determined for any port like so:
# make -C /usr/ports/whatever/name -V OPTIONSFILE
 
phoenix said:
You're trying to solve the wrong problem. :)
Am I? ;)

Nope ...
phoenix said:
The problem you are trying to solve is "how do I manipulate the OPTIONS dialog automatically by sending keystrokes to libdialog".

The correct problem description is "how do I pre-set OPTIONS for a port so that I don't have to muck around with the OPTIONS dialog".

And the solution to that is, read the Makefile, find the OPTIONS section, figure out the name of the variables, then set either WITH_VARNAME (enable) or WITHOUT_VARNAME (disable) for each of the variables. To set them only once, you specify them on the command-line as options to make:
# cd /usr/ports/whatever; make -DWITH_VAR1 -DWITH_VAR2 -DWITHOUT_VAR3 ... install clean

To set them permanently, store them in /var/db/ports/<portname>/options, which can be determined for any port like so:
# make -C /usr/ports/whatever/name -V OPTIONSFILE
What I want to do is to ensure that if a port doesn't have its options set (options file in /var/db/ports/<portname>/options doesn't exist), THEN just send ENTER to dialog to set default options.
Simple as that and I had a way to do that until 9.0, by sending letter 'o' to dialog.
Code:
    cd_die /usr/ports/"$1" 

    # Auto set to default options
    # DON'T indent it!
    # Send key 'o' to dialog and quiet it, as we don't wana see dialog
qcmd "$make" config <<MyEND
o
MyEND

Now in 9.0 I have a problem, as it takes ENTER for confirmation and it simply doesn't work!
 
If there are no options set (options file not present), then go with the defaults by adding -DBATCH to the make command-line. That way, you won't even see the OPTIONS dialog appear at all.

So, you do a check for the options file, and conditionally add -DBATCH to the command-line.
 
phoenix said:
If there are no options set (options file not present), then go with the defaults by adding -DBATCH to the make command-line. That way, you won't even see the OPTIONS dialog appear at all.

So, you do a check for the options file, and conditionally add -DBATCH to the command-line.
That is not true, as I already replied to kpa.
Dialog appeared anyway.
 
Of course the dialog appears because you're instructing the dialog to open unconditionally with make config. The proper way to make use of BATCH is to use it with # make install.
For example:

# env BATCH=1 make -C /usr/ports/www/chromium install clean

No dialogs and the default options are selected and saved automatically.
 
That doesn't meet my req: no build, install, or anything else, just config target.
Why did my sh code worked in 8.X?
 
Different versions of libdialog.

What, exactly, are you wanting to do? Why do you need to 'just config' a port, without installing it?
 
If a port doesn't have its options set (options file in /var/db/ports/<portname>/options doesn't exist), THEN accept default pre-selected port's options, which creates: options file in /var/db/ports/<portname>/options.
 
Answering to that, is to open portal of never ending chatter.
I prefer to focus on 1 single problem. That is why I opened this thread.

In short, part of my script -> function (whose relevant code I've already posted), must be made to also work on 9.0
Change of dialog in 9.0 is preventing that.
 
aragon said:
# DIALOG=true make config
Yours shoot is a closest one ...
However it sets ALL options to WITHOUT_*=true, which ISN'T accepted default pre-selected port's options

Example: (for clementine)

Your method:
Code:
WITHOUT_VISUALISATION=true
WITHOUT_LASTFM=true
WITHOUT_GPOD=true
WITHOUT_MTP=true


Default: (ENTER passed to dialog)
Code:
WITHOUT_VISUALISATION=true
WITH_LASTFM=true
WITH_GPOD=true
WITH_MTP=true
 
Back
Top