From b544e914945051255f87d95c5e91898fd21605a1 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 4 Sep 2015 16:00:31 +0200 Subject: [PATCH] Make sure dnf won't autoremove packages that we explicitly installed As dnf 1.1.1 is pretty recent, make sure we update it as early as possible. Change-Id: I30039090cfe652b864d847713ab2986c5659023d --- elements/yum/bin/install-packages | 7 +++++++ elements/yum/pre-install.d/00-dnf-update | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 elements/yum/pre-install.d/00-dnf-update diff --git a/elements/yum/bin/install-packages b/elements/yum/bin/install-packages index 90b28f86..dac71738 100755 --- a/elements/yum/bin/install-packages +++ b/elements/yum/bin/install-packages @@ -124,6 +124,13 @@ if [ -n "$WHITELIST" ]; then ${YUM} -v -y $ACTION $EXTRA_ARGS $PKGS + if [ "$ACTION" == "install" ]; then + if [ ${YUM} == "dnf" ]; then + # Make sure dnf won't autoremove these packages + dnf mark install $PKGS + fi + fi + # probably not the right place for this; but python-pip package on # fedora/rh calls pip "pip-python" while the rest of the work # expects it to be just called "pip" diff --git a/elements/yum/pre-install.d/00-dnf-update b/elements/yum/pre-install.d/00-dnf-update new file mode 100755 index 00000000..30560a50 --- /dev/null +++ b/elements/yum/pre-install.d/00-dnf-update @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -eq 22 ]]; then + # we need dnf mark command from dnf 1.1.1, which is pretty recent + dnf --refresh update -y dnf +fi