File: mkace

package info (click to toggle)
acedb 4.9.39%2Bdfsg.02-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 33,796 kB
  • sloc: ansic: 256,989; perl: 2,803; cpp: 2,534; csh: 1,712; python: 862; sh: 658; makefile: 298; awk: 249; lex: 225; yacc: 221
file content (92 lines) | stat: -rwxr-xr-x 1,971 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#! /bin/sh
# mkace -- Script to make an AceDB database
#
# Arguments can be any mixture of:
#    *.wrm          files to override standard ones
#    *.ace          files to load into database
#    *.tace, */tace (once only) tace program to use
#    */wspec        directory for default .wrm files
# all of which are optional,
# and there must be one other argument, which is the
# name of the database directory being created
#
# If no tace program is specified on the command line,
# env var TACE is tried, and if no joy, your path.
#
# .wrm files are copied from acedb/wspec in your home
# directory if no argument ends with wspec

WRMS=""
ACES=""
HASACE=false
EXAMPLE=$HOME/acedb/wspec

while [ $# -gt 0 ]
do
  case $1 in
    *.wrm)         WRMS="$WRMS $1"
                   shift ;;
    *.ace)         ACES="$ACES $1"
                   HASACE=true
                   shift ;;
    *.tace|*/tace) TACE=$1
                   shift ;;
    */wspec)       EXAMPLE=$1
                   shift ;;
    *)             TOP=$1
                   shift ;;
  esac
done

echo TOP is $TOP
echo WRMS are $WRMS
echo ACES are $ACES

if [ -d "$TOP" ]
then
  rm -rf $TOP
fi

mkdir $TOP
mkdir $TOP/database
WSPEC=$TOP/wspec
mkdir $WSPEC

for SPECFILE in models.wrm options.wrm passwd.wrm database.wrm
do
  cp $EXAMPLE/$SPECFILE $WSPEC
  chmod u+w $WSPEC/$SPECFILE
done

for SPECFILE in $WRMS
do
  echo Overriding with $SPECFILE
  cp $SPECFILE $WSPEC
done

if $HASACE
then
  if [ "$TACE" != "" ]
  then
    echo will add $ACES
  else
    TACE=`which tace`
    if [ "$TACE" != "" ]
    then
      echo will add $ACES
      TACETEMP=/tmp/mkace$$
      echo y > $TACETEMP
      for ACEFILE in $ACES
      do
        echo parse $ACEFILE >> $TACETEMP
      done
      echo save >> $TACETEMP
      echo quit >> $TACETEMP
      $TACE $TOP < $TACETEMP
      rm -f $TACETEMP
    else
      echo tace not defined -- either give as argument or define TACE in environment
      exit 1
    fi
  fi
fi