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:

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.

This article was posted by Matty on 2010-03-07 10:22:00 -0400 -0400