On Fri, 18 Jun 2004 12:40:57 +0200 (CEST), Peter Astrand wrote: > > What is $1, er, how is it instantiated? > > The number of instances of the package currently installed on the > system, after the current package has been installed or erased. Take a > look at http://www.rpm.org/max-rpm/s1-rpm-inside-scripts.html. Thanks again. It appears from the link that updating a package first installs the new package and then uninstalls the old package??? If so, I presume rpm has functionality to check that files overwritten by the install are not deleted by the uninstall, right? On Fri, 2004-06-18 at 11:00, Peter Astrand wrote: > > Would it be possible to extend rpm with an option to be used in kernel > > rpms, so that when people (mistakenly) run "rpm -Uvh kernel-2.6...", > > the old kernel rpm is not uninstalled? > > > I am thinking about a pre-uninstall script that checks how rpm has been > > invoked, and if it is by -U, it somehow cancels the uninstall. Is this > > possible today without first extending rpm? > > It seems like this is not possible. Perhaps this solution will do instead: > > %preun > if [ $1 -lt 2 ]; then > echo You should always keep at least two kernels installed! > echo Aborting uninstall of package %{name}-%{version}-%{release} > echo > exit 64 > fi Or what about this? %preun #!/bin/sh -e # Have to be careful about assuming utilities are available running_kernel=$(uname -r 2>/dev/null) if [ -z "$running_kernel" ]; then read junk1 junk2 running_kernel morejunk < /proc/version 2>/dev/null # The code above is fragile if the proc/version format changes. if [ "$junk1 $junk2" != "Linux version" ]; then running_kernel= fi unset junk1 junk2 morejunk fi if [ -z "$running_kernel" ]; then echo "Unable to get current running kernel version!" echo "Proceeding with uninstall." # Will only happen on strangely configured systems, # let's not interfere fi if [ "$running_kernel" = "%{version}-%{release}" ]; then echo "%{name}-%{version}-%{release}: Refusing to uninstall" \ "the package of the running kernel." exit 64 fi Besides, is there a particular reason for choosing the exit code of 64? Regards, Enrique _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/rpm-list