0

I wrote a post-install script, which is executed after the package installation by command like " pkgadd -d /mypackage.pkg".

I also want to read user input in post-install script as follows:

while [ "$ANSWER" != "y" -a "$ANSWER" != "n" ] ;
  do
     echo "Apply changes to database? [y/n]:"
     read ANSWER
  done

However, it does NOT pause and wait for user input at all! Instead, it goes into an infinite loop:

Apply changes to database? [y/n]:
Apply changes to database? [y/n]:
Apply changes to database? [y/n]:
Apply changes to database? [y/n]:
Apply changes to database? [y/n]:

Any advice will be appreciated!

(By the way, if I run the script separately, everything is fine!)

3
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by eggi
0

Have you tried removing the semi-colon after the first line and tried running it that way?

In my experience, I only put a semi-colon there if the do will be put on the same line. I think that is unnecessary - let me know how that works out, because other than that it looks good to me.

0

Looks pretty solid.

Possibly try changing the variable ANSWER to something goofy, like BORG, just in case ANSWER is special (like REPLY).

Best wishes,

Mike

0

Thanks for reply!

However, I still got no luck by removing the semi-colomn and change the variable name!

0

I went through pkgadd and pkgmk documentation and got no answer for this, unfortunately!

After disucssion with my colleague, we came up with an idea - read the user input from a jar then return to shell script.

It works!

0

My mistake! It still doesn't work!

According to Solaris packaging documentation, the only place, which the installer can solicit user input, is through "request script". That's a stage far before post-install.

0

Wow,

I feel pretty dumb right now ;) I should have known that... Now that I think back, I never have had to answer any questions post-install, it was always pre-install...

Life surprises you sometimes. I think we overthought this one and the answer was simple once you relaxed and let it come to ya.

Good job :)

, Mike

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.