Return to Snippet

Revision: 50253
at August 17, 2011 11:22 by Affix


Initial Code
#!/usr/bin
#
#    This program will install required dependencies for the file provided
#    as a command line argument. For verbose output add -v as the second
#    argument.
#
#    Currently only works on RPM Based Distributions!
#
#    (c) 2011 Keiran "Affix" Smith <[email protected]>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.


DEPS=$(ldd $1 | grep -i 'not found' | grep -P '((?:[a-z][a-z]+)).*?(so).*?(\d+)(.)' -o)

for i in $DEPS
do
	PROVIDED=$(yum provides $i | grep -P '((?:[a-z][a-z]+)).*?(?:[a-z][a-z]*[0-9]+[a-z0-9]*).*?((?:[a-z][a-z]*[0-9]+[a-z0-9]*))' -o)
	echo "$i provided by  $PROVIDED."
	echo
	echo "Starting Install..."
	echo
	if [ "$2" == "-v" ]; 
	then
		yum install $PROVIDED
	else
		yum install $PROVIDED -y &>/dev/null
	fi
	echo "Installed $PROVIDED !!"
	echo
done

echo "All available Libraries installed!"

Initial URL
http://affix.me

Initial Description
Install dependencies required to run am application on fedora

Initial Title
dependency installer

Initial Tags


Initial Language
Bash