diff --git a/elements/fedora/environment.d/11-yum-dnf.bash b/elements/fedora/environment.d/11-yum-dnf.bash new file mode 100644 index 00000000..568419d9 --- /dev/null +++ b/elements/fedora/environment.d/11-yum-dnf.bash @@ -0,0 +1,8 @@ +# since f22, dnf is the yum replacement. Mostly it drops in +# unmodified, so while we transision KISS and use this to choose + +if [ $DIB_RELEASE -ge 22 ]; then + export YUM=dnf +else + export YUM=yum +fi diff --git a/elements/yum/bin/install-packages b/elements/yum/bin/install-packages index e67ab55f..25c77aef 100755 --- a/elements/yum/bin/install-packages +++ b/elements/yum/bin/install-packages @@ -24,6 +24,9 @@ EXTRA_ARGS= ACTION=install MAP_ELEMENT= +# allow override for dnf, as shipped by default with >=F22 +YUM=${YUM:-yum} + SCRIPTNAME=$(basename $0) function show_options () { echo "Usage: $SCRIPTNAME [package ...]" @@ -42,7 +45,7 @@ eval set -- "$TEMP" while true ; do case "$1" in - -u) yum -y update; exit 0;; + -u) ${YUM} -y update; exit 0;; -d) EXTRA_ARGS="--downloadonly"; shift;; -e) ACTION="erase"; shift;; -m) MAP_ELEMENT=$2; shift 2;; @@ -52,6 +55,7 @@ while true ; do esac done + # Packages that aren't available in the distro but requested for installation # can be ignored by adding them to the exclude list BLACKLIST=$(cat /tmp/yum-blacklist 2>/dev/null || echo "") @@ -87,7 +91,7 @@ if [ -n "$WHITELIST" ]; then echo "Not running install-packages $ACTION with empty packages list" else echo "Running install-packages ${ACTION}. Package list: $PKGS" - yum -y $ACTION $EXTRA_ARGS $PKGS + ${YUM} -v -y $ACTION $EXTRA_ARGS $PKGS for pkg in "$@"; do if [ "$pkg" = "python-pip" ] ; then alternatives --install /usr/bin/pip pip /usr/bin/pip-python 10