Re: Run script after yum install & yum update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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

_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxx
http://lists.baseurl.org/mailman/listinfo/yum

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux