Product SiteDocumentation Site

6.13.2. Usage examples

/usr/share/doc/yum-plugin-post-transaction-actions-1.1.24/sample.action
#action_key:transaction_state:command
# action_key can be: pkgglob, /path/to/file (wildcards allowed)
# transaction_state can be: install,update,remove,any
# command can be: any shell command
#  the following variables are allowed to be passed to any command:
#   $name - package name
#   $arch - package arch
#   $ver - package version
#   $rel - package release
#   $epoch - package epoch
#   $repoid - package repository id
#   $state - text string of state of the package in the transaction set
#
# file matches cannot be used with removes b/c we don't have the info available

*:install:touch /tmp/$name-installed
zsh:remove:touch /tmp/zsh-removed
zsh:install:touch /tmp/zsh-installed-also
/bin/z*h:install:touch /tmp/bin-zsh-installed
z*h:any:touch /tmp/bin-zsh-any
If you copy this sample file in /etc/yum/post-actions/, when you install zsh you get the next output:
# yum install zsh
...
Warning: Since last transaction, database has been modifidied (RPMDB).
  Installing     : zsh-4.3.10-4.fc12.x86_64                                                        
...
Running post transaction command: touch /tmp/bin-zsh-any
Running post transaction command: touch /tmp/zsh-installed
Running post transaction command: touch /tmp/bin-zsh-installed
Running post transaction command: touch /tmp/zsh-installed-also
...
And when removing zsh:
# yum remove zsh
...
Warning: Since last transaction, databases has been modified (RPMDB).
  Erasing     : zsh-4.3.10-4.fc12.x86_64                                                        
...
Running post transaction command: touch /tmp/bin-zsh-any
Running post transaction command: touch /tmp/zsh-removed
...