Hello,
im looking for an example to get the right exit status for rpm and dnf command if some actions during this transaction were not successfully completed.
right now even if my rpm scriptlet throws out an error the rpm and dnf command exit code is always 0.
Q. What has to be settled up in the scriptlet that rpm or dnf throws out exit code >0 if an error occurred?
oslevel -s
7300-01-02-2320
#lslpp -l rpm.rte
Fileset Level State Description
----------------------------------------------------------------------------
Path: /usr/lib/objrepos
rpm.rte 4.15.1.2011 COMMITTED RPM Package Manager
Path: /etc/objrepos
rpm.rte 4.15.1.2011 COMMITTED RPM Package Manager
#dnf --version
4.2.17
Installed: dnf-0:4.2.17-64_53.ppc at Tue Aug 13 08:02:11 2024
Built : at Fri Apr 28 10:34:40 2023
+++
Exit status of rpm and dnf command is successfull (0) even
if some actions during this transaction were not successfully completed.
This could cause a security risk on machines.
++example rpm command++
rpm -ivh <RPM name>
+++++++++++++++++++++
./..
-----> Skript mit RC [10] beendet <-----
warning: %post(RPM Name) scriptlet failed, exit status 1
Error Register agent -- installation aborts
warning: %posttrans(RPM Name) scriptlet failed, exit status 1
#echo $?
0
++example dnf command++
dnf -y install <RPM Name>
+++++++++++++++++++++
./..
Error Register agent -- installation aborts
warning: %post(RPM Name) scriptlet failed, exit status 1
Error in POSTIN scriptlet in rpm package <RPM Name>
Error Register agent -- installation aborts
warning: %posttrans(RPM Name) scriptlet failed, exit status 1
Error in POSTTRANS scriptlet in rpm package <RPM Name>
Verifying : <RPM Name> 1/1
Installed:
<RPM Name>
Complete!
#echo $?
0
CHers Patrick
------------------------------
Patrick Hügli
------------------------------