Created
March 3, 2014 12:22
-
-
Save holys/9323895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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