Difference between revisions of "Yum-plugin-priorities"

From SME Server
Jump to navigationJump to search
(/* Configuration for sme7.4)
Line 32: Line 32:
 
  sed s/enabled=1/enabled=1\\npriority=10/ /etc/yum.conf.sav > yum.conf
 
  sed s/enabled=1/enabled=1\\npriority=10/ /etc/yum.conf.sav > yum.conf
  
 +
==== Modify /etc/yum.conf/* in sme 7.4 ====
 +
 +
create priority db default
 +
#!/bin/bash
 +
 +
for REPO in smeaddons smecontribs smedev smeextras smeos smetest smeupdates smeupdates-testing addons base  centosplus contrib extras updates
 +
do
 +
echo 5 > /etc/e-smith/db/yum_repositories/defaults/$REPO/priority
 +
done
 +
 +
echo "now run"
 +
echo "/etc/e-smith/events/actions/initialize-default-databases"
 +
echo "expand-template /etc/yum.smerepos.d/sme-base.repo"
 +
 +
add the following, to the bottom of the fragment, use templates-custom if you prefer
 +
nano -w  /etc/e-smith/templates-custom/etc/yum.smerepos.d/sme-base.repo/20repositories
 +
 +
      if (exists $props{priority})
 +
        {
 +
            $OUT .= "priority" . '=' . $props{priority} . "\n";
 +
        }
  
 
== Testing ==
 
== Testing ==

Revision as of 09:57, 22 November 2008

yum-plugin-priorities

Warning.png Warning:
Currently under development. DOES NOT WORK



Edit-find-replace.png Not reviewed:
This howto or contrib has not been reviewed and might contain code that could harm your installation. For more information on the review process have a look at the Development Review page.



This page is intended to explore the possible use of yum-plugin-priorities in order to help prevent the installation of unwanted rpms from 3rd-party repositories such as dag, dries, etc.

Inspired by Bugzilla:4757

Installation

SME 7.x (Centos 4.x

yum --enablerepo=extras install yum-plugin-priorities

SME 8.x (Centos 5.x)

(untested!)

yum --enablerepo=extras install yum-priorities

Configuration

New config files

(SME 7.x): The installation of yum-plugin-priorities will create /etc/yum/pluginconf.d/priorities.conf with the following settings

[main]
enabled = 1
check_obsoletes = 1

These settings tell yum to pay attention to the 'priority' setting for each repo, and to make sure the an 'obsoletes' flag in a low priority repo will not result in the removal of a package from a higher-priority repo.

Modify /etc/yum.conf

Now add priority=10 to the repos in /etc/yum.conf that are enabled by default.

cd /etc
mv yum.conf yum.conf.sav
sed s/enabled=1/enabled=1\\npriority=10/ /etc/yum.conf.sav > yum.conf

Modify /etc/yum.conf/* in sme 7.4

create priority db default

#!/bin/bash

for REPO in smeaddons smecontribs smedev smeextras smeos smetest smeupdates smeupdates-testing addons base  centosplus contrib extras updates
do
echo 5 > /etc/e-smith/db/yum_repositories/defaults/$REPO/priority
done

echo "now run"
echo "/etc/e-smith/events/actions/initialize-default-databases"
echo "expand-template /etc/yum.smerepos.d/sme-base.repo"

add the following, to the bottom of the fragment, use templates-custom if you prefer

nano -w  /etc/e-smith/templates-custom/etc/yum.smerepos.d/sme-base.repo/20repositories 

      if (exists $props{priority})
       {
           $OUT .= "priority" . '=' . $props{priority} . "\n";
       }

Testing

Original Configuration

yum update
...
Transaction Summary
=============================================================================
Install      0 Package(s)
Update       8 Package(s)
Remove       0 Package(s)
yum --enablerepo=dag update
...
Transaction Summary
=============================================================================
Install     22 Package(s)
Update      80 Package(s)
Remove       0 Package(s)

After modifying /etc/yum.conf

yum update
...
Transaction Summary
=============================================================================
Install      0 Package(s)
Update       8 Package(s)
Remove       0 Package(s)
yum --enablerepo=dag update
...
Error: Missing Dependency: perl(DBD::Pg) >= 1.32 is needed by package perl-DBIx-DBSchema
...

To Do

Figure out why setting priorities results in missing dependcies.

I tried giving all 'sme' repos higher priority (priority=5) than the centos repos (priority=10) - same result.