Viewing the scripts that run when you install a Linux RPM
RPM packages contain the ability to run scripts after a package is added or removed. These scripts can perform actions like adding or removing users, cleaning up temporary files, or checking to make sure a software component that is contained within a package isn’t running. To view the contents of the scripts that will be run, you can use the rpm “–scripts” option:
$ rpm -q –scripts -p VirtualBox-3.1-3.1.4_57640_fedora11-1.x86_64.rpm |more
preinstall scriptlet (using /bin/sh): # defaults [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox # check for active VMs if pidof VBoxSVC > /dev/null 2>&1; then echo "A copy of VirtualBox is currently running. Please close it and try again. Please not e" echo "that it can take up to ten seconds for VirtualBox (in particular the VBoxSVC daemon) to" echo "finish running." exit 1 fi
RPM provides four types of pre and post installation scripts that can be run:
preinstall scriptlet — this will run before a package is installed
postinstall scriptlet — this will run after a package is installed
preuninstall scriptlet — this will run before a package is uninstalled
postuninstall scriptlet — this will run after a package is uninstalled
There are some awesome RPM options buried in the documentation, and you will definitely want to read through the various RPM resources prior to creating RPMs.








mike on March 7th, 2010
Sweet. Easier than rpm2cpio.