Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 0.61 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. rpm=$1
  4. creates=$2
  5.  
  6. if [[ -z $rpm || -z $creates ]]; then
  7.     echo "Usage: [path to rpm] [file/dir the package creates]"
  8.     exit 1
  9. fi
  10.  
  11. name=`rpm -qpi $rpm | head -n1 | awk '{print $3}'`
  12. # Check if the package (any version of it) is installed already
  13. #rpm -ql $name &>/dev/null
  14. #if [ $? == 0 ]; then
  15.     # If it's installed, don't do anything, because forcing a different
  16.     # version to be installed will prevent Puppet from installing it.
  17. #    exit 0
  18. #fi
  19.  
  20. if [ -e $creates ]; then
  21.     cd /tmp
  22.     wget -Orpm-$$.rpm $rpm
  23.     rpm -i --justdb --ignoresize rpm-$$.rpm
  24.     rm -f rpm-$$.rpm
  25. fi