27 April 2016

List the scriptlets of an RPM file

On Windows 7-Zip is my favorite tool to view RPM files. Just open the file in 7-Zip to view its contents:

In the above screenshot I have opened the sudo RPM and I can see the files that would be copied into the file system if the RPM is installed.

Unfortunately you cannot see the RPM scriptlets (the %pre, %post, %preun, %postun etc) with 7-Zip. For that I have not found any GUI alternative, but the Linux rpm command can give the scriptlets:
[root@krusty temp]# rpm -qp --scripts sudo-1.8.6p7-17.el7_2.x86_64.rpm
postinstall scriptlet (using /bin/sh):
/bin/chmod 0440 /etc/sudoers || :

As seen in the above command only one scriptlet exists, the postinstall, that issues a chmod command.