On Tue, Aug 26, 2008 at 11:25:27AM -0700, Danek Duvall wrote:
> On Tue, Aug 26, 2008 at 07:13:12PM +0100, Robert Milkowski wrote:
>
> > pkg won't allow pre/post install scripts directly but it allows to
> > restart given smf service which actually allows to execute arbitrary
> > script, right?
> >
> > It's just "harder" to do so, but what exactly is accomplished by it?
> > is it about encouraging developers to try not to use pre/post install
> > scripts?
>
> The problem, as has been reiterated many times here, is execution context.
> When you write a postinstall script, it's executed in the context of the
> package install. That means that you have be careful that your code works
>
> - on alternate roots
>
> - from a miniroot, where not all utilities are available
>
> - on a hardware architecture different from that of the package you're
> installing
>
> - in a diskless installation, where the root and usr filesystems aren't
> mounted in the normal configuration
>
> - installing into a zone
>
> And once you've gotten all those right, we come along and add a new
> installation context that means all previously written scripts break all
> over again.
>
> Historically, install scripts are almost never written correctly, and prove
> over and over again to be dangerous.
>
> And they prevent innovation.
>
> The solution is to run scripts in a single context -- that of a fully
> booted image. That way, you can run things you just installed, and you can
> be guaranteed that everything is where it expects to be. It's far, far
> simpler, even if you do have to whip up a quick SMF manifest to do what you
> need to do. That part really isn't all that hard.
A slightly different approach could be something like this:
- Each package delivers a post-install script
- If the "pkg install" is happening on a live system (which I'd
assume would be the most common use-case for regular desktop
users), the script is run by IPS in the context of pkg install.
- The advantage here would be that the user would be alerted
during install of anything that goes wrong in the script.
- If the install is not happening on the live root, the script is
installed in a common directory from where it is picked up by an
SMF service which gets kicked up during the boot of that
image/zone/etc. This is similar to the approach being proposed
right now, except for the fact that there would be only one common
SMF service instead of one per package. It would make it much
easier to configure the behaviour of this service globally -- how
should it notify the user/administrator if something goes wrong,
etc.
Does this make sense? It does seem to satisfy the requirement that
scripts always run in the context of a fully booted image.
This, of course, builds on the assumption that IPS will be able to
reliably tell if it is working on a live system (which would not
include, for instance, cases where we might be installing packages
into a non-global zone).
Venky.
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss