lib/Tools/changeparent
changeset 2295 bae5683c2891
child 2310 f49958ca2f8d
equal deleted inserted replaced
2294:a67343c87db4 2295:bae5683c2891
       
     1 #!/bin/bash
       
     2 #
       
     3 # DESCRIPTION: change parent of Poly/ML database
       
     4 #
       
     5 
       
     6 PRG=$(basename $0)
       
     7 
       
     8 function usage()
       
     9 {
       
    10   echo
       
    11   echo "Usage: $PRG DB PARENT"
       
    12   echo
       
    13   echo "  Change parent of Poly/ML database DB to PARENT (full path name!)."
       
    14   echo
       
    15   exit 1
       
    16 }
       
    17 
       
    18 function fail()
       
    19 {
       
    20   echo "$1"
       
    21   exit 2
       
    22 }
       
    23 
       
    24 
       
    25 ## main
       
    26 
       
    27 [ $# -ne 2 ] && usage
       
    28 
       
    29 DB="$1"
       
    30 PARENT="$2"
       
    31 
       
    32 case "$ML_SYSTEM" in
       
    33   polyml-*)
       
    34     [ ! -w "$DB" ] && fail "Database not writable: $DB"
       
    35     $POLYML_HOME/changeParent "$DB" "$PARENT"
       
    36     ;;
       
    37   *)
       
    38     fail "You're not set up for Poly/ML!"
       
    39     ;;
       
    40 esac