This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If the folder `/car/cache/dnf` is present, the content will be cached like in the Yum plugin. A possible configuration to enable it: Vagrant.configure(2) do |config| config.vm.box = "fedora/24-cloud-base" if Vagrant.has_plugin?("vagrant-cachier") config.cache.scope = :machine config.cache.auto_detect = false config.cache.enable :dnf end end
- Loading branch information
Showing
6 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# DNF | ||
|
||
Used by Fedora guests, will get configured under guest's `/var/cache/dnf`. It will | ||
also [make sure](lib/vagrant-cachier/bucket/dnf.rb#L20) that `keepcache` is set to | ||
`1` on guest's `/etc/dnf/dnf.conf`. | ||
|
||
To manually enable it: | ||
|
||
```ruby | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = 'some-fedora-box' | ||
config.cache.enable :dnf | ||
end | ||
``` | ||
|
||
### :warning: Notice about Windows hosts :warning: | ||
|
||
In case this bucket is enabled and a Windows host is in use, you might see an | ||
ugly stacktrace as described on [this comment](https://github.com/fgrehm/vagrant-cachier/issues/117#issuecomment-50548393) | ||
if some DNF repository is not available during provisioning. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module VagrantPlugins | ||
module Cachier | ||
class Bucket | ||
class Dnf < Bucket | ||
def self.capability | ||
:dnf_cache_dir | ||
end | ||
|
||
def install | ||
if guest.capability?(:dnf_cache_dir) | ||
guest_path = guest.capability(:dnf_cache_dir) | ||
return if @env[:cache_dirs].include?(guest_path) | ||
|
||
# Ensure caching is enabled | ||
comm.sudo("sed -i '/keepcache=/d' /etc/dnf/dnf.conf") | ||
comm.sudo("sed -i '/^[main]/a keepcache=1' /etc/dnf/dnf.conf") | ||
|
||
symlink(guest_path) | ||
else | ||
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'DNF') | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module VagrantPlugins | ||
module Cachier | ||
module Cap | ||
module RedHat | ||
module DnfCacheDir | ||
def self.dnf_cache_dir(machine) | ||
'/var/cache/dnf' | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters