summaryrefslogtreecommitdiff
path: root/support/proof/install
blob: d4d73fa3dbb12980492d2a6b026b6c0bddc05c43 (plain)
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
#!/bin/bash -e

# $Id: install,v 1.2 2002/09/30$

#
# Proof install script
#

# show system configuration!
function list_progs
{
  cmds=('bash --version' 'xterm -version' 'tex --version' \
        'etex --version' 'pdftex --version' 'pdfetex --version' \
        'mf --version' 'mpost --version' 'dvips --version' \
        'dvipdfm --version' 'gs --version' 'rcs -V')
  names=('GNU bash   ' 'XFree86    ' 'TeX        ' 'e-TeX      '\
         'pdfTeX     ' 'pdf-e-TeX  ' 'METAFONT   ' 'MetaPost   ' \
         'dvips      ' 'dvipdfm    ' 'Ghostscript' 'RCS        ')
  
  local i=0 cmd
  until [ $i = 12 ]; do
    cmd=${cmds[$i]}
    echo -n "${names[$i]}: "
    if type ${cmd% *} >/dev/null 2>&1; then
      ver=$(echo "$(eval $cmd | sed '/^$/d;s/-release//g' | head -1)" | \
          sed 's/.*\ \([0-9]\+\.[0-9]\+[^\ ,]*\).*/\1/')
      echo "${ver:+version $ver }found"
    else
      echo "<-- not installed!"
    fi
    i=$((i+1))
  done
}

echo -e "You'll see a short list of those applications now Proof expects\nto be installed on your system. 'install' will complain if a\nparticular program cannot be found...\n"

list_progs; echo

read -p 'Install Proof? (y/n) '
[ "$REPLY" = 'n' ] && { echo 'Ok, aborting...'; exit 0; }

# copy Proof files!
inst_dirs=(/usr/local/bin ~ /usr/man/man1)
files=(proof .proofrc proof.1.gz)
types=(shellscript 'configuration file' 'manual page')

function _cp
{
sed '
/^\.SH FILES/,/^$/{
  s:^\.I proof$:\.I '${inst_dirs[0]}'/proof:
  s:^\.I proofrc$:\.I ~/\.proofrc:
  s:^\.I proof\.1$:\.I '${inst_dirs[2]}'/proof\.1\.gz:
}' $1 | gzip -c >$2
}

echo
for i in 0 2; do
  read -p "Install ${types[$i]} ${files[$i]} to ${inst_dirs[$i]}? (y/n) "
  if [ "$REPLY" = 'n' ]; then
    read -p 'Path? '
    eval inst_dirs[$i]=$REPLY
  fi
done

cp proof ${inst_dirs[0]}/${files[0]}
cp proofrc ${inst_dirs[1]}/${files[1]}
_cp proof.1 ${inst_dirs[2]}/${files[2]}

echo -e '\nProof is now installed.'