package driven postinstall scripts.

Robert Collins rbcollins@cygwin.com
Sun Mar 16 20:10:00 GMT 2003


On Mon, 2003-03-17 at 06:16, Igor Pechtchanski wrote:
> Rob,
> 
> >
> > Will I be causing grief for you by applying this patch?
> 
> Not really, but let's bring your patch and mine closer, so that you could
> reuse the good parts of mine (and I could avoid duplicating code).  See
> below.

Sure.

> > The install.cc changes I plan to apply regardless, modulo the 'Note
> > script files as they are installed' 2-liner.
> 
> Why not create a proper Installer class?  Move all static variables (e.g.,
> rebootneeded, package_bytes, etc) into the class?  Make initDialog() a
> constructor?  Make replaceOnReboot{Succeeded|Failed}() private?

I refactored from the top of the file down, making only safe changes,
until I found what I needed to change to track script files. I've no
objection to doing more refactoring, but no immediate reason to either.
And time is always an issue.

> As for the "Note script files" bit, you could add that too, it won't hurt.

Done.

> > If this goes in, then I can easily throw a package-ordered iterator at
> > postinstall and solve the root problem.
> 
> True.  How about merging some functionality from my FileDesc class and
> your Script class (at least the == operator)?  That way, FileDesc can
> simply inherit from Script, add the dependences and the "<" operator, and
> that's it...

I'll check this tonight. No basic objection, though the synthetic
operator == may do the right thing at the moment I think.

> Also, it might be nice to have a proper Script class...  Can you, for
> example, rename run_script() into Script::run()?  And add a method
> extracting the extension into the class?
> BTW, do you have to have a vector of Script objects (as opposed to Script
> pointers)?

std::vector<Script> & 
package_version::scripts();

If we need virtual behaviour on Script that will have to become
std::vector<Script *> &
package_version::scripts();

> > BTW: What was the test case that prompted a need for ordered postinstall
> > scripts?
> > Rob
> 
> I'm not sure right now, but I think running passwd-grp.sh before
> attempting to execute any programs in /bin was one of them...

Cool. 

> BTW, one other idea I had was a FilterVisitor class that would act as a
> wrapper for some other Visitor and only call "visit" for files that don't
> match a pattern...  I thought of using it to filter out "*.done".  It's
> pretty orthogonal to the rest of my changes, though...

It's a classic Decorator too. Nice one.

Rob
-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20030316/fe019e5a/attachment.sig>


More information about the Cygwin-apps mailing list