diff --git a/diskimage_builder/elements/yum/bin/install-packages b/diskimage_builder/elements/yum/bin/install-packages index 8b65c7c40..1c0a0219a 100755 --- a/diskimage_builder/elements/yum/bin/install-packages +++ b/diskimage_builder/elements/yum/bin/install-packages @@ -135,6 +135,13 @@ if [ -n "$WHITELIST" ]; then # [1] https://bugzilla.redhat.com/show_bug.cgi?id=965567 set -o xtrace ${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 $_xtrace # probably not the right place for this; but python-pip package on diff --git a/diskimage_builder/elements/yum/pre-install.d/00-dnf-update b/diskimage_builder/elements/yum/pre-install.d/00-dnf-update new file mode 100755 index 000000000..30560a50f --- /dev/null +++ b/diskimage_builder/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