#!/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.'