Skip to content

Commit

Permalink
Enable automatic installation of packages
Browse files Browse the repository at this point in the history
Filter for packages that may be installed
  • Loading branch information
dagwieers committed Feb 14, 2015
1 parent 8bac802 commit c094779
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion elrepo.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[main]
enabled=1
enabled = 1

# Excluded unsupported packages
exclude = kmod-alsa* kmod-nvidia*

# Install packages automatically ?
install = 0

# Filter used for installing packages, eg. kmod-nvidia*
filter = *
12 changes: 11 additions & 1 deletion elrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def exclude_hook(conduit):
elrepo_matches = []
elrepo_exclude = conduit.confString('main', 'exclude').split()

elrepo_install = conduit.confBool('main', 'install')
elrepo_filter = conduit.confString('main', 'filter').split()

def find_matches(pkg, provides, matchfor=None):
### Skip installed packages
if pkg.repo.id == 'installed': return
Expand All @@ -55,12 +58,19 @@ def find_matches(pkg, provides, matchfor=None):
if fnmatch.fnmatch(modalias, filter):
elrepo_matches.append(pkg)

### If we get a match for this package, don't bother with other provides
### If we get a match, skip all other provides from this package
return

conduit._base.searchPackageProvides(['modalias(*)', ], callback=find_matches, callback_has_matchfor=True)

### Report the matches we find
if elrepo_matches:
conduit.info(1, 'ELRepo hardware support detected using:')
for pkg in elrepo_matches:
conduit.info(1, ' * %s (%s)' % (pkg.name, pkg.repo.id))

### Install packages if requested
if elrepo_install:
for filter in elrepo_filter:
if fnmatch.fnmatch(pkg.name, filter):
conduit._base.install(pattern=pkg.name)

0 comments on commit c094779

Please sign in to comment.