[Yum] Run script after yum install & yum update
Seth Vidal
skvidal at fedoraproject.org
Thu Mar 4 18:48:52 UTC 2010
On Thu, 4 Mar 2010, Rob Hassing wrote:
> Hello all,
>
> Would it be possible to run a script every time yum is finished after an
> update or install a package?
> I would like to add the priority information in the specific files.
> After an upgrade all priority information is missing in the .repo files.
>
> The script looks like this:
> #!/bin/bash
> # Change the default CentOS repositories files to have priority 2
> find /etc/yum.repos.d/Cent*.repo -size +1c > /tmp/files.tmp
> while read filename
> do
> grep -q "priority=" $filename
> if [ $? -ne 0 ] ; then
> mv $filename $filename.BG
> sed -e "/^\[/a\priority=2" $filename.BG >> $filename
> rm -f $filename.BG
> echo $filename
> fi
> done < /tmp/files.tmp
> rm -f /tmp/files.tmp
> # Change the "thirdparty" repositories files to have priority 12
> find /etc/yum.repos.d/*.repo -size +1c > /tmp/files.tmp
> while read filename
> do
> grep -q "priority=" $filename
> if [ $? -ne 0 ] ; then
> mv $filename $filename.BG
> sed -e "/^\[/a\priority=12" $filename.BG >> $filename
> rm -f $filename.BG
> echo $filename
> fi
> done < /tmp/files.tmp
> rm -f /tmp/files.tmp
>
>
Check out the yum post-transactions-actions plugin.
-sv
More information about the Yum
mailing list