Skip to content

Instantly share code, notes, and snippets.

@holys
Created March 3, 2014 12:22
Show Gist options
  • Save holys/9323895 to your computer and use it in GitHub Desktop.
Save holys/9323895 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Install BuildRequires from .spec file
function install_buildrequires()
{
requires=$(grep "BuildRequires" $1 | awk '{print $2}')
for require in $requires
do
echo "Installing $require"
yum install -y $require
done
}
function help()
{
printf "\n Usage: sudo ./install_buildrequires.sh filename.spec \n"
printf "\n"
exit
}
if [ "$UID" -ne 0 ]
then echo "Yum requires to run as root."
exit
fi
if [[ -z "$1" ]]; then
help
else
install_buildrequires $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment