SUMMARY: postremove question
- From: "Christopher L. Barnard" <cbar44@xxxxxxxxxxxx>
- Date: Mon, 29 Jan 2007 15:54:40 -0600 (CST)
I asked:
I want to query the user after a pkg has been removed whether or not to
execute a certain command. I created a postremove file:
---------
echo ""
echo "foobar pkg removed. Remove it from the manifest? (y/[n]) \c"
read ans
if [ "x${ans}x" = "xyx" ]; then
echo "Now disabling foobar \c"
/usr/sbin/svcadm disable site/foobar
echo "and removing it."
/usr/sbin/svccfg delete -f site/foobar
else
echo "Nothing done. The service is still running, although the underlying"
echo "binary no longer exists."
fi
--------
The script runs after a pkgrm, but it does not wait for user input. How
do I get pkgrm to query the user for a y/n?
The answer:
I can't, really. From a backline engineer at Sun:
***************************
The only place you can ask for input is in request. It is in place
so that all packages are guaranteed to be able to be installed
non-interactively (you can pre-supply the answers to the questions).
You can ask a question in request pre-emptively, such as "If I find a
name service, should I shut it down and remove it from the manifest?".
Then you can export the variable there in the request script:
echo "MANIFEST_REMOVAL=${my_value}" >> $1
This $1 is read later on by the other scripts.
In postinstall, you can then check the value of the variable:
if [ "$MANIFEST_REMOVAL" = y ]; then ....
That's the only way I know how to do it. The disadvantage here is you
might not know what questions to ask until later.
Also note that you can supply default values for whatever custom
variables you'd like in you pkginfo file.
***************************
Thanks to:
1-800-USA-4SUN.
+-----------------------------------------------------------------------+
| Christopher L. Barnard O When I was a boy I was told that |
| cbarnard@xxxxxxxxxxxx / \ anybody could become president. |
| (312) 347-4901 O---O Now I'm beginning to believe it. |
| http://www.cs.uchicago.edu/~cbarnard --Clarence Darrow |
+----------PGP public key available via finger or PGP keyserver---------+
_______________________________________________
sunmanagers mailing list
sunmanagers@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
- References:
- postremove question
- From: Christopher L. Barnard
- postremove question
- Prev by Date: SUMMARY: Solaris 10 01/06 ignores /etc/shells
- Next by Date: 280R won't boot
- Previous by thread: postremove question
- Next by thread: Solaris 10 01/06 ignores /etc/shells
- Index(es):
Relevant Pages
|