lib/Tools/changeparent
author wenzelm
Mon, 02 Dec 1996 18:19:28 +0100
changeset 2295 bae5683c2891
child 2310 f49958ca2f8d
permissions -rwxr-xr-x
changeparent: change parent of Poly/ML database.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2295
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     1
#!/bin/bash
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     2
#
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     3
# DESCRIPTION: change parent of Poly/ML database
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     4
#
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     5
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     6
PRG=$(basename $0)
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     7
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     8
function usage()
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
     9
{
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    10
  echo
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    11
  echo "Usage: $PRG DB PARENT"
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    12
  echo
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    13
  echo "  Change parent of Poly/ML database DB to PARENT (full path name!)."
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    14
  echo
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    15
  exit 1
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    16
}
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    17
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    18
function fail()
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    19
{
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    20
  echo "$1"
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    21
  exit 2
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    22
}
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    23
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    24
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    25
## main
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    26
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    27
[ $# -ne 2 ] && usage
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    28
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    29
DB="$1"
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    30
PARENT="$2"
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    31
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    32
case "$ML_SYSTEM" in
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    33
  polyml-*)
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    34
    [ ! -w "$DB" ] && fail "Database not writable: $DB"
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    35
    $POLYML_HOME/changeParent "$DB" "$PARENT"
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    36
    ;;
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    37
  *)
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    38
    fail "You're not set up for Poly/ML!"
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    39
    ;;
bae5683c2891 changeparent: change parent of Poly/ML database.
wenzelm
parents:
diff changeset
    40
esac