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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
#! /bin/sh
# $ApsCVS: src/apsfilter/bin/setup_dvips.sh,v 1.2 2000/04/16 11:42:08 andreas Exp $
# Script to make apsfilter work with TeX and dvips properly, cause
# there are version of dvips "on the net" floating around not working
# properly.
# Just some basic error-testing is done, perhaps more if the script is
# used more widely and the first bug-reports reach us :-)
read_mode() {
echo " Please enter the mode metafont uses to create fonts for your "
echo " Printer. Proper mode-strings can be found in your modes.mf "
echo " database in your mf-Directory "
echo " "
echo -n "Metafont-Mode : "
read MODE
}
check_valid_mode() {
TEMPDIR=${TMP:-"/tmp"}
TMPDIR=$TEMPDIR/aps$$
mkdir $TMPDIR || exit 1
cd $TMPDIR || return
rm -f *gf 2> /dev/null
mf '\mode='$MODE'; input logo10' >/dev/null 2>&1
RES_X=`echo logo10*gf | sed 's/logo10.//;s/gf//'`
RES=RES_X
rm -f *gf 2> /dev/null
mf '\mode='$MODE'; landscape; input logo10' >/dev/null 2>&1
RES_Y=`echo logo10*gf | sed 's/logo10.//;s/gf//'`
cd $TEMPDIR
rm -rf $TMPDIR
if [ $RES_X = 2602 ]; then
echo " "
echo " Please check your Mode, Metafont dropped into proof-mode. "
echo " This usually happens if the Mode isn't recognized. "
echo " "
exit 1
fi
EASY=true
if [ $RES_Y != $RES_X ]; then
EASY=false
echo " "
echo " Your printer uses a different resolution for X- and Y-direction. "
echo " We will take care of this!"
echo " "
RES=${RES_X}x${RES_Y}
else
RES=$RES_X
fi
}
read_config_dir() {
echo " "
echo " Please enter the directory-name where TeX keeps its PostScript "
echo " Configuration-files. If you are not sure where to find it search "
echo " for a file named config.ps, this is a good starting point! "
echo " "
echo " (If you're using Debian's default installation of TeX, just"
echo " press Enter.)"
echo " "
echo -n " TeX-Configuration-Dir [/etc/texmf/dvips] : "
read CONFIG_DIR
[ "$CONFIG_DIR" ] || CONFIG_DIR=/etc/texmf/dvips
}
check_config_dir() {
if [ ! -d $CONFIG_DIR ];then
echo " "
echo " You didn't enter a valid directory-name, please check your input."
echo " "
exit 1
fi
if [ ! -f `dirname $CONFIG_DIR"/e"`/config.ps ]; then
echo `dirname $CONFIG_DIR"/e"`/config.ps
echo " "
echo " The directory you entered does NOT contain the config.ps-file "
echo " and so it is very unlikely the TeX-config-directory. "
echo " Bye!! "
exit 1
fi
}
create_config_file() {
echo " "
echo " We create a config-file for a $RES DPI Printer in $CONFIG_DIR "
echo " "
echo " creating `dirname $CONFIG_DIR"/e"`/config.$RES "
if [ $EASY = true ]; then
echo "M $MODE" > `dirname $CONFIG_DIR"/e"`/config.$RES
echo "R $RES_X" >> `dirname $CONFIG_DIR"/e"`/config.$RES
else
echo "M $MODE" > `dirname $CONFIG_DIR"/e"`/config.$RES
echo "X $RES_X" >> `dirname $CONFIG_DIR"/e"`/config.$RES
echo "Y $RES_Y" >> `dirname $CONFIG_DIR"/e"`/config.$RES
fi
echo " Done ! "
echo " "
echo " Much fun using apsfilter together with dvips! "
echo " "
exit 0
}
read_mode
check_valid_mode
read_config_dir
check_config_dir
create_config_file
|