I made a package which is triggerd by another one. I expected to get $2=0 in %triggerpostun when removing the trigger package, but I got $2=1; in %triggerun I got $2=0. Is this a correct behavior? --package I made-- %triggerun -- trigger echo package 1 triggerun:---- $* %triggerpostun -- trigger echo package 1 triggerpostun: $* --trigger I made-- %preun echo trigger 1 preun:-------- $* --result I got-- package 1 triggerun:---- 1 0 trigger 1 preun:-------- 0 trigger 1 postun:------- 0 package 1 triggerpostun: 1
Can you send me 2 minimal spec files that exhibit the behavior? ------- Email Received From iNOUE Koich! <inoue.musashi-tech.ac.jp> 04/20/99 19:42 -------
error correction of error I got: --result I got-- package 1 triggerun:---- 1 0 trigger 1 preun:-------- 0 trigger 1 postun:------- 0 package 1 triggerpostun: 1 1
From rpm/docs/triggers: ... Recall that the $1 passed to regular scripts contains the number of instances of the package which will be installed when the operation has completed. $1 for triggers is exactly the same -- it is the number of instances of the source (or triggered) package which will remain when the trigger has completed. Similarly,$2 is the number of instances of the target package which will remain. In this case, if any of the targets will remain after the uninstall, the trigger doesn't do anything (as it's probably being triggered by an upgrade). Identifying in your case: "triggered package" package1 "target package" trigger then the arguments passed to the triggerpostun script are $1 is the number of instances of package1 $2 is the number of instances of trigger that will be installed on the system after the current operation completes. If you were performing an upgrade, then there would be 1 instance of package1 1 instance of trigger installed on the system after the update completes. So, the arguments appear correct.
> +If you were performing an upgrade, then there would be > + 1 instance of package1 > + 1 instance of trigger > +installed on the system after the update completes. > + > +So, the arguments appear correct. But $2 for %triggerun is 0. What does this mean?
The followings are more complicated sample: 1)package-1-1 has been installed 2)package-1-1 is triggered by trigger-1-1 installation 3)upgraded from trigger-1-1 to trigger-2-2 4)trigger is removed (no.4 case is the same as what I reported first) [root@/usr/src/redhat/RPMS/i386]# rpm -q package trigger package-1-1 package trigger is not installed [root@/usr/src/redhat/RPMS/i386]# rpm -Uvh trigger-1-1.i386.rpm trigger 1 pre:---------- 1 trigger 1 post:--------- 1 package 1 triggerin:---- 1 1 [root@/usr/src/redhat/RPMS/i386]# rpm -Uvh trigger-2-2.i386.rpm trigger 2 pre:---------- 2 trigger 2 post:--------- 2 package 1 triggerin:---- 1 2 package 1 triggerun:---- 1 1 trigger 1 preun:-------- 1 trigger 1 postun:------- 1 package 1 triggerpostun: 1 2 [root@/usr/src/redhat/RPMS/i386]# rpm -e trigger package 1 triggerun:---- 1 0 trigger 2 preun:-------- 0 trigger 2 postun:------- 0 package 1 triggerpostun: 1 1
This was a bug in RPM; $2 in triggerpostun is always off by 1 :-( This will be fixed in RPM 3.0.1. Let me know if you need a patch before then.