From b183e024ba962d2eeb2967b0846ee8397c64808d Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 27 May 2015 14:53:04 +1000 Subject: [PATCH] Work around yum/dnf differences Some minor workarounds for Fedora >= 22 where dnf is the default package manager. The changes are documented on the Fedora release notes https://fedoraproject.org/wiki/Changes/ReplaceYumWithDNF Change-Id: I7d7d6f5d294980dcb217d6190a1efd9e0bbea9a6 --- .../rpm-distro/pre-install.d/01-override-yum-arch | 10 ++++++++-- elements/yum/post-install.d/99-reset-yum-conf | 10 ++++++++-- elements/yum/pre-install.d/01-yum-keepcache | 13 +++++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/elements/rpm-distro/pre-install.d/01-override-yum-arch b/elements/rpm-distro/pre-install.d/01-override-yum-arch index 25763e54..9e957699 100755 --- a/elements/rpm-distro/pre-install.d/01-override-yum-arch +++ b/elements/rpm-distro/pre-install.d/01-override-yum-arch @@ -25,5 +25,11 @@ else exit 1 fi -echo $basearch > /etc/yum/vars/basearch -echo $arch > /etc/yum/vars/arch +if [ $DIB_RELEASE -ge 22 ]; then + mkdir -p /etc/dnf/vars + echo $basearch > /etc/dnf/vars/basearch + echo $arch > /etc/dnf/vars/basearch +else + echo $basearch > /etc/yum/vars/basearch + echo $arch > /etc/yum/vars/arch +fi diff --git a/elements/yum/post-install.d/99-reset-yum-conf b/elements/yum/post-install.d/99-reset-yum-conf index 23ac30f5..e36bcc39 100755 --- a/elements/yum/post-install.d/99-reset-yum-conf +++ b/elements/yum/post-install.d/99-reset-yum-conf @@ -6,5 +6,11 @@ fi set -eu set -o pipefail -sed -i 's/keepcache=1/keepcache=0/' /etc/yum.conf -sed -i 's/cachedir=\/tmp\/yum/cachedir=\/var\/cache\/yum/' /etc/yum.conf +if [ $DIB_RELEASE -ge 22 ]; then + cfg=/etc/dnf/dnf.conf +else + cfg=/etc/yum.conf +fi + +sed -i 's/keepcache=1/keepcache=0/' $cfg +sed -i 's/cachedir=\/tmp\/yum/cachedir=\/var\/cache\/yum/' $cfg diff --git a/elements/yum/pre-install.d/01-yum-keepcache b/elements/yum/pre-install.d/01-yum-keepcache index 5386faf9..f02e17e3 100755 --- a/elements/yum/pre-install.d/01-yum-keepcache +++ b/elements/yum/pre-install.d/01-yum-keepcache @@ -6,5 +6,14 @@ fi set -eu set -o pipefail -sed -i 's/keepcache=0/keepcache=1/' /etc/yum.conf -sed -i 's/cachedir=\/var\/cache\/yum/cachedir=\/tmp\/yum/' /etc/yum.conf +if [ $DIB_RELEASE -ge 22 ]; then + # dnf is slightly different; doesn't have these by default + cfg=/etc/dnf/dnf.conf + echo "keepcache=1" >> $cfg + echo "cachedir=/tmp/yum" >> $cfg +else + cfg=/etc/yum.conf + sed -i 's/keepcache=0/keepcache=1/' $cfg + sed -i 's/cachedir=\/var\/cache\/yum/cachedir=\/tmp\/yum/' $cfg +fi +