on SlackBuild scripting
Hello,
I am writing a SlackBuild script for an application. The odd thing is that the configure script of the application at some point prompts the user to enter a number from the terminal and then goes on. Until one enters a number, it just hangs and waits. My question is, is there a way to provide the number (the answer) to the configure call in the SlackBuild script itself, so that it doesn't prompt and the package building runs smoothly? Any suggestions will be appreciated. |
Of course you can.
The method you should use depends in the quality of the random number you need. For cryptographic software, you want the best randomness you can get. You can surely obtain it by the clever use of openssl's "rand" and some scripting abilities. If you don't need crypto-geek randomness, the Bash shell has a built in function to generate numbers between 0 and 32767. There is plenty of information about the $RANDOM function in search engines. Please, tell us what software are you dealing with so we can decide upon facts. |
Quote:
provide that number in the script, so that no prompt comes? This number gives the architecture that the sources will be configured for, and in my case 25 means Linux 64 bit with gfortran and gcc. |
If the configure script accepts the number as an option (i.e: you could use "./configure --number=25") or variable (i.e: you could use "NUMBER=25 ./configure"), then it is as easy as setting the variable from the start of the SlackBuild script. If you are using the classical template, you should find something like this somewhere:
Code:
# Automatically determine the architecture we're building on: Code:
# Automatically determine the architecture we're building on: Code:
./configure \ If the configure script does not accept the number as an input, and supports only interactive prompting, then you are supposed to patch the ./configure script so it behaves like explained above. You can do this by having the ./configure script accept non-interactive modes or by making it figure the number by itself. |
Edit pkgname.SlackBuild's running of the configure command, something like echo 25 | ./configure ...
If that works you could implement it to use a variable value instead of 25 and set that variable before running pkgname.SlackBuild. |
Two ideas:
1) check to see if the install script that you are running has a help flag which might tell you a way to pass this number as an argument or an environment variable. For example, ./configure -h could tell you that calling ./configure --arch=25 is equivalent to providing the number during the script. 2) Patch the script so that instead of asking it just uses 25. Many SlackBuilds patch the source code or the Makefiles to fix problems, and in this case it shouldn't be too hard to remove the prompt and assign 25 to the variable in question. |
Quote:
|
Quote:
The configure script does not allow a parameter for this option, and the prompt actually comes from a perl script, so hacking it would not be easy for me. But the echo-pipe thing worked perfectly, many thanks! |
All times are GMT -5. The time now is 04:06 PM. |