How to modify BASEDIR with request script?

Here is request script:

#!/bin/sh
echo "Current install root path is [ $BASEDIR ]"
CONFIRM="n"
while [ "$CONFIRM" != "y" ]
do
        BASEDIR=""
        while true
        do
           echo please input install root path then press [ENTER]:
           read BASEDIR
           if [ ! -d "$BASEDIR" ]
           then
                 echo "$BASEDIR is not a valid path"
           else
              break
           fi
        done
        echo "Are you sure to change install root path to [ $BASEDIR ]? (y/n)"
        read CONFIRM
done
cat >$1 <<!
BASEDIR='$BASEDIR'
!
echo "Install root path is set to [ $BASEDIR ]"
exit 0

The request script is invoked and "BASEDIR" is set correctly. It can also be seen in postinstall script.

The problem is, the package is still installed to the default BASEDIR - "/" rather than the above one. :confused:

Any help will be appreciated! :cool:

What kind of package? What operating system? What is the '$1' that this script is writing the output to?

It's Solaris package.

$1 is an implicit parameter passed into request script.

So... how is the Solaris pkgadd command going to know where you have set this new BASEDIR value? Are you passing it as a parameter on the pkgadd command-line somehow?

Noop....basically that's how UNIX works, you never know what's going on behind the scene.

BASEDIR is a default environment variable. It represents where the root install path, based on Sun document and my understanding.

Well, if that's the case, how are you setting the environment variable? The script above just stores its value in the file specified by $1.

Problem solved.

In file prototype, the path must be relative path rather than absolute path.

/path-1/path-2/... (x)

path-1/path-2/... (v)