Bug 45210 - uninstall scripts being run after upgrade
uninstall scripts being run after upgrade
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
6.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-20 17:36 EDT by Need Real Name
Modified: 2007-04-18 12:33 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-06-20 17:36:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2001-06-20 17:36:09 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686)

Description of problem:
Using rpm -U runs package %preun and %postun scripts after upgrading
package.  Preinstall scripts add/check for existance of user, uninstall
scripts remove the user.  During upgrade,  the new files are installed, and
then the user is removed.

How reproducible:
Always

Steps to Reproduce:
Make a package with uninstall scripts (either %preun or %postun) and then
make a newer version of the package with the same scripts.  With the old
version currently installed, perform an upgrade with rpm -U and the
uninstall scripts will be executed. 


	

Actual Results:  Uninstall scripts remove settings from configuration
files, etc when performing an upgrade. 

Expected Results:  Uninstall scripts should be executed when removing a
package (rpm -e).  %preun should execute at the beginning of the uninstall
process and %postun should execute after the uninstall process.  

Additional info:

Currently we will need to recommend to users to -e the package and then -i
it, otherwise if they use -U configuration settings (additions to
/etc/services for example) will have been removed (due to the uninstall
scripts being run).
Comment 1 Jeff Johnson 2001-06-23 06:37:22 EDT
In rpm, an upgrade is an install followed by an erase.

To distinguish between %preun/%postun being called
by either --update or --erase, you need to test the
first argument passed to the script, which is always
the number of instances of the package that will
be present at the end of the execution of the script.

That means your %preun/%postun scriptlets need to
be written something like

	%preun
	if [  $1 == 0 ]; then
	    echo "This is an rpm  --erase command."
	else
	    echo "This is an rpm --update command."
	fi

Note You need to log in before you can comment on or make changes to this bug.