dependency installer


/ Published in: Bash
Save to your folder(s)

Install dependencies required to run am application on fedora


Copy this code and paste it in your HTML
  1. #!/usr/bin
  2. #
  3. # This program will install required dependencies for the file provided
  4. # as a command line argument. For verbose output add -v as the second
  5. # argument.
  6. #
  7. # Currently only works on RPM Based Distributions!
  8. #
  9. # (c) 2011 Keiran "Affix" Smith <[email protected]>
  10. #
  11. # This program is free software: you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation, either version 3 of the License, or
  14. # (at your option) any later version.
  15. #
  16. # This program is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. # GNU General Public License for more details.
  20. #
  21. # You should have received a copy of the GNU General Public License
  22. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  23.  
  24.  
  25. DEPS=$(ldd $1 | grep -i 'not found' | grep -P '((?:[a-z][a-z]+)).*?(so).*?(\d+)(.)' -o)
  26.  
  27. for i in $DEPS
  28. do
  29. 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)
  30. echo "$i provided by $PROVIDED."
  31. echo
  32. echo "Starting Install..."
  33. echo
  34. if [ "$2" == "-v" ];
  35. then
  36. yum install $PROVIDED
  37. else
  38. yum install $PROVIDED -y &>/dev/null
  39. fi
  40. echo "Installed $PROVIDED !!"
  41. echo
  42. done
  43.  
  44. echo "All available Libraries installed!"

URL: http://affix.me

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.