Using a request script

I am creating a package(Solaris10 on sparc) that needs user input.
As I understand it, I need to use a request script.

My problem is that the value I set in my request script is not visible in my postinstall script. Not sure if I am doing it right.

Here is an example request script

#!/bin/sh
LOGHOSTSRVR=""
echo "Which loghost server do you want to use, loghostdr or loghostprd: "
read LOGHOSTSRVR

# export LOGHOSTSRVR to global PKG environment
cat >> $1 << EOT
LOGHOSTSRVR=${LOGHOSTSRVR}
EOT

In my postinstall script, if I echo $LOGHOSTSRVR it is empty

Has anyone successfully created a package that uses a request script ?
Your help is much appreciated.

What is $1 in this code?

What is the relationship between this code and your other script?

Where and how do you "echo" in there?

The value of $1 is the installers answer.
ie:
If the user answers loghostdr then $1 is
LOGHOSTSRVR=loghostdr

The request script is part of a package that I am building.

There are six types of scripts you can create when creating a Solaris package. You do not need to have all these scripts, you only use what you need. The scripts get run in the following order.

  1. request
  2. checkinstall
  3. preinstall
  4. postinstall
  5. preremove
  6. postremove

My package does not use a checkinstall script, but it does have the rest.

The request script is what is used if user interaction is needed and the values should be made available to any of the following scripts.

In my postinstall script I have added echo statements to see what values it knows about.

echo $1
echo $LOGHOSTSRVR

These are both empty.. I have tried to export the value in the request script aswell with no success.

I need help from someone that knows about creating Solaris packages and that has created packages that need to have a request script.

Tornado,

The script itself looks fine to me. Remember $1 is not the user answer, it is the location of the temporary response file. An important point however is that every environment variable that you set should be defined in the pkginfo file.

You are spot on.. Adding LOGHOSTSRVR to pkginfo has fixed my issue

Thanks for that.