home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 1999 May / CDROM.ISO / suse / inst-sys / usr / lib / rpm / find-requires < prev    next >
Encoding:
Text File  |  1999-03-18  |  1.0 KB  |  46 lines

  1. #!/bin/sh
  2.  
  3. # note this works for both a.out and ELF executables
  4. # it also auto-generates requirment lines for shell scripts
  5.  
  6. if test -n "$PACKRPM_NO_REQ"; then
  7.   cat > /dev/null
  8. else
  9.  
  10. ulimit -c 0
  11.  
  12. tempfilelist=`sed "s/['\"]/\\\&/g"`
  13. filelist=""
  14. for i in $tempfilelist ; do
  15.   case $i in
  16.     *.SuSE-dynamic)
  17.     # skip it
  18.     ;;
  19.     *)
  20.     filelist="$filelist $i"
  21.     ;;
  22.   esac
  23. done
  24.  
  25. exelist=`echo $filelist | xargs -r file | fgrep executable | cut -d: -f1 `
  26. scriptlist=`echo $filelist | xargs -r file | egrep ":.*(perl |script )" | cut -d: -f1 `
  27. liblist=`echo $filelist | xargs -r file | grep "shared object" | cut -d : -f1 `
  28.  
  29. for f in $exelist; do
  30.     if [ -x $f ]; then
  31.     ldd $f | awk '/=>/ { print $1 }'
  32.     fi
  33. done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | sort -u
  34.  
  35. for f in $liblist; do
  36.     ldd $f | awk '/=>/ { print $1 }'
  37. done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | sort -u
  38.  
  39. for f in $scriptlist; do
  40.     if [ -x $f ]; then
  41.     head -1 $f | sed -e 's/^\#\![     ]*//' | cut -d" " -f1
  42.     fi
  43. done | sort -u
  44.  
  45. fi
  46.