Unix/Linux Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Using a request script

UNIX for Advanced & Expert Users


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 04-01-2008
Tornado's Unix or Linux Image
Tornado Tornado is offline
Users Awaiting Email Confirmation
 
Join Date: Nov 2006
Last Activity: 21 October 2015, 12:28 AM EDT
Location: Melbourne
Posts: 261
Thanks: 1
Thanked 14 Times in 10 Posts
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

Code:
#!/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.
Sponsored Links
    #2  
Old Unix and Linux 04-01-2008
unilover unilover is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 5 March 2009, 1:45 PM EST
Location: Toronto, Canada
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Sponsored Links
    #3  
Old Unix and Linux 04-01-2008
Tornado's Unix or Linux Image
Tornado Tornado is offline
Users Awaiting Email Confirmation
 
Join Date: Nov 2006
Last Activity: 21 October 2015, 12:28 AM EDT
Location: Melbourne
Posts: 261
Thanks: 1
Thanked 14 Times in 10 Posts
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.
    #4  
Old Unix and Linux 04-01-2008
reborg's Unix or Linux Image
reborg reborg is offline Forum Advisor  
Administrator Emeritus
 
Join Date: Mar 2005
Last Activity: 29 March 2012, 7:00 PM EDT
Location: Ireland
Posts: 4,464
Thanks: 0
Thanked 13 Times in 11 Posts
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.
Sponsored Links
    #5  
Old Unix and Linux 04-01-2008
Tornado's Unix or Linux Image
Tornado Tornado is offline
Users Awaiting Email Confirmation
 
Join Date: Nov 2006
Last Activity: 21 October 2015, 12:28 AM EDT
Location: Melbourne
Posts: 261
Thanks: 1
Thanked 14 Times in 10 Posts
You are spot on.. Adding LOGHOSTSRVR to pkginfo has fixed my issue

Thanks for that.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script request udayakumar Shell Programming and Scripting 5 04-02-2012 01:31 PM
Solaris request script potro Shell Programming and Scripting 2 11-18-2008 06:03 AM
How to modify BASEDIR with request script? kingpmp UNIX for Advanced & Expert Users 6 09-10-2008 06:29 AM
unix script http request arksal UNIX for Dummies Questions & Answers 1 08-24-2006 10:15 PM



All times are GMT -4. The time now is 08:59 PM.