(Could someone post this on the rpm list as well? I am not a subscriber...
thanks!)

Here is what I have done to solve my need for an interactive configuration
script. Note that I can't use a wrapper for this, since it runs as a module to
Apache and you don't execute frontpage directly. There is a configuration
executable, but you have to read all the documentation and it's very error-prone.
So I had to think of another strategy, which is design a script that asks only
for the necessary parameters. But I have to inform the user that they have to run
my script.

Here is the post section from my SPEC file:

%post
if [ `uname` = "Linux" ]; then XTERM="/usr/bin/X11/xterm"; fi
if [ `uname` = "SunOS" ]; then XTERM="/usr/dt/bin/dtterm +sb"; fi
if [ $DISPLAY ]; then
$XTERM  -geometry 38x6 -bg black -fg white  -title "Note:" \
-e "/bin/sh" -c "echo 'To complete installation of Frontpage:'; \
echo 'open a console and run:';echo;echo '/etc/pkgconf/frontpage';sleep 60"&
else
echo "---------------------------------------------"
echo
echo "To complete installation of Frontpage, you have"
echo "to run /etc/pkgconf/frontpage"
echo
echo "---------------------------------------------"
fi

What is does is only grab the attention of the user *IF* they run X. It works in
gnorpm, kpackage and rpm in an xterm, but only shows the message for 60 seconds
(the user can close the window if it bugs them). It works also if installed in
console. In batch mode (rpm -i *), it doesn't show anything.

When you execute /etc/pkgconf/frontpage, it asks for all required information,
configures everything, and moves the install script in /etc/pkgconf.installed.
That way, an admin or a script can just have a look in /etc/pkgconf to see what
remains to be configured.

Tell me what you think about this.

Jean-Michel Dault
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Pablo Saratxaga wrote:

> Kaixo!
>
> On Fri, Aug 27, 1999 at 02:08:40AM +0000, Jean-Michel Dault wrote:
>
> > I have a few packages that would require an interactive post-install
> > script.
>
> Not possible.
> And not negotiable either; rpm *must* be runable from shell scripts, so
> no interactive scripts are allowed.
>
> That has been discussed a lot on rpm mailing list; and the conclusion has been
> that the smart solution for that problem is to have the post install script
> to create a flag file, and when the program is first launched it checks
> for that flag file, and if exists launchs the interactive thing.
>
> > For example, MySQL could ask for the database password to
> > create, Frontpage could ask for the name of a virtual host.
>
> Those are *configuration* things and must not be done at installation by the
> root adminsitrator but instead done by the people in charge to manage such
> servers (yes, on home computers he is the same person; but not on most real
> life business situations)
>
> > I haven't found the perfect way to do it yet. Assuming defaults is very
> > dangerous regarding security when it comes to passwords, and we all know
> > the PITA we had with Postgresql over-writing a poor user's database when
> > upgrading.
>
> How comes ?
> If it does that the rpm package is dead-bugged and the *.spec file must be
> rewritten; could you tell me exactly what is overwritten ?
>
> > What would be great is a special attribute to the %post section,
> > something like "%post --interactive" that could start an xterm or pause
>
> No, that won't be great as that would hand forever updates done trough
> ssh somemachine -c "rpm -Uv *.rpm"
> for example. Therefore such thing will never been implemented.
>
> > Maybe there is a better solution. If any of you has an idea,  just let
> > me know.
>
> If you really absolutely need to launch some interactive script to have
> a program useable, use a flag file (tagged as %ghost on spec file to avoid
> rpm -V warnings when it won't exist anymore; and created by a touch on %post
> script, depending if it is a first install (if [ "$1" = "1" ] ) or not);
> and then have your program chack for that file; you can use a script wrapper
> for that also.
>
> >
> > Jean-Michel Dault
> > [EMAIL PROTECTED]
> > [EMAIL PROTECTED]
>
> --
> � bient�t,
> Pablo Saratxaga
>
> http://www.ping.be/~pin19314/           PGP Key available, key ID: 0x8F0E4975

Reply via email to