bdisk/lib/00-im_batman.func.sh
2014-12-23 22:59:20 -05:00

31 lines
841 B
Bash

function im_batman {
set +e # false errors are bad mmk
# Detect the distro and set some vars
if [ -f "/usr/bin/yum" ]; # CentOS/Redhat, etc.
then
OS_STRING='RHEL-like'
DISTRO='RHEL'
INST_CMD='yum -y install '
elif [ -f "/usr/bin/pacman" ]; # Arch, Manjaro, etc.
then
OS_STRING='Arch-like'
DISTRO='Arch'
INST_CMD='pacman -S '
elif [ -f "/usr/bin/emerge" ]; # Gentoo
then
OS_STRING='Gentoo-like'
DISTRO='Gentoo'
INST_CMD='emerge '
elif [ -f "/usr/bin/apt-get" ]; # Debian, Ubuntu (and derivatives), etc.
then
OS_STRING='Debian-like'
DISTRO="Debian"
INST_CMD='apt-get install '
else
echo 'Sorry, I cannot detect which distro you are running. Please report this along with what distro you are running. Dying now.'
exit 1
fi
set -e # and turn this back on lolz
}