Preremove section in http://cygwin.com/setup.html

Igor Pechtchanski pechtcha@cs.nyu.edu
Tue Feb 17 18:10:00 GMT 2004


Rob,

I think this got lost in the shuffle, so here's a belated "Ping!".
	Igor

On Tue, 16 Sep 2003, Igor Pechtchanski wrote:

> On Wed, 17 Sep 2003, Robert Collins wrote:
>
> > On Wed, 2003-09-17 at 04:16, Igor Pechtchanski wrote:
> > > Ping!
> >
> > Pong. You had actions listed in your email, that you haven't come back
> > to me with their results..
> >
> > Rob
>
> Since everything in the message below was already considered in the prior
> patch, I'm assuming you meant that I didn't reply to the comments in
> <http://cygwin.com/ml/cygwin-apps/2003-08/msg00001.html>.
>
> Ok, attached is the next iteration, with those comments figured in.
>         Igor
>
> > > On Thu, 10 Jul 2003, Igor Pechtchanski wrote:
> > >
> > > > Rob,
> > > >
> > > > Replies inline.
> > > >
> > > > On 10 Jul 2003, Robert Collins wrote:
> > > >
> > > > > Well, we haven't set a policy on the number of postinstall scripts.
> > > > > I'd really prefer one package == one script. It feels cleaner to me that
> > > > > way.
> > > >
> > > > It's a general rule of thumb, but it's just a policy, not an
> > > > implementation limitation.  It might be cleaner sometimes to create
> > > > multiple postinstall scripts to clearly separate the functionality -- see
> > > > "base-files", for example.
> > > >
> > > > > Also, it's not guaranteed that all your depended-upon scripts will run
> > > > > when a cycle is present.
> > > > >
> > > > > That is, if foo depends on bar, and bar on foo, only one of the two will
> > > > > have the scripts run first. Might be an idea to mention that (and the
> > > > > 'normal' approach of breaking the common stuff into a third package both
> > > > > depend on).
> > > >
> > > > True.  I'll change that section.
> > > >
> > > > > Pre remove scripts are limited to -one- per package. Either .sh or .bat.
> > > > > If setup supports both at once, it's an accident and is not guaranteed
> > > > > to remain.  Again, for consistency, all scripts should be one per
> > > > > package.
> > > >
> > > > Pre-remove scripts are invoked using try_run_script(), which will execute
> > > > *both* .sh and .bat if present.
> > > >
> > > > > Other than those issues, it looks good to me.
> > > > > Rob
> > > >
> > > > Ok, I'm attaching another iteration.  Incidentally, what's the official
> > > > spelling of "postinstall" and "preremove"?  Is it with a hyphen, with a
> > > > space, or as one word?
> > > >         Igor
> > > >
> > > > > On Thu, 2003-07-10 at 12:25, Igor Pechtchanski wrote:
> > > > > > On Sat, 24 May 2003, Sergey Okhapkin wrote:
> > > > > >
> > > > > > > > Actually, all us package maintainers ought to do a better job
> > > > > > > > including "pre-remove" scripts in addition to post-install scripts,
> > > > > > > > that would clean up anything created by the postinstaller.  Yep --
> > > > > > > > setup supports this -- but most maintainers (I'm guilty here...) don't
> > > > > > > > bother:
> > > > > > >
> > > > > > > I never heard about "pre-remove" support in setup,
> > > > > > > http://cygwin.com/setup.html has nothing about.
> > > > > >
> > > > > > Attached is a patch to <http://cygwin.com/setup.html> that talks about
> > > > > > preremove scripts and brings the postinstall section up to date.  I'm
> > > > > > targeting it here rather than to the main cygwin list because IMO it is of
> > > > > > more interest to this audience, having to do with package maintenance and
> > > > > > setup.exe.  I can also check this in if it's approved.
> > > > > >       Igor

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

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton
-------------- next part --------------
Index: setup.html
===================================================================
RCS file: /cvs/cygwin/htdocs/setup.html,v
retrieving revision 1.88
diff -u -p -r1.88 setup.html
--- setup.html	16 Sep 2003 08:22:35 -0000	1.88
+++ setup.html	16 Sep 2003 22:14:21 -0000
@@ -26,7 +26,7 @@ that. Setup.exe has it's own homepage <a
   <li><p><a href="#setup.hint">setup.hint</a></p></li>
   <li><p><a href="http://sources.redhat.com/cygwin-apps/setup.html#setup.ini">setup.ini</a></p></li>
   <li><p><a href="#package_contents">making packages</a></p></li>
-  <li><p><a href="#postinstall">Creating a package postinstall script</a></p></li>
+  <li><p><a href="#postinstall">Creating package postinstall and preremove scripts</a></p></li>
   <li><p><a href="#submitting">Submitting a package</a></p></li>
 </ul>
 
@@ -623,12 +623,13 @@ directory, you must structure your packa
   </ul>
 </ul>
 
-<h2><a id="postinstall" name="postinstall">Creating a package postinstall script</a></h2>
+<h2><a id="postinstall" name="postinstall">Creating package postinstall and preremove scripts</a></h2>
 
 <p>If your package requires certain commands to be executed after the
-files in the package are installed, include them in a file in the
-package called /etc/postinstall/<var>package</var>.sh or
-/etc/postinstall/<var>package</var>.bat.</p>
+files in the package are installed (e.g., to create symbolic links),
+include them in a file in the package that resides in the
+/etc/postinstall/ directory.  The file may have either a .sh or a
+.bat suffix.</p>
 
 <p>If the file's name ends in ".sh", it is executed with the Cygwin
 shell; if it ends in ".bat", it is executed with the DOS command
@@ -639,13 +640,41 @@ ignored.</p>
 ".done" to its previous name, to prevent it from being run again the
 next time the user runs the setup program.</p>
 
+<p>The general policy is one postinstall script per package.  There is
+currently no implementation-imposed limit on the number of postinstall
+scripts in any given package, but this may change <b>without notice</b>.
+Also, it is the responsibility of the package maintainer to make sure their
+postinstall scripts don't clash with postinstall scripts in other packages.
+The easiest way to do this is to include the package name as part of the
+postinstall script name, or even name the postinstall script
+/etc/postinstall/<var>package</var>.sh or
+/etc/postinstall/<var>package</var>.bat.</p>
+
 <p>Note that the setup program runs all the postinstall scripts after
 all desired packages have been installed, that is, it does not run
 each package's postinstall script immediately after installing that
-package.  Note, furthermore, that the order in which the scripts are
-run is not guaranteed.  Therefore, if your package depends on others
-which have their own postinstall scripts, you cannot assume in your
-script that the other packages' scripts have already been run.</p>
+package.  Note, furthermore, that the setup program runs scripts in
+order of package dependencies, so that if your package depends on
+others which have their own postinstall scripts, their postinstall
+scripts should have run by the time your script is executed.  However,
+the order of execution of postinstall scripts within a package, or in
+different packages in the presence of circular package dependencies
+(i.e., <var>foo</var> depends on <var>bar</var> and <var>bar</var>
+depends on <var>foo</var>), is <i>undefined</i>.  A suggested way to
+break circular dependencies is factoring out the mutually-dependent
+parts of the two packages into a third package and making both
+original packages require the new one.</p>
+
+<p>Some postinstall actions may need to be undone just before the
+package is uninstalled.  Setup supports this with preremove scripts,
+which go in /etc/preremove/.  Note that, unlike postinstall scripts,
+the preremove scripts have to have the same name as the package, i.e.,
+/etc/preremove/<var>package</var>.sh or
+/etc/preremove/<var>package</var>.bat, and are limited to 1 per
+package.  Also note that preremove scripts are executed
+right in the middle of the package uninstall sequence, so some
+commands may not be available (because the corresponding packages
+have already been uninstalled).</p>
 
 <h2><a id="submitting" name="submitting">Submitting a package</a></h2>
 <p>So you've got a package you want to submit. Follow the following checklist before emailing cygwin-apps@cygwin.com and you'll almost certainly save time.</p>


More information about the Cygwin-apps mailing list