Add YUM variable to for Fedora >= 22
Add a YUM variable that defaults to dnf for Fedora 22 and greater. At this stage the yum element can do double-duty with dnf -- it's mostly the same. If we find it starts getting too unwieldy we can separate this later. Modify the install-packages for yum to use this variable when set, but default back to "yum" to retain the status-quo. Change-Id: Ibff71465b392d9f66b6f93955ff9223575d6165c
This commit is contained in:
parent
6bf4631cfa
commit
f112b6f690
2 changed files with 14 additions and 2 deletions
8
elements/fedora/environment.d/11-yum-dnf.bash
Normal file
8
elements/fedora/environment.d/11-yum-dnf.bash
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue