#!/bin/bash

if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

# TODO(lucasagomes): optimize the ramdisk for other OSs
if [ $DISTRO_NAME = 'fedora' ] ; then

    _remove_yum=''
    if [ $DIB_RELEASE -ge 22 ]; then
        # if we are on F22, we can remove yum if there, because it has
        # been superseeded by dnf
        _remove_yum='yum'
    fi

    install-packages -e kernel-debug-devel gcc fedora-logos \
                    rsync pykickstart \
                    genisoimage tcpdump \
                    man-db kbd-misc \
                    plymouth cronie ${_remove_yum}

    ${YUM:-yum} clean all

    # Rebuilding the rpm database after removing packages will reduce
    # its size
    rpm --rebuilddb

fi
