package driven postinstall scripts.

Igor Pechtchanski pechtcha@cs.nyu.edu
Sun Mar 16 19:16:00 GMT 2003


Rob,

Replies inline below.

On Sun, 16 Mar 2003, Robert Collins wrote:

> Igor,
>         what do you think of the attached patch.
>
> It's a halfway house between your embedded ordering and the package
> ordering I'm proposing.
>
> This patch changes setups behaviour on only one way:
> package included post-install scripts will run before hand placed
> scripts. (i.e. Pierre's security testing script).
>
> It doesn't (yet) add dependencies to the the script ordering, but that
> is truely trivial given an ordered iterator for the package db.
>
> 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.

> 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?

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

> 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...

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)?

> 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...

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...
	Igor

> 2003-03-15  Robert Collins  <rbtcollins@hotmail.com>
>
>          * install.cc: Introduce Installer class.
>          (init_dialog): Rename to Installer::initDialog.
>          (progress): Rename to Installer::progress.
>          (standard_dirs): Rename to Installer::StandardDirs.
>          (uninstall_one): Rename to Installer::uninstallOne.
>          (replace_one): Rename to Installer::replaceOne.
>          (log_ror_failure): Rename to Installer::replaceOnRebootFailed.
>          (log_ror_success): Rename to Installer::replaceOnRebootSucceeded.
>          (install_one_source): Rename to Installer::installOneSource.
>          Note script files as they are installed.
>          * package_version.cc (packageversion::addScript): Implement.
>          (packageversion::scripts): Implement.
>          * package_version.h (packageversion::addScript): Record the presence of a script.
>          * script.h (Script): New class to track scripts.
>          * postinstall.cc (do_postinstall): Iterate through the package listed scripts before searching for scripts.
>          * String++.cc (String::substr): Second argument needed to be signed.
>          * String++.h (String::substr): Second argument needed to be signed.

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune



More information about the Cygwin-apps mailing list