#!/bin/bash
#Generated file, part of preupgrade-assistant content, should not be used
#separately, see preupgrade-assistant license for licensing details
#Do the upgrade for the packages with potentially broken obsoletes/provides
for i in $(echo " ql2400-firmware|linux-firmware redhat-lsb-graphics|redhat-lsb-desktop xorg-x11-drv-ast|xorg-x11-drv-modesetting python-virtinst|virt-manager ql2500-firmware|linux-firmware bfa-firmware|linux-firmware NetworkManager-gnome|nm-connection-editor,network-manager-applet sane-backends-libs-gphoto2|sane-backends-drivers-cameras xorg-x11-drv-mga|xorg-x11-drv-modesetting coreutils-libs|coreutils gpxe-roms-qemu|ipxe-roms-qemu xorg-x11-drv-cirrus|xorg-x11-drv-modesetting libudev|systemd-libs")
do
  old="$(echo $i | cut -d'|' -f1)"
  new="$(echo $i | cut -d'|' -f2 | tr ',' ' ')"
  #we want to remove the old package if still present
  rpm -q $old 2>/dev/null >/dev/null && {
  #Store the modified files as .preupsave
  for j in $(rpm -V $old | rev | cut -d' ' -f1 | rev | grep -v "(replaced)")
  do
    cp $j $j.preupsave
    echo "Storing modified file $j from $old as $j.preupsave"
  done
  #deinstall the old package
  rpm -e $old --nodeps
  echo "Package $old uninstalled"
  }
  #do we already have all new installed? Skip it...
  rpm -q $new >/dev/null && continue
  yum install -y $new
  rpm -q $new 2>/dev/null >/dev/null && echo "Package(s) $new installed" && continue
  #when we are here, installation got wrong and we should warn the user.
  echo  "Installation of package(s) $new failed, you need to install it manually!"
done
for old in $(echo " GConf2-gtk NetworkManager-gnome bfa-firmware control-center-extra coreutils-libs cryptsetup-luks-libs cryptsetup-luks db4-devel db4-utils db4 dracut-kernel gcalctool gdm-plugin-fingerprint gpxe-roms-qemu iptables-ipv6 jpackage-utils kdebase-libs kdebase-workspace-libs kdebase-workspace-wallpapers kdebase-workspace kdebase kernel-firmware kpathsea libudev libusb1 man mesa-dri-filesystem module-init-tools nfs-utils-lib perl-Compress-Zlib perl-IO-Compress-Base perl-IO-Compress-Bzip2 perl-IO-Compress-Zlib polkit-desktop-policy poppler-qt4 procps python-virtinst ql2400-firmware ql2500-firmware qt-sqlite redhat-lsb-compat redhat-lsb-graphics samba4-libs sane-backends-libs-gphoto2 util-linux-ng vgabios xorg-x11-drv-apm xorg-x11-drv-ast xorg-x11-drv-ati-firmware xorg-x11-drv-cirrus xorg-x11-drv-elographics xorg-x11-drv-glint xorg-x11-drv-i128 xorg-x11-drv-i740 xorg-x11-drv-mach64 xorg-x11-drv-mga xorg-x11-drv-nv xorg-x11-drv-r128 xorg-x11-drv-rendition xorg-x11-drv-s3virge xorg-x11-drv-savage xorg-x11-drv-siliconmotion xorg-x11-drv-sisusb xorg-x11-drv-sis xorg-x11-drv-tdfx xorg-x11-drv-trident xorg-x11-drv-voodoo xorg-x11-drv-xgi yum-plugin-security")
do
  #we want to remove the old package if still present
  rpm -q $old 2>/dev/null >/dev/null && {
  #Store the modified files as .preupsave
  for j in $(rpm -V $old | rev | cut -d' ' -f1 | rev | grep -v "(replaced)")
  do
    cp $j $j.preupsave
    echo "Storing modified file $j from $old as $j.preupsave"
  done
  #deinstall the old package
  rpm -e $old --nodeps
  echo "Package $old uninstalled"
  }
done
