home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / bin / rebuild-gcj-db < prev    next >
Encoding:
Text File  |  2006-08-29  |  885 b   |  52 lines

  1. #! /bin/bash
  2.  
  3. set -e
  4.  
  5. if [ $# != 0 ]; then
  6.     cat 1>&2 <<-EOF
  7.     rebuild-gcj-db: re-build the gcj classmap database
  8.     
  9.     usage: $0
  10.     EOF
  11.     exit 1
  12. fi
  13.  
  14.  
  15. rebuild_db()
  16. {
  17.     dbtool=$1; shift
  18.     dbLocation=$1; shift
  19.     dirs=
  20.  
  21.     for dir; do [ -d $dir ] && dirs="$dirs $dir"; done
  22.     mkdir -p $(dirname $dbLocation)
  23.     $dbtool -n $dbLocation.tmp 64
  24.     find $dirs -follow -name '*.db' -print0 | \
  25.     xargs -r -0 $dbtool -m $dbLocation.tmp $dbLocation.tmp || exit 1
  26.     mv $dbLocation.tmp $dbLocation
  27. }
  28.  
  29.  
  30. rebuild_databases()
  31. {
  32.     v=$1
  33.     dbtool=gcj-dbtool-$1
  34.     dbLocation=`$dbtool -p`
  35.  
  36.     rebuild_db \
  37.     $dbtool \
  38.     $dbLocation \
  39.     /usr/share/gcj/classmap.d \
  40.     /usr/share/gcj-$v/classmap.d
  41. }
  42.  
  43. # still two different databases for gcj-4.1 and gcj-4.2
  44.  
  45. if [ -x /usr/bin/gcj-dbtool-4.1 ]; then
  46.     rebuild_databases 4.1
  47. fi
  48.  
  49. if [ -x /usr/bin/gcj-dbtool-4.2 ]; then
  50.     rebuild_databases 4.2
  51. fi
  52.