Chapter 6. Package maintainer scripts and installation procedure
40
6.2 Maintainer scripts Idempotency
It is necessary for the error recovery procedures that the scripts be idempotent. This means
that if it is run successfully, and then it is called again, it doesn't bomb out or cause any harm,
but just ensures that everything is the way it ought to be. If the first call failed, or aborted
half way through for some reason, the second call should merely do the things that were left
undone the first time, if any, and exit with a success status if everything is OK.
1
6.3 Controlling terminal for maintainer scripts
The maintainer scripts are guaranteed to run with a controlling terminal and can interact with
the user. If they need to prompt for passwords, do full screen interaction or something simi
lar you should do these things to and from
/dev/tty
, since
dpkg
will at some point redirect
scripts' standard input and output so that it can log the installation process. Likewise, because
these scripts may be executed with standard output redirected into a pipe for logging pur
poses, Perl scripts should set unbuffered output by setting
$|=1
so that the output is printed
immediately rather than being buffered.
Each script should return a zero exit status for success, or a nonzero one for failure.
6.4 Summary of ways maintainer scripts are called
new preinst
install
new preinst
install
old version
new preinst
upgrade
old version
old preinst
abort upgrade
new version
postinst
configure
most recently configured version
old postinst
abort upgrade
new version
conflictor's postinst
abort remove in favour
package new version
deconfigured's postinst
abort deconfigure in favour
failed install package version
removing
conflicting package version
prerm
remove
old prerm
upgrade
new version
new prerm
failed upgrade
old version
conflictor's prerm
remove in favour
package new version
deconfigured's prerm
deconfigure in favour
package being installed version
removing
conflicting package version
postrm
remove
postrm
purge
old postrm
upgrade
new version
new postrm
failed upgrade
old version
1
This is so that if an error occurs, the user interrupts
dpkg
or some other unforeseen circumstance happens you
don't leave the user with a badly broken package when
dpkg
attempts to repeat the action.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved