This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Beeing general. -- postinstall / preremove --


 As I have no "sources" for the webpage I cannot create patches.
I don't know if this text appears elsewhere...

Please, do a "PTC" analysis on this anyway!

Corrections may be necessary, as always - I'm a lazy scribbler.
In contrary to others on this list I'm not perfect.

/Hannu E K Nevalainen, B.Sc. EE Microcomputer systems - 59?14'N, 17?12'E



 Reformatted paragraphs, to adhere to <80 chars per line.

-- Excerpt from -- http://cygwin.com/setup.html --

Creating a package postinstall script

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/package.sh or /etc/postinstall/package.bat.

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 interpreter.
If it doesn't end with either of these suffixes, it is ignored.

After the script has been run it is renamed by appending the suffix
".done" to its previous name, to prevent it from being run again the
next time the user runs the setup program.

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.

-- END of excerpt -- http://cygwin.com/setup.html --
-- Addition to be appended here --

Before you create anything that alters things that might be subject to
user preference - think it over very thoroughly! Adjust as much as
possible to what the user has set as his preference.

An example: The Start-menu

The user might have reordered his/hers Start-menu in an "advanced"
manner, then adding multiple shortcuts to the menu in a way that
disobeys "the rules" is just plain irritating.

If you still feel that you should add things to the Start-menu, then
first check if there is a "Cygwin" folder there. If there is one, then
add your stuff in there, using a new folder named after the package
you're maintaining.

 Here is an example of a postinstall script that checks for the existanse of
the Cygwin start-menu folder. If it isn't there it does "exit"

$ head -15 cygwin-doc-postinstall.sh.done
#!/bin/sh
# cygwin-doc.sh
# requires "mkshortcut" from cygutils

# determine if there is a Start Menu "Cygwin" directory, put links in place
if so
CYGWIN_ASM="$(cygpath -AP)/Cygwin"
CYGWIN_SM="$(cygpath -P)/Cygwin"
if [ -d "$CYGWIN_ASM" ]; then
        CYG_USER_FLAGS="-AP"
elif [ -d "$CYGWIN_SM" ]; then
        CYG_USER_FLAGS="-P"
else
        exit 0
fi

As you have created a postinstall script, it is strongly urged that you
should also consider creating a script that reverses the actions.

This is called a preremove script and should be included in the package
analogous to the postinstall scripts, just replacing the path with
/etc/preremove/package.sh or /etc/preremove/package.bat.

-- END of addition --

--END OF MESSAGE--


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]