Re: OT: (but I do not know who ask for): buildin an RPM from scratch

2002-05-31 Thread Miguel Beccari

Miguel Beccari wrote:



 %pre

 echo Bla bla bla.;
 echo -n Answer (yes | no | later);
 read chiave
 while ( test -z $chiave ); do
read chiave
 done;



OK. In the docs I read:

There are certain caveats about these scripts which you should take into 
account. Number one, each must fit inside a 8192 buffer, and number two, 
they should be non-interactive. Anything which requires manual input 
from the user is wrong, as this will break non-interactive RPM 
installation procedures.






Regards,

Miguel Beccari





Re: OT: (but I do not know who ask for): buildin an RPM from scratch

2002-05-31 Thread Stew Benedict


On Fri, 31 May 2002, Miguel Beccari wrote:

 I builded a RPM from scratch of an application of mine.
 
 The SRC rpm works: it builds 2 i586 architecture packages, it has got 
 good controls, it check dependecies and so on.
 
 My trouble is this: how to force the user to answer some questions 
 before install the package ?
 
 I wrote down theese lines:
 
 
 %pre
 
 echo Bla bla bla.;
 echo -n Answer (yes | no | later);
 read chiave
 while ( test -z $chiave ); do
 read chiave
 done;
 
 
 that produce a  /var/tmp/rpm-tmp.19101 as follow:
 
 echo Bla bla bla.;
 echo -n Answer (yes | no | later);
 read chiave
 while ( test -z $chiave ); do
 read chiave
 done;
 
 
 
 The problem is that $chiave is NEVER != zero.
 
 
 Some one can help me ?
 

Are you saying the script behave differently in the RPM than if you just
run it?  I would do something a little more bulletproof, which would force
them to answer one of your choices, unless they ctrl-C out of it:

#!/bin/sh
echo Bla bla bla.;

GoodAnswer () {
# do something now
echo You answered $chiave
}

GetInput () {
echo -n Answer (yes | no | later);
read chiave

while [ -z $chiave ]; do
GetInput
done;
}

GetInput

case $chiave in
yes | no | later)
GoodAnswer
;;
*)
GetInput
;;
esac

Of course if they install with rpmdrake or whatever, you need to call up a
terminal window. Others may have even better suggestions.

Stew Benedict

-- 
MandrakeSoft
PPC FAQ: http://www.linux-mandrake.com/en/ppcFAQ.php3
IRC: irc.openproject.net #cooker-ppc





Re: OT: (but I do not know who ask for): buildin an RPM from scratch

2002-05-31 Thread Miguel Beccari

Stew Benedict wrote:

Are you saying the script behave differently in the RPM than if you just
run it?  I would do something a little more bulletproof, which would force
them to answer one of your choices, unless they ctrl-C out of it:


  

Yes (I am saying the script behave differently).

I used your suggestions, but the result is the same.

If I run sh /var/tmp/rpm-tmp.54377 I have got the promt Answer (yes | 
no | later)
If I answer the script goes on as well. It is OK.

But when I run rpm -Uhv I have a loop: Answer (yes | no | later) Answer 
(yes | no | later) Answer (yes | no | later) Answer (yes | no | later) 
Answer (yes | no | later) Answer (yes | no | later) [etc...]

This because of $chiave is empty

GetInput () {
echo -n Answer (yes | no | later);
read chiave

while [ -z $chiave ]; do
GetInput
done;
}


Because of $chiave is empry GetInput is looped.


Miguel Beccari








Re: OT: (but I do not know who ask for): buildin an RPM from scratch

2002-05-31 Thread Miguel Beccari

Rick Thomas wrote:

When the script is run by rpm, it probably has input redirected from
/dev/null.  As the docs say, it should be non-interactive.  Anything else
will break scripted installations.


  

Yes. It is so.

In fact I used something like

%pre

$bashscript = /tmp/myfile
echo #!/bin/sh   $bashscript
echo Stew Benedict suggestion  $bashscript

chmod 700 $bashscript
sh $bashscript

So i was REALLY sure it was a bash script to be executed (sorry but I am 
new to rpms)
and the problem was the same.

Then I run /tmp/myfile and it worked...

so I think the input is redirected from /dev/null.


OK.

I will write a mini setup program as Microsft does ;)

Up to now I just echo out the instructions and the license (with a 
line that sounds like 'using the software presumes you have accepted the 
license terms at all


Regards,

Miguel Beccari





Re: OT: (but I do not know who ask for): buildin an RPM from scratch

2002-05-31 Thread Quentin Mason


 
 I will write a mini setup program as Microsft does ;)
 
 Up to now I just echo out the instructions and the license (with a 
 line that sounds like 'using the software presumes you have accepted the 
 license terms at all

Intel's free compiler, Mathematica, and maple take the following approach:

write a simple script that reviews the license, asks/determines which 
parts /things to install, unpacks the appropriate rpm's and installs them 
-- relocating to users chosen path if that is an option.  These can be run 
from a script by catting in the required answers: install_ace_package  
my_options.   Generally such packages are add-ons and go in /opt and are 
individually installed.  

On the other hand if you have used rpm to mark your license type and have 
included it in the distro then arguable an installer is/should be aware of 
it.

VMware + staroffice(?) take an alternative approach -- rpm's to install
but a first-time script to be run by users to setup the network daemons
etc:  vmware-config.pl and soffice.

Alternatively you can have the program auto-detect different features like 
SSE1/2 MMX support for multimedia libraries.

Hopefully you should be inspired by one of these examples.

Good luck,

Q.