~ubuntu-branches/ubuntu/trusty/texlive-bin/trusty

« back to all changes in this revision

Viewing changes to .pc/55_texconfig_stuff/texk/tetex/texconfig

  • Committer: Package Import Robot
  • Author(s): Norbert Preining
  • Date: 2012-05-16 14:05:23 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20120516140523-airve5118gm9w68n
Tags: 2012.20120516-1
* new upstream snapshot based on TL2012 tlpretest
* remove outdated and not needed patches
* remove traces of debian internal mupdmap, we use the one that is now
  shipped by default in TeX Live
* patch shipped updmap for correct perl module search path
* move patches from debian/patches to debian/quilt, add quilt as 
  build dep, and include quilt patching in debian/rules
  this gets us rid of the "strange" parts of the 3.0 format
  (see quilt vs dpkg-source fuzzyness acceptance). 
  Thanks to an unnamed dev who gave me the hint!
* disable build-wovp2ovf patch, included upstream
* (re)install cnf.h into libkpathsea-dev (Closes: #673016)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
# TeXConfig version 3.0
4
 
# Originally written by Thomas Esser. Public domain.
5
 
# Now maintained as part of TeX Live; correspondence to tex-live@tug.org.
6
 
 
7
 
# invoke the right shell:
8
 
 
9
 
test -f /bin/ksh && test -z "$RUNNING_KSH" \
10
 
  && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
11
 
  && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; }
12
 
unset RUNNING_KSH
13
 
 
14
 
test -f /bin/bsh && test -z "$RUNNING_BSH" \
15
 
  && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
16
 
  && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
17
 
unset RUNNING_BSH
18
 
 
19
 
export PATH
20
 
 
21
 
# hack around a bug in zsh:
22
 
test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
23
 
 
24
 
# initializations...
25
 
progname=texconfig
26
 
 
27
 
# the version string
28
 
version='$Id$'
29
 
 
30
 
envVars="
31
 
  AFMFONTS BIBINPUTS BSTINPUTS CMAPFONTS CWEBINPUTS ENCFONTS GFFONTS
32
 
  GLYPHFONTS INDEXSTYLE LIGFONTS MFBASES MFINPUTS MFPOOL MFTINPUTS
33
 
  MISCFONTS MPINPUTS MPMEMS MPPOOL MPSUPPORT OCPINPUTS OFMFONTS
34
 
  OPENTYPEFONTS OPLFONTS OTPINPUTS OVFFONTS OVPFONTS PDFTEXCONFIG PKFONTS
35
 
  PSHEADERS SFDFONTS T1FONTS T1INPUTS T42FONTS TEXBIB TEXCONFIG TEXDOCS
36
 
  TEXFONTMAPS TEXFONTS TEXFORMATS TEXINDEXSTYLE TEXINPUTS TEXMFCNF
37
 
  TEXMFDBS TEXMFINI TEXMFSCRIPTS TEXPICTS TEXPKS TEXPOOL TEXPSHEADERS
38
 
  TEXSOURCES TFMFONTS TRFONTS TTFONTS VFFONTS WEB2C WEBINPUTS
39
 
"
40
 
tmpdir=${TMPDIR-${TEMP-${TMP-/tmp}}}/tctmp.$$
41
 
needsCleanup=false
42
 
lastUpdatedFile=
43
 
 
44
 
45
 
###############################################################################
46
 
# setupFMT(void) - find a suitable version of fmt / adjust
47
 
#
48
 
setupFMT()
49
 
{
50
 
  case $FMT in
51
 
    "") 
52
 
      FMT=fmt
53
 
      test ! -x /bin/fmt && test ! -f /usr/bin/fmt &&
54
 
        { test -x /bin/adjust || test -x /usr/bin/adjust; } && FMT=adjust
55
 
      ;;
56
 
    *)
57
 
      return
58
 
      ;;
59
 
  esac
60
 
}
61
 
 
62
 
###############################################################################
63
 
# myFmt(args) - run $FMT
64
 
#
65
 
myFmt()
66
 
{
67
 
  setupFMT
68
 
  $FMT ${1+"$@"}
69
 
}
70
 
 
71
 
###############################################################################
72
 
# echoShowVariable(args ...)
73
 
#   show environment variables which names are as args and their values
74
 
#
75
 
echoShowVariable()
76
 
{
77
 
  for esv
78
 
  do
79
 
    var=$esv
80
 
    eval val=\"\${$var+=}\${$var- is unset}\"
81
 
    echo "$var$val"
82
 
  done | grep -v 'is unset$'
83
 
}
84
 
 
85
 
###############################################################################
86
 
# echoShowKpseVariable(args ...)
87
 
#   show kpathsea variables which names are as args and their values
88
 
#
89
 
echoShowKpseVariable()
90
 
{
91
 
  for eskv
92
 
  do
93
 
    var=$eskv
94
 
    val=`kpsewhich -var-value="$eskv"`
95
 
    echo "$var=$val"
96
 
  done
97
 
}
98
 
 
99
 
###############################################################################
100
 
# echoLocateBinary(args ...) - show where programs actually exist
101
 
#
102
 
echoLocateBinary()
103
 
{
104
 
  for elb
105
 
  do
106
 
    elbLoc=`checkForBinary "$elb"`
107
 
    if test -n "$ELB_PATH_ONLY"; then
108
 
      test -n "$elbLoc" && echo "$elbLoc"
109
 
    else
110
 
      case $elbLoc in
111
 
        "") echo "$elb: not found";;
112
 
        *) echo "$elb: $elbLoc";;
113
 
      esac
114
 
    fi
115
 
  done
116
 
}
117
 
 
118
 
###############################################################################
119
 
# echoLocateCfgfile(args ...) - show where files actually exist
120
 
#
121
 
echoLocateCfgfile()
122
 
{
123
 
  for elc
124
 
  do
125
 
    case $elc in
126
 
      texmf.cnf) elcLoc=`kpsewhich $elc`;;
127
 
      *) elcLoc=`tcfmgr --cmd find --file "$elc"`;;
128
 
    esac
129
 
    case $elcLoc in
130
 
      "") echo "$elc: not found";;
131
 
      *)  echo "$elcLoc";;
132
 
    esac
133
 
  done
134
 
}
135
 
 
136
 
###############################################################################
137
 
# checkForBinary(prog) - echo full path of prog
138
 
#
139
 
checkForBinary()
140
 
{
141
 
  cfbBinary=$1
142
 
 
143
 
  OLDIFS=$IFS
144
 
  IFS=:
145
 
  set x `echo "$PATH" | sed 's/^:/.:/; s/:$/:./; s/::/:.:/g'`; shift
146
 
  found=false
147
 
  for pathElem
148
 
  do
149
 
    case $pathElem in
150
 
      "") continue;;
151
 
      *) test -f "$pathElem/$cfbBinary" && { echo "$pathElem/$cfbBinary"; found=true; break; }
152
 
    esac
153
 
  done
154
 
  IFS=$OLDIFS
155
 
  case $found in
156
 
    true) (exit 0); return 0;;
157
 
    false) (exit 1); return 1;;
158
 
  esac
159
 
}
160
 
 
161
 
###############################################################################
162
 
# cleanup() - clean up the temp area and exit with proper exit status
163
 
#
164
 
cleanup()
165
 
{
166
 
  rc=$1
167
 
  $needsCleanup && test -n "$tmpdir" && test -d "$tmpdir" \
168
 
    && { cd / && rm -rf "$tmpdir"; }
169
 
  (exit $rc); exit $rc
170
 
}
171
 
 
172
 
###############################################################################
173
 
# setupTmpDir() - set up a temp directory and a trap to remove it
174
 
#
175
 
setupTmpDir()
176
 
{
177
 
  case $needsCleanup in
178
 
    true) return;;
179
 
  esac
180
 
 
181
 
  trap 'cleanup 1' 1 2 3 7 13 15
182
 
  needsCleanup=true
183
 
  (umask 077; mkdir "$tmpdir") \
184
 
    || abort "could not create directory \`$tmpdir'"
185
 
}
186
 
 
187
 
###############################################################################
188
 
# setupTexmfmain() - get value for MT_TEXMFMAIN (with caching)
189
 
#
190
 
setupTexmfmain()
191
 
{
192
 
  case $MT_TEXMFMAIN in
193
 
    "") MT_TEXMFMAIN=`kpsewhich -var-value=TEXMFMAIN`;;
194
 
    *) return;;
195
 
  esac
196
 
}
197
 
 
198
 
###############################################################################
199
 
# setupTexmfmain() - get value for MT_TEXMFDIST (with caching)
200
 
#
201
 
setupTexmfdist()
202
 
{
203
 
  case $MT_TEXMFDIST in
204
 
    "") MT_TEXMFDIST=`kpsewhich -var-value=TEXMFDIST`;;
205
 
    *) return;;
206
 
  esac
207
 
}
208
 
 
209
 
###############################################################################
210
 
# setupTexmfvar() - get value for MT_TEXMFVAR (with caching)
211
 
#
212
 
setupTexmfvar()
213
 
{
214
 
  case $MT_TEXMVAR in
215
 
    "") MT_TEXMVAR=`kpsewhich -var-value=TEXMFVAR`;;
216
 
    *) return;;
217
 
  esac
218
 
}
219
 
 
220
 
###############################################################################
221
 
# setupSystexmf() - get value for MT_SYSTEXMF (with caching)
222
 
#
223
 
setupSystexmf()
224
 
{
225
 
  case $MT_SYSTEXMF in
226
 
    "") MT_SYSTEXMF=`kpsewhich -var-value=SYSTEXMF`;;
227
 
    *) return;;
228
 
  esac
229
 
}
230
 
 
231
 
###############################################################################
232
 
# abort(errmsg)
233
 
#   print `errmsg' to stderr and exit with error code 1
234
 
#
235
 
abort()
236
 
{
237
 
  echo "$progname: $1." >&2
238
 
  cleanup 1
239
 
}
240
 
 
241
 
###############################################################################
242
 
# mktexdir(args)
243
 
#   call mktexdir script, disable all features (to prevent sticky directories)
244
 
#
245
 
mktexdir()
246
 
{
247
 
  setupTexmfmain
248
 
  MT_FEATURES=none "$MT_TEXMFMAIN/web2c/mktexdir" "$@" >&2
249
 
}
250
 
 
251
 
###############################################################################
252
 
# tcfmgr(args) - call tcfmgr script
253
 
#
254
 
tcfmgr()
255
 
{
256
 
  setupTexmfmain
257
 
  "$MT_TEXMFMAIN/texconfig/tcfmgr" "$@"
258
 
}
259
 
 
260
 
###############################################################################
261
 
# mktexupd(args) - call mktexupd script
262
 
#
263
 
mktexupd()
264
 
{
265
 
  setupTexmfmain
266
 
  "$MT_TEXMFMAIN/web2c/mktexupd" "$@"
267
 
}
268
 
 
269
 
###############################################################################
270
 
# getRelDir(file)
271
 
#   matches file against SYSTEXMF. Returns relative directory of file within
272
 
#   a texmf tree in variable relPart.
273
 
#
274
 
getRelDir()
275
 
{
276
 
  file=$1
277
 
  relPart=
278
 
 
279
 
  setupSystexmf
280
 
  OLDIFS=$IFS
281
 
  IFS='
282
 
'
283
 
  set x `echo "$MT_SYSTEXMF" | tr : '
284
 
'`; shift
285
 
  IFS=$OLDIFS
286
 
 
287
 
  # now loop over all components of SYSTEXMF
288
 
  for dir
289
 
  do
290
 
    test -n "$dir" || continue
291
 
    case "$file" in
292
 
      $dir/*)
293
 
        relPart=`echo "$file" | sed "s%$dir/*%%"`
294
 
        break
295
 
        ;;
296
 
    esac
297
 
  done
298
 
 
299
 
  # now check for success / failure
300
 
  case $relPart in
301
 
    ""|$file)
302
 
      # empty or full filename -> getRelDir failed!
303
 
      (exit 1); return 1
304
 
      ;;
305
 
    *)
306
 
      # relPart should just have the "dirname" part:
307
 
      relPart=`echo "$relPart" | sed 's%/*[^/]*$%%'`
308
 
      (exit 0); return 0
309
 
      ;;
310
 
  esac
311
 
}
312
 
 
313
 
###############################################################################
314
 
# configReplace(file pattern line)
315
 
#   The first line in file that matches pattern gets replaced by line.
316
 
#   line will be added at the end of the file if pattern does not match.
317
 
#
318
 
configReplace()
319
 
{
320
 
  configReplaceFile=$1; configReplacePat=$2; configReplaceLine=$3
321
 
 
322
 
  if grep "$configReplacePat" "$configReplaceFile" >/dev/null; then
323
 
    ed "$configReplaceFile" >/dev/null 2>&1 <<-eof
324
 
        /$configReplacePat/c
325
 
        $configReplaceLine
326
 
        .
327
 
        w
328
 
        q
329
 
eof
330
 
  else
331
 
    echo "$configReplaceLine" >> $configReplaceFile
332
 
  fi
333
 
}
334
 
 
335
 
###############################################################################
336
 
# fmgrConfigReplace (file regex value)
337
 
#   replaces line matching regex by value in file
338
 
#
339
 
fmgrConfigReplace()
340
 
{
341
 
  fmgrConfigReplaceChanged=false
342
 
 
343
 
  moreArgs=""
344
 
  while
345
 
    case $1 in
346
 
      --*) moreArgs="$moreArgs $1 $2";;
347
 
      *) break;;
348
 
    esac
349
 
  do shift; shift; done
350
 
  fmgrConfigReplaceFile=$1
351
 
  fmgrConfigReplaceRegex=$2
352
 
  fmgrConfigReplaceValue=$3
353
 
 
354
 
  setupTmpDir
355
 
  co=`tcfmgr $moreArgs --tmp $tmpdir --cmd co --file $fmgrConfigReplaceFile`
356
 
  if test $? != 0; then
357
 
    echo "$progname: fmgrConfigReplace co failed for \`$fmgrConfigReplaceFile'" >&2
358
 
    (exit 1); return 1
359
 
  fi
360
 
  set x $co; shift
361
 
  fmgrConfigReplaceID=$1; fmgrConfigReplaceCfgFile=$3; fmgrConfigReplaceOrigFile=$4
362
 
  configReplace "$fmgrConfigReplaceCfgFile" "$fmgrConfigReplaceRegex" "$fmgrConfigReplaceValue"
363
 
  ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$fmgrConfigReplaceID"`
364
 
  if test $? != 0; then
365
 
    echo "$progname: fmgrConfigReplace ci failed for \`$fmgrConfigReplaceFile'" >&2
366
 
    (exit 1); return 1
367
 
  fi
368
 
  case $ci in
369
 
    "") :;;
370
 
    $lastUpdatedFile)
371
 
      fmgrConfigReplaceChanged=true;;
372
 
    *) echo "$progname: updated configuration saved as file \`$ci'" >&2
373
 
       fmgrConfigReplaceChanged=true
374
 
       lastUpdatedFile=$ci;;
375
 
  esac
376
 
  (exit 0); return 0
377
 
}
378
 
 
379
 
###############################################################################
380
 
# setupDvipsPaper(paper)
381
 
#   rearranges config.ps to make paper the first paper definition
382
 
#
383
 
setupDvipsPaper()
384
 
{
385
 
  setupDvipsPaperChanged=false
386
 
  setupDvipsPaperFile=config.ps
387
 
  setupDvipsPaperDftPaper=$1
388
 
 
389
 
  setupTmpDir
390
 
  co=`tcfmgr --tmp $tmpdir --cmd co --file $setupDvipsPaperFile`
391
 
  if test $? != 0; then
392
 
    echo "$progname: setupDvipsPaper co failed for \`$setupDvipsPaperFile'" >&2
393
 
    (exit 1); return 1
394
 
  fi
395
 
  set x $co; shift
396
 
  setupDvipsPaperID=$1; setupDvipsPaperCfgFile=$3; setupDvipsPaperOrigFile=$4
397
 
 
398
 
  ed "$setupDvipsPaperCfgFile" > /dev/null 2>&1 <<-eof
399
 
        /@ /ka
400
 
        \$a
401
 
        @ 
402
 
        .
403
 
        /@ $setupDvipsPaperDftPaper /;/@ /-1m'a-1
404
 
        \$d
405
 
        w
406
 
        q
407
 
eof
408
 
 
409
 
  ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$setupDvipsPaperID"`
410
 
  if test $? != 0; then
411
 
    echo "$progname: setupDvipsPaper ci failed for \`$setupDvipsPaperFile'" >&2
412
 
    (exit 1); return 1
413
 
  fi
414
 
  case $ci in
415
 
    "") :;;
416
 
    $lastUpdatedFile)
417
 
      setupDvipsPaperChanged=true;;
418
 
    *) echo "$progname: updated configuration saved as file \`$ci'" >&2
419
 
       setupDvipsPaperChanged=true
420
 
       lastUpdatedFile=$ci;;
421
 
  esac
422
 
  (exit 0); return 0
423
 
}
424
 
 
425
 
###############################################################################
426
 
# setupModesMfFile(void) - find modes.mf file (with caching)
427
 
#
428
 
setupModesMfFile()
429
 
{
430
 
  case $modesMfFile in
431
 
    "")
432
 
      modesMfFile=`tcfmgr --cmd find --file modes.mf`
433
 
      ;;
434
 
    *)
435
 
      return
436
 
      ;;
437
 
  esac
438
 
}
439
 
 
440
 
###############################################################################
441
 
# locateConfigPsFile(void) - find config.ps file (with caching)
442
 
#
443
 
locateConfigPsFile()
444
 
{
445
 
  case $configPsFile in
446
 
    "")
447
 
      configPsFile=`tcfmgr --cmd find --file config.ps`
448
 
      ;;
449
 
    *)
450
 
      return
451
 
      ;;
452
 
  esac
453
 
}
454
 
 
455
 
###############################################################################
456
 
# listMfModes(file) - list modes from modes.mf file
457
 
#
458
 
listMfModes()
459
 
{
460
 
  grep mode_def "$modesMfFile" |
461
 
  sed -e "s/mode_def //" \
462
 
      -e "s/ .*%[^ ]* / '/" \
463
 
      -e "s/\$/' /" |
464
 
  egrep -v "^(help|%)" | sort
465
 
}
466
 
 
467
 
###############################################################################
468
 
# listDvipsPapers(void) - list paper definitions from config.ps
469
 
#
470
 
listDvipsPapers()
471
 
{
472
 
  grep '@ ' $configPsFile | sed "s/..//;s/ / '/;s/\$/' /"
473
 
}
474
 
 
475
 
###############################################################################
476
 
# getFormatsForHyphen(void)
477
 
#   list all formats which have customizable hyphenation
478
 
#
479
 
getFormatsForHyphen()
480
 
{
481
 
  fmtutil --catcfg | awk '$3 != "-" {print $1}' | sort
482
 
}
483
 
 
484
 
###############################################################################
485
 
# getRes(mode) - print resolution (both X and Y axis) to metafont mode
486
 
#
487
 
getRes()
488
 
{
489
 
  getResMode=$1
490
 
  (
491
 
    cd $tmpdir
492
 
    cat >mftmp.mf <<-'eof'
493
 
        let myexit = primitive_end_;
494
 
        mode_setup;
495
 
        string xdpi;
496
 
        xdpi := decimal round pixels_per_inch;
497
 
        message "XDPI = " & xdpi;
498
 
        string ydpi;
499
 
        ydpi := decimal round (pixels_per_inch * aspect_ratio);
500
 
        message "YDPI = " & ydpi;
501
 
        fontmaking := 0;
502
 
        myexit;
503
 
eof
504
 
    mf '\mode='"$getResMode"';  \input ./mftmp' </dev/null \
505
 
     | awk '$1 == "XDPI" || $1 == "YDPI" { print $3 }'
506
 
  )
507
 
}
508
 
 
509
 
###############################################################################
510
 
# checkElemInList(elem, list)
511
 
#   check if element exists in list
512
 
###############################################################################
513
 
checkElemInList()
514
 
{
515
 
  checkElemInListElem=$1; shift
516
 
  checkElemInListFound=false
517
 
  for checkElemInListIter
518
 
  do
519
 
    case "x$checkElemInListElem" in
520
 
      x$checkElemInListIter)
521
 
        checkElemInListFound=true
522
 
        break
523
 
        ;;
524
 
    esac
525
 
  done
526
 
  case $checkElemInListFound in
527
 
    true) (exit 0); return 0;;
528
 
  esac
529
 
  (exit 1); return 1
530
 
}
531
 
 
532
 
 
533
 
# show version information from the distribution, if we have any.
534
 
showDistVersionInfo()
535
 
{
536
 
  # TeX Live file.
537
 
  test -f $MT_TEXMFMAIN/../release-texlive.txt \
538
 
  && sed 1q $MT_TEXMFMAIN/../release-texlive.txt
539
 
 
540
 
  # no harm in continuing to look for the teTeX files.
541
 
  test -f $MT_TEXMFMAIN/release-tetex-src.txt \
542
 
  && "teTeX-src release:   `cat $MT_TEXMFMAIN/release-tetex-src.txt`"
543
 
  test -f $MT_TEXMFDIST/release-tetex-texmf.txt \
544
 
  && "teTeX-texmf release: `cat $MT_TEXMFDIST/release-tetex-texmf.txt`"
545
 
}
546
 
 
547
 
548
 
###############################################################################
549
 
# tcBatch(args)
550
 
#   handle batch mode
551
 
###############################################################################
552
 
tcBatch()
553
 
{
554
 
  help="texconfig supports adjusting and updating many aspects of
555
 
the TeX installation.
556
 
 
557
 
Usage: $progname conf                  (show configuration information)
558
 
       $progname dvipdfmx paper PAPER  (dvipdfmx paper size)
559
 
       $progname dvipdfm paper PAPER   (dvipdfm paper size)
560
 
       $progname dvips [OPTION...]     (dvips options)
561
 
       $progname faq                   (show teTeX faq)
562
 
       $progname findprog PROG...      (show locations of PROGs, a la which)
563
 
       $progname font vardir DIR
564
 
       $progname font ro
565
 
       $progname font rw
566
 
       $progname formats               (edit fmtutil.cnf)
567
 
       $progname help                  (or --help; show this help)
568
 
       $progname hyphen FORMAT         (edit hyphenation config for FORMAT)
569
 
       $progname init [FORMAT]...      (rebuild FORMATs, or all formats
570
 
                                        plus run texlinks and updmap)
571
 
       $progname mode MODE             (set Metafont MODE)
572
 
       $progname paper PAPER           (set default paper size to PAPER)
573
 
       $progname pdftex [OPTION]...    (pdftex options)
574
 
       $progname rehash                (rebuild ls-R files with mktexlsr)
575
 
       $progname version               (or --version; show version info)
576
 
       $progname xdvi paper PAPER      (xdvi paper size)
577
 
 
578
 
Get more help with:
579
 
       $progname dvipdfmx
580
 
       $progname dvipdfm
581
 
       $progname dvips
582
 
       $progname font
583
 
       $progname hyphen
584
 
       $progname mode
585
 
       $progname paper
586
 
       $progname pdftex
587
 
       $progname xdvi
588
 
 
589
 
Report bugs to: tex-k@tug.org
590
 
TeX Live home page: <http://tug.org/texlive/>
591
 
"
592
 
 
593
 
  case $1 in
594
 
    # texconfig conf
595
 
    conf|confall)
596
 
      setupTexmfmain
597
 
      setupTexmfdist
598
 
      echo '=========================== version information =========================='
599
 
      showDistVersionInfo
600
 
      echo
601
 
      echo '==================== binaries found by searching $PATH ==================='
602
 
      echo "PATH=$PATH"
603
 
      echoLocateBinary kpsewhich updmap fmtutil texconfig tex pdftex mktexpk dvips dvipdfm
604
 
      echo
605
 
      echo '=========================== active config files =========================='
606
 
      echoLocateCfgfile texmf.cnf updmap.cfg fmtutil.cnf config.ps mktex.cnf XDvi pdftexconfig.tex config | sort -k 2
607
 
      echo
608
 
      echo '============================= font map files ============================='
609
 
      for m in psfonts.map pdftex.map ps2pk.map dvipdfm.map; do
610
 
        echo "$m: `kpsewhich $m`"
611
 
      done
612
 
      echo
613
 
      echo '=========================== kpathsea variables ==========================='
614
 
      echoShowKpseVariable TEXMFMAIN TEXMFDIST TEXMFLOCAL TEXMFSYSVAR TEXMFSYSCONFIG TEXMFVAR TEXMFCONFIG TEXMFHOME VARTEXFONTS TEXMF SYSTEXMF TEXMFDBS WEB2C TEXPSHEADERS TEXCONFIG ENCFONTS TEXFONTMAPS
615
 
 
616
 
      echo
617
 
      echo '==== kpathsea variables from environment only (ok if no output here) ===='
618
 
      echoShowVariable $envVars
619
 
      ;;
620
 
 
621
 
    # texconfig dvipdfm
622
 
    dvipdfm)
623
 
      help="Usage: $progname dvipdfm paper PAPER
624
 
 
625
 
Valid PAPER settings:
626
 
  letter legal ledger tabloid a4 a3"
627
 
      case $2 in
628
 
        # texconfig dvipdfm paper
629
 
        paper-list)
630
 
          for p in letter legal ledger tabloid a4 a3; do echo $p; done
631
 
          ;;
632
 
        paper)
633
 
          case $3 in
634
 
            letter|legal|ledger|tabloid|a4|a3)
635
 
              fmgrConfigReplace config '^p' "p $3";;
636
 
            "") echo "$help" >&2; rc=1;;
637
 
            *)
638
 
             echo "$progname: unknown PAPER \`$3' given as argument for \`$progname dvipdfm paper'" >&2
639
 
             echo "$progname: try \`$progname dvipdfm paper' for help" >&2
640
 
             rc=1 ;;
641
 
          esac ;;
642
 
        # texconfig dvipdfm ""
643
 
        "")
644
 
          echo "$help" >&2; rc=1 ;;
645
 
        # texconfig dvipdfm <unknown>
646
 
        *)
647
 
          echo "$progname: unknown option \`$2' given as argument for \`$progname dvipdfm'" >&2
648
 
          echo "$progname: try \`$progname dvipdfm' for help" >&2
649
 
          rc=1
650
 
          ;;
651
 
      esac
652
 
      ;;
653
 
 
654
 
    # texconfig dvipdfmx
655
 
    dvipdfmx)
656
 
      help="Usage: $progname dvipdfmx paper PAPER
657
 
 
658
 
Valid PAPER settings:
659
 
  letter legal ledger tabloid a4 a3"
660
 
      case $2 in
661
 
        # texconfig dvipdfmx paper
662
 
        paper-list)
663
 
          for p in letter legal ledger tabloid a4 a3; do echo $p; done
664
 
          ;;
665
 
        paper)
666
 
          case $3 in
667
 
            letter|legal|ledger|tabloid|a4|a3)
668
 
              fmgrConfigReplace dvipdfmx.cfg '^p' "p $3";;
669
 
            "") echo "$help" >&2; rc=1;;
670
 
            *)
671
 
             echo "$progname: unknown PAPER \`$3' given as argument for \`$progname dvipdfmx paper'" >&2
672
 
             echo "$progname: try \`$progname dvipdfmx paper' for help" >&2
673
 
             rc=1 ;;
674
 
          esac ;;
675
 
        # texconfig dvipdfmx ""
676
 
        "")
677
 
          echo "$help" >&2; rc=1 ;;
678
 
        # texconfig dvipdfmx <unknown>
679
 
        *)
680
 
          echo "$progname: unknown option \`$2' given as argument for \`$progname dvipdfmx'" >&2
681
 
          echo "$progname: try \`$progname dvipdfmx' for help" >&2
682
 
          rc=1
683
 
          ;;
684
 
      esac
685
 
      ;;
686
 
 
687
 
    # texconfig dvips
688
 
    dvips)
689
 
      shift
690
 
      help="Usage: $progname dvips add PRINTER
691
 
       $progname dvips del PRINTER
692
 
       $progname dvips paper PAPER
693
 
       $progname dvips [-P PRINTER] mode MODE
694
 
       $progname dvips [-P PRINTER] offset OFFSET
695
 
       $progname dvips [-P PRINTER] printcmd CMD"
696
 
      case $1 in
697
 
        -P)
698
 
          case $2 in
699
 
            "")
700
 
              echo "$progname: missing arg for parameter -P" >&2
701
 
              rc=1; (exit $rc); return $rc
702
 
              ;;
703
 
            *)
704
 
              otherPrinter=true
705
 
              otherPrinterName=$2
706
 
              otherPrinterFile=`kpsewhich -format='dvips config' "config.$otherPrinterName"`
707
 
              case $otherPrinterFile in
708
 
                "")
709
 
                  echo "$progname: configuration file \`config.$otherPrinterName' for printer \`$otherPrinterName' not found" >&2
710
 
                  rc=1; (exit $rc); return $rc
711
 
                  ;;
712
 
                *) shift; shift;;
713
 
              esac
714
 
              ;;
715
 
          esac
716
 
          ;;
717
 
        *)
718
 
          otherPrinter=false
719
 
          ;;
720
 
      esac
721
 
      case $otherPrinter in
722
 
        true)
723
 
          tcBatchDvipsPrinter=$otherPrinterName
724
 
          moreFmgrArgs="--reldir dvips/config --infile $otherPrinterFile"
725
 
          ;;
726
 
        *)
727
 
          tcBatchDvipsPrinter=ps
728
 
          ;;
729
 
      esac
730
 
      case $1 in
731
 
        add)
732
 
          case $2 in
733
 
            "")
734
 
              echo "Usage: $progname dvips add PRINTER" >&2
735
 
              rc=1
736
 
              ;;
737
 
            *)
738
 
              printerName=$2
739
 
              pFile=`kpsewhich -format='dvips config' "config.$printerName"`
740
 
              case $pFile in
741
 
                "")
742
 
                  setupTmpDir
743
 
                  tcfRet=`tcfmgr --emptyinfile --reldir dvips/config --cmd co --tmp $tmpdir --file "config.$printerName"`
744
 
                  if test $? != 0; then
745
 
                    echo "$progname: failed to add new configuration file \`config.$printerName'" >&2
746
 
                    rc=1
747
 
                  else
748
 
                    set x $tcfRet; shift
749
 
                    tcBatchDvipsAddID=$1; tcBatchDvipsAddFile=$3
750
 
                    echo "% file config.$printerName; added by texconfig" > "$tcBatchDvipsAddFile"
751
 
                    tcfRet=`tcfmgr --tmp $tmpdir --id "$tcBatchDvipsAddID" --cmd ci`
752
 
                    if test $? != 0; then
753
 
                      echo "$progname: failed to add new configuration file \`config.$printerName'" >&2
754
 
                      rc=1
755
 
                    else
756
 
                      echo "$progname: file $tcfRet added" >&2
757
 
                    fi
758
 
                  fi
759
 
                  ;;
760
 
                *)
761
 
                  echo "$progname: configuration file for printer \`$printerName' already exists (\`$pFile')" >&2
762
 
                  rc=1
763
 
                  ;;
764
 
              esac
765
 
              ;;
766
 
          esac
767
 
          ;;
768
 
        del)
769
 
          case $2 in
770
 
            "")
771
 
              echo "Usage: $progname dvips del PRINTER" >&2
772
 
              rc=1
773
 
              ;;
774
 
            *)
775
 
              printerName=$2
776
 
              pFile=`kpsewhich -format='dvips config' "config.$printerName"`
777
 
              case $pFile in
778
 
                "")
779
 
                  echo "$progname: configuration file for printer \`$printerName' (config.$printerName) not found" >&2
780
 
                  rc=1
781
 
                  ;;
782
 
                *)
783
 
                  if rm "$pFile"; then
784
 
                    echo "$progname: file \`$pFile' removed" >&2
785
 
                  else
786
 
                    echo "$progname: failed to remove file \`$pFile'" >&2
787
 
                    rc=1
788
 
                  fi
789
 
                  ;;
790
 
              esac
791
 
              ;;  
792
 
          esac
793
 
          ;;
794
 
        paper-list)
795
 
          locateConfigPsFile
796
 
          listDvipsPapers
797
 
          ;;
798
 
        paper)
799
 
          case $2 in
800
 
            "")
801
 
              echo "Usage: $progname dvips paper PAPER" >&2
802
 
              echo >&2; echo "Valid PAPER settings:" >&2
803
 
              locateConfigPsFile
804
 
              listDvipsPapers | sed 's@ .*@@; s@^@  @' | myFmt
805
 
              rc=1
806
 
              ;;
807
 
            *)
808
 
              tcBatchDvipsPaper=$2
809
 
              locateConfigPsFile
810
 
              case "$configPsFile" in
811
 
                "")
812
 
                  echo "$progname: file config.ps not found" >&2; rc=1
813
 
                  ;;
814
 
                *)
815
 
                  if grep "@ $tcBatchDvipsPaper " $configPsFile >/dev/null 2>&1; then
816
 
                    setupDvipsPaper "$tcBatchDvipsPaper"
817
 
                  else
818
 
                    echo "$progname: paper \`$tcBatchDvipsPaper' not found in file \`$configPsFile'" >&2; rc=1
819
 
                  fi
820
 
                  ;;
821
 
              esac
822
 
              ;;
823
 
          esac
824
 
          ;;
825
 
        mode)
826
 
          case $2 in
827
 
            "")
828
 
              echo "Usage: $progname dvips mode MODE
829
 
 
830
 
Valid MODE settings:"
831
 
              setupModesMfFile
832
 
              listMfModes | sed 's@ .*@@; s@^@  @' | myFmt
833
 
              rc=1
834
 
              ;;
835
 
            *)
836
 
              tcBatchDvipsMode=$2
837
 
              setupTmpDir
838
 
              setupModesMfFile
839
 
              if checkElemInList "$tcBatchDvipsMode" `listMfModes | sed 's@ .*@@'`; then
840
 
                set x `getRes "$tcBatchDvipsMode"`; shift
841
 
                resX=$1; resY=$2
842
 
                fmgrConfigReplace $moreFmgrArgs config.$tcBatchDvipsPrinter '^M' "M $tcBatchDvipsMode"
843
 
                fmgrConfigReplace $moreFmgrArgs config.$tcBatchDvipsPrinter '^D' "D $resX"
844
 
                fmgrConfigReplace $moreFmgrArgs config.$tcBatchDvipsPrinter '^X' "X $resX"
845
 
                fmgrConfigReplace $moreFmgrArgs config.$tcBatchDvipsPrinter '^Y' "Y $resY"
846
 
              else
847
 
                echo "$progname: unknown MODE \`$tcBatchDvipsMode' given as argument for \`$progname dvips mode'" >&2
848
 
                echo "$progname: try \`$progname dvips mode' for help" >&2
849
 
                rc=1
850
 
              fi
851
 
              ;;
852
 
          esac
853
 
          ;;
854
 
        offset)
855
 
          offset=$2
856
 
          case $offset in
857
 
            "")
858
 
              echo "Usage: $progname dvips offset OFFSET"
859
 
              rc=1
860
 
              ;;
861
 
            *)
862
 
              fmgrConfigReplace $moreFmgrArgs config.$tcBatchDvipsPrinter '^O' "O $offset"
863
 
          esac
864
 
          ;;
865
 
        printcmd)
866
 
          printcmd=$2
867
 
          case $printcmd in
868
 
            "")
869
 
              echo "Usage: $progname dvips printcmd CMD"
870
 
              rc=1
871
 
              ;;
872
 
            -)
873
 
              fmgrConfigReplace $moreFmgrArgs config.$tcBatchDvipsPrinter '^o' o
874
 
              ;;
875
 
            *)
876
 
              fmgrConfigReplace $moreFmgrArgs config.$tcBatchDvipsPrinter '^o' "o |$printcmd"
877
 
              ;;
878
 
          esac
879
 
          ;;
880
 
        "")
881
 
          echo "$help" >&2; rc=1
882
 
          ;;
883
 
        *)
884
 
          echo "$progname: unknown option \`$1' given as argument for \`$progname dvips'" >&2
885
 
          echo "$progname: try \`$progname dvips' for help" >&2
886
 
          rc=1
887
 
          ;;
888
 
      esac
889
 
      ;;
890
 
 
891
 
    faq)
892
 
      setupTexmfmain
893
 
      if test -f $MT_TEXMFMAIN/doc/tetex/teTeX-FAQ; then
894
 
        <$MT_TEXMFMAIN/doc/tetex/teTeX-FAQ eval ${PAGER-more}
895
 
      else
896
 
        echo "$progname: faq not found (usually in \$TEXMFMAIN/doc/tetex/teTeX-FAQ)" >&2
897
 
        rc=1
898
 
      fi
899
 
      ;;
900
 
 
901
 
    findprog)
902
 
      shift
903
 
      ELB_PATH_ONLY=1 echoLocateBinary "$@"
904
 
      ;;
905
 
 
906
 
    # handle "texconfig font"
907
 
    font)
908
 
      help="Usage: $progname font vardir DIR
909
 
       $progname font ro
910
 
       $progname font rw
911
 
 
912
 
The vardir option changes the VARTEXFONTS variable in the texmf.cnf file.
913
 
 
914
 
The rw option makes the VARTEXFONTS directory (and subtrees pk, tfm,
915
 
source) world writable and sets the features appendonlydir:varfonts
916
 
in mktex.cnf.
917
 
 
918
 
The ro option makes the VARTEXFONTS directory (and subtrees pk, tfm,
919
 
source) writable for the owner only and sets the feature texmfvar in
920
 
mktex.cnf.
921
 
 
922
 
For more information about these \`features', consult the teTeX manual
923
 
(e.g. by running \`texdoc TETEXDOC')."
924
 
 
925
 
      case $2 in
926
 
        vardir)
927
 
          case $3 in
928
 
            "")
929
 
              echo "$help" >&2
930
 
              rc=1
931
 
              ;;
932
 
            *)
933
 
              tcBatchFontVardir=$3
934
 
              tfc=`kpsewhich texmf.cnf`
935
 
              if test -n "$tfc"; then
936
 
                if test -w "$tfc"; then
937
 
                  configReplace "$tfc" '^VARTEXFONTS' "VARTEXFONTS  = $tcBatchFontVardir"
938
 
                else
939
 
                  echo "$progname: setting up vardir failed. Reason: no permission to write file \`$tfc'" >&2
940
 
                  rc=1
941
 
                fi
942
 
              else
943
 
                echo "$progname: setting up vardir failed. Reason: failed to find file texmf.cnf" >&2
944
 
                rc=1
945
 
              fi
946
 
              ;;
947
 
          esac
948
 
          ;;
949
 
        rw)
950
 
          MT_VARTEXFONTS=`kpsewhich -var-value VARTEXFONTS`
951
 
          if test -z "$MT_VARTEXFONTS"; then
952
 
            echo "$progname: failed to set \`font rw'; reason: could not determine VARTEXFONTS variable." >&2; rc=1
953
 
            return
954
 
          fi
955
 
          test -d "$MT_VARTEXFONTS" || mktexdir "$MT_VARTEXFONTS"
956
 
          if test ! -d "$MT_VARTEXFONTS"; then
957
 
            echo "$progname: failed to set \`font rw'; reason: directory \`$MT_VARTEXFONTS' does not exist." >&2; rc=1
958
 
            return
959
 
          fi
960
 
          chmod 1777 "$MT_VARTEXFONTS" || {
961
 
            echo "$progname: failed to modify permissions in \`$MT_VARTEXFONTS'." >&2; rc=1
962
 
            return;
963
 
          }
964
 
          (
965
 
            cd "$MT_VARTEXFONTS" || exit
966
 
            echo "$progname: modifying permissions in \`$MT_VARTEXFONTS' ..." >&2
967
 
            for d in pk tfm source; do
968
 
              test -d "$d" && find $d -type d -exec chmod 1777 '{}' \;
969
 
            done
970
 
            echo "$progname: all permissions set." >&2
971
 
          )
972
 
          setupTmpDir
973
 
          fmgrConfigReplace mktex.cnf '^: ..MT_FEATURES=' ": \${MT_FEATURES=appendonlydir:varfonts}"
974
 
          ;;
975
 
        ro)
976
 
          MT_VARTEXFONTS=`kpsewhich -var-value VARTEXFONTS`
977
 
          if test -z "$MT_VARTEXFONTS"; then
978
 
            echo "$progname: failed to set \`font ro'; reason: could not determine VARTEXFONTS variable." >&2; rc=1
979
 
            return
980
 
          fi
981
 
          test -d "$MT_VARTEXFONTS" || mktexdir "$MT_VARTEXFONTS"
982
 
          if test ! -d "$MT_VARTEXFONTS"; then
983
 
            echo "$progname: failed to set \`font ro'; reason: directory \`$MT_VARTEXFONTS' does not exist." >&2; rc=1
984
 
            return
985
 
          fi
986
 
          chmod 755 "$MT_VARTEXFONTS" || {
987
 
            echo "$progname: failed to modify permissions in \`$MT_VARTEXFONTS'." >&2; rc=1
988
 
            return;
989
 
          }
990
 
          (
991
 
            cd "$MT_VARTEXFONTS" || exit
992
 
            echo "$progname: modifying permissions in \`$MT_VARTEXFONTS' ..." >&2
993
 
            for d in pk tfm source; do
994
 
              test -d "$d" && find "$d" -type d -exec chmod 755 '{}' \;
995
 
            done
996
 
            echo "$progname: all permissions set." >&2
997
 
          )
998
 
          setupTmpDir
999
 
          fmgrConfigReplace mktex.cnf '^: ..MT_FEATURES=' ": \${MT_FEATURES=texmfvar}"
1000
 
          ;;
1001
 
        "") echo "$help" >&2; rc=1;;
1002
 
        *) echo "$progname: unknown option \`$2' given as argument for \`$progname font'" >&2
1003
 
           echo "$progname: try \`$progname font' for help" >&2
1004
 
           rc=1
1005
 
           ;;
1006
 
      esac
1007
 
      ;;
1008
 
 
1009
 
    formats)
1010
 
      cat >&2 <<EOM
1011
 
texconfig formats is no longer supported, because manual edits of
1012
 
fmtutil.cnf will be overwritten by the new TeX Live package manager,
1013
 
tlmgr, which regenerates that file as needed upon package changes.
1014
 
Thus, to add or remove formats, the recommended method is to use tlmgr
1015
 
to add or remove the appropriate package.
1016
 
 
1017
 
If you need to make manual additions, you can edit the file
1018
 
fmtutil-local.cnf under TEXMFLOCAL.  Further information with
1019
 
tlmgr --help and at http://tug.org/texlive/tlmgr.html.
1020
 
 
1021
 
Exiting.
1022
 
EOM
1023
 
      exit 1  # but leave the real code for posterity
1024
 
 
1025
 
      setupTmpDir
1026
 
      echo "$progname: analyzing old configuration..." >&2
1027
 
      fmtutil --catcfg > $tmpdir/pre
1028
 
      fmtutil --edit
1029
 
      echo "$progname: analyzing new configuration..." >&2
1030
 
      fmtutil --catcfg > $tmpdir/post
1031
 
 
1032
 
      if cmp $tmpdir/pre $tmpdir/post >/dev/null 2>&1; then
1033
 
        echo "$progname: no new/updated formats available ..." >&2
1034
 
      else
1035
 
      echo "$progname: updating formats ..." >&2
1036
 
        comm -13 $tmpdir/pre $tmpdir/post > $tmpdir/addOrChange
1037
 
        for i in `awk '{print $1}' $tmpdir/addOrChange`; do
1038
 
          fmtutil --byfmt "$i" || rc=1
1039
 
        done
1040
 
        texlinks --multiplatform || rc=1
1041
 
      fi
1042
 
      ;;
1043
 
 
1044
 
    help|--help|-h)
1045
 
      echo "$help"
1046
 
      ;;
1047
 
 
1048
 
    # "hyphen FORMAT"
1049
 
    hyphen)
1050
 
      cat >&2 <<EOM
1051
 
texconfig hyphen is no longer supported, because manual edits of
1052
 
language.dat (or language.def) will be overwritten by the new TeX Live
1053
 
package manager, tlmgr, which regenerates those configuration files as
1054
 
needed upon package changes.  Thus, to add or remove hyphenation
1055
 
patterns, the recommended method is to use tlmgr to add or remove the
1056
 
appropriate package.
1057
 
 
1058
 
If you need to make manual additions, you can edit the files
1059
 
language-local.dat and language-local.def under TEXMFLOCAL.  Further
1060
 
information with tlmgr --help and at http://tug.org/texlive/tlmgr.html.
1061
 
 
1062
 
Exiting.
1063
 
EOM
1064
 
      exit 1  # but leave the real code for posterity
1065
 
 
1066
 
      tcBatchHyphenFormat=$2
1067
 
      formatsForHyphen=`getFormatsForHyphen`
1068
 
      formatsForHyphenFmt=`echo "$formatsForHyphen" | myFmt | sed 's@^@  @'`
1069
 
      help="Usage: $progname hyphen FORMAT
1070
 
 
1071
 
Valid FORMATs are:
1072
 
$formatsForHyphenFmt"
1073
 
      case $tcBatchHyphenFormat in
1074
 
        "")
1075
 
          echo "$help" >&2; rc=1
1076
 
          ;;
1077
 
        *)
1078
 
          if checkElemInList "$tcBatchHyphenFormat" $formatsForHyphen; then
1079
 
 
1080
 
            tcBatchHyphenFile=`fmtutil --showhyphen "$tcBatchHyphenFormat"`
1081
 
            case $tcBatchHyphenFile in
1082
 
              "")
1083
 
                echo "$progname: could not find hyphen setup file for format \`$tcBatchHyphenFormat'" >&2
1084
 
                rc=1
1085
 
                return
1086
 
                ;;
1087
 
            esac
1088
 
 
1089
 
            getRelDir "$tcBatchHyphenFile"
1090
 
            case $relPart in
1091
 
              "")
1092
 
                # edit tcBatchHyphenFile directly
1093
 
                tcBatchHFID=
1094
 
                setupTmpDir
1095
 
                tcBatchHFEdit=$tcBatchHyphenFile
1096
 
                tcBatchHFOrig=$tmpdir/hforig
1097
 
                cp "$tcBatchHyphenFile" "$tcBatchHFOrig"
1098
 
                ;;
1099
 
              *)
1100
 
                # use tcfmgr
1101
 
                tcBatchHyphenFileBasename=`echo "$tcBatchHyphenFile" | sed 's@.*/@@'`
1102
 
                setupTmpDir
1103
 
                co=`tcfmgr --tmp $tmpdir --cmd co --file "$tcBatchHyphenFileBasename" --reldir "$relPart" --infile "$tcBatchHyphenFile"`
1104
 
                if test $? != 0; then
1105
 
                  echo "$progname: failed to check out file \`$tcBatchHyphenFile'" >&2
1106
 
                  rc=1
1107
 
                  return 1
1108
 
                else
1109
 
                  set x $co; shift
1110
 
                  tcBatchHFID=$1; tcBatchHFEdit=$3; tcBatchHFOrig=$4
1111
 
                fi
1112
 
                ;;
1113
 
            esac
1114
 
            ${VISUAL-${EDITOR-vi}} "$tcBatchHFEdit"
1115
 
            if cmp "$tcBatchHFEdit" "$tcBatchHFOrig" >/dev/null 2>&1; then
1116
 
              echo "$progname: configuration unchanged." >&2
1117
 
            else
1118
 
              case $tcBatchHFID in
1119
 
                "")
1120
 
                  tcBatchHFOut=$tcBatchHFEdit
1121
 
                  echo "$progname: updated configuration saved as file \`$tcBatchHFOut'" >&2
1122
 
                  lastUpdatedFile=$ci
1123
 
                  ;;
1124
 
                *)
1125
 
                  ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$tcBatchHFID"`
1126
 
                  if test $? != 0; then
1127
 
                    echo "$progname: failed to check in file \`$tcBatchHyphenFileBasename'" >&2
1128
 
                    rc=1
1129
 
                    return
1130
 
                  else
1131
 
                    tcBatchHFOut=$ci
1132
 
                    echo "$progname: updated configuration saved as file \`$tcBatchHFOut'" >&2
1133
 
                    lastUpdatedFile=$ci
1134
 
                  fi
1135
 
                  ;;
1136
 
              esac
1137
 
              fmtutil --byhyphen "$tcBatchHFOut"
1138
 
            fi
1139
 
          else
1140
 
            echo "$progname: invalid format \`$tcBatchHyphenFormat' specified as argument for \`$progname hyphen'" >&2
1141
 
            echo "$progname: for getting help, try \`$progname hyphen'" >&2
1142
 
            rc=1
1143
 
          fi
1144
 
          ;;
1145
 
      esac
1146
 
      ;;
1147
 
 
1148
 
    hyphen-list)
1149
 
      getFormatsForHyphen
1150
 
      ;;
1151
 
 
1152
 
    init)
1153
 
      case $2 in
1154
 
        "")
1155
 
          if fmtutil --all \
1156
 
             && texlinks --multiplatform \
1157
 
             && updmap; then
1158
 
            :
1159
 
          else
1160
 
            rc=1
1161
 
          fi
1162
 
          ;;
1163
 
        *)
1164
 
          shift 1
1165
 
          for i in "$@"; do
1166
 
            fmtutil --byfmt "$i" || rc=1
1167
 
          done
1168
 
          ;;
1169
 
      esac
1170
 
      ;;
1171
 
 
1172
 
    mode-list)
1173
 
      setupModesMfFile
1174
 
      listMfModes
1175
 
      ;;
1176
 
 
1177
 
    mode)
1178
 
      case $2 in
1179
 
        "")
1180
 
          echo "Usage: $progname mode MODE
1181
 
 
1182
 
Valid MODE settings:"
1183
 
          setupModesMfFile
1184
 
          listMfModes | sed 's@ .*@@; s@^@  @' | myFmt
1185
 
          rc=1
1186
 
          ;;
1187
 
        *)
1188
 
          tcBatchMode=$2
1189
 
          setupModesMfFile
1190
 
          if checkElemInList $tcBatchMode `listMfModes | sed 's@ .*@@'`; then
1191
 
 
1192
 
            # modify mktex.cnf
1193
 
            setupTmpDir
1194
 
            fmgrConfigReplace mktex.cnf '^: ..MODE=' ": \${MODE=$tcBatchMode}"
1195
 
            set x `getRes "$tcBatchMode"`; shift
1196
 
            tcBatchRes=$1
1197
 
            fmgrConfigReplace mktex.cnf '^: ..BDPI=' ": \${BDPI=$tcBatchRes}"
1198
 
 
1199
 
            if checkForBinary dvips >/dev/null && tcfmgr --cmd find --file config.ps >/dev/null 2>&1; then
1200
 
              tcBatch dvips mode "$tcBatchMode"
1201
 
            fi
1202
 
            if checkForBinary pdftex >/dev/null && tcfmgr --cmd find --file pdftexconfig.tex >/dev/null 2>&1; then
1203
 
              tcBatch pdftex mode "$tcBatchMode"
1204
 
            fi
1205
 
          else
1206
 
            echo "$progname: unknown mode \`$tcBatchMode' specified as argument for \`$progname mode'" >&2; rc=1
1207
 
          fi
1208
 
          ;;
1209
 
      esac
1210
 
      ;;
1211
 
 
1212
 
    paper)
1213
 
      help="Usage: $progname paper PAPER
1214
 
 
1215
 
Valid PAPER settings:
1216
 
  letter a4"
1217
 
 
1218
 
      p=$2; pXdvi=$2; pDvips=$2
1219
 
      case $2 in
1220
 
        letter)
1221
 
          pXdvi=us;;
1222
 
        a4)
1223
 
          pXdvi=a4;;
1224
 
        "") echo "$help" >&2; rc=1; return;;
1225
 
        *)
1226
 
          echo "$progname: unknown PAPER \`$2' given as argument for \`$progname paper'" >&2
1227
 
          echo "$progname: try \`$progname paper' for help" >&2
1228
 
          rc=1
1229
 
          return;;
1230
 
      esac
1231
 
      if checkForBinary dvips >/dev/null && tcfmgr --cmd find --file config.ps >/dev/null 2>&1; then
1232
 
        tcBatch dvips paper $pDvips
1233
 
      fi
1234
 
      if checkForBinary dvipdfm >/dev/null && tcfmgr --cmd find --file config >/dev/null 2>&1; then
1235
 
        tcBatch dvipdfm paper $p
1236
 
      fi
1237
 
      if checkForBinary dvipdfmx >/dev/null && tcfmgr --cmd find --file dvipdfmx.cfg >/dev/null 2>&1; then
1238
 
        tcBatch dvipdfmx paper $p
1239
 
      fi
1240
 
      if checkForBinary xdvi >/dev/null && tcfmgr --cmd find --file XDvi >/dev/null 2>&1; then
1241
 
        tcBatch xdvi paper $pXdvi
1242
 
      fi
1243
 
      if checkForBinary pdftex >/dev/null && tcfmgr --cmd find --file pdftexconfig.tex >/dev/null 2>&1; then
1244
 
        tcBatch pdftex paper $p
1245
 
      fi
1246
 
      ;;
1247
 
 
1248
 
    pdftex)
1249
 
      help="Usage: $progname pdftex paper PAPER
1250
 
 
1251
 
Valid PAPER settings:
1252
 
  a4 letter"
1253
 
      case $2 in
1254
 
 
1255
 
        mode)
1256
 
          case $3 in
1257
 
            "")
1258
 
              echo "Usage: $progname pdftex mode MODE"
1259
 
              rc=1
1260
 
              ;;
1261
 
            *)
1262
 
              tcBatchPdftexMode=$3
1263
 
              setupTmpDir
1264
 
              setupModesMfFile
1265
 
              if checkElemInList "$tcBatchPdftexMode" `listMfModes | sed 's@ .*@@'`; then
1266
 
                set x `getRes "$tcBatchPdftexMode"`; shift
1267
 
                fmgrConfigReplace pdftexconfig.tex 'pdfpkresolution' "\\pdfpkresolution=$1"
1268
 
                if $fmgrConfigReplaceChanged; then
1269
 
                  fmtutil --refresh
1270
 
                fi
1271
 
              else
1272
 
                echo "$progname: unknown MODE \`$tcBatchPdftexMode' given as argument for \`$progname pdftex mode'" >&2
1273
 
                rc=1
1274
 
              fi
1275
 
              ;;
1276
 
          esac
1277
 
          ;;
1278
 
 
1279
 
        paper)
1280
 
          case $3 in
1281
 
            letter)
1282
 
              w="8.5 true in"; h="11 true in"
1283
 
              setupTmpDir
1284
 
              fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$w"
1285
 
              wChanged=$fmgrConfigReplaceChanged
1286
 
              fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$h"
1287
 
              if $wChanged || $fmgrConfigReplaceChanged; then
1288
 
                fmtutil --refresh
1289
 
              fi
1290
 
              ;;
1291
 
            a4)
1292
 
              w="210 true mm"; h="297 true mm"
1293
 
              fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$w"
1294
 
              wChanged=$fmgrConfigReplaceChanged
1295
 
              fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$h"
1296
 
              if $wChanged || $fmgrConfigReplaceChanged; then
1297
 
                fmtutil --refresh
1298
 
              fi
1299
 
              ;;
1300
 
            "") echo "$help" >&2; rc=1;;
1301
 
            *)
1302
 
             echo "$progname: unknown PAPER \`$3' given as argument for \`$progname pdftex paper'" >&2
1303
 
             echo "$progname: try \`$progname pdftex paper' for help" >&2
1304
 
             rc=1 ;;
1305
 
          esac ;;
1306
 
        "")
1307
 
          echo "$help" >&2; rc=1;;
1308
 
        *)
1309
 
          echo "$progname: unknown option \`$2' given as argument for \`$progname pdftex'" >&2
1310
 
          echo "$progname: try \`$progname pdftex' for help" >&2
1311
 
          rc=1
1312
 
          ;;
1313
 
      esac
1314
 
      ;;
1315
 
 
1316
 
    rehash)
1317
 
      mktexlsr
1318
 
      ;;
1319
 
    
1320
 
    # 
1321
 
    version|--version)
1322
 
      echo "$progname version $version"
1323
 
      setupTexmfmain
1324
 
      setupTexmfdist
1325
 
      showDistVersionInfo
1326
 
      (exit 0); exit 0;;
1327
 
 
1328
 
    # handle "xdvi paper PAPER"
1329
 
    xdvi)
1330
 
      tcBatchXdviPapers='us           "8.5x11"
1331
 
usr          "11x8.5"
1332
 
legal        "8.5x14"
1333
 
foolscap     "13.5x17.0"
1334
 
a1           "59.4x84.0cm"
1335
 
a2           "42.0x59.4cm"
1336
 
a3           "29.7x42.0cm"
1337
 
a4           "21.0x29.7cm"
1338
 
a5           "14.85x21.0cm"
1339
 
a6           "10.5x14.85cm"
1340
 
a7           "7.42x10.5cm"
1341
 
a1r          "84.0x59.4cm"
1342
 
a2r          "59.4x42.0cm"
1343
 
a3r          "42.0x29.7cm"
1344
 
a4r          "29.7x21.0cm"
1345
 
a5r          "21.0x14.85cm"
1346
 
a6r          "14.85x10.5cm"
1347
 
a7r          "10.5x7.42cm"
1348
 
b1           "70.6x100.0cm"
1349
 
b2           "50.0x70.6cm"
1350
 
b3           "35.3x50.0cm"
1351
 
b4           "25.0x35.3cm"
1352
 
b5           "17.6x25.0cm"
1353
 
b6           "13.5x17.6cm"
1354
 
b7           "8.8x13.5cm"
1355
 
b1r          "100.0x70.6cm"
1356
 
b2r          "70.6x50.0cm"
1357
 
b3r          "50.0x35.3cm"
1358
 
b4r          "35.3x25.0cm"
1359
 
b5r          "25.0x17.6cm"
1360
 
b6r          "17.6x13.5cm"
1361
 
b7r          "13.5x8.8cm"
1362
 
c1           "64.8x91.6cm"
1363
 
c2           "45.8x64.8cm"
1364
 
c3           "32.4x45.8cm"
1365
 
c4           "22.9x32.4cm"
1366
 
c5           "16.2x22.9cm"
1367
 
c6           "11.46x16.2cm"
1368
 
c7           "8.1x11.46cm"
1369
 
c1r          "91.6x64.8cm"
1370
 
c2r          "64.8x45.8cm"
1371
 
c3r          "45.8x32.4cm"
1372
 
c4r          "32.4x22.9cm"
1373
 
c5r          "22.9x16.2cm"
1374
 
c6r          "16.2x11.46cm"
1375
 
c7r          "11.46x8.1cm"'
1376
 
      help="Usage: $progname xdvi paper PAPER
1377
 
 
1378
 
Valid PAPER settings:
1379
 
  a1 a1r a2 a2r a3 a3r a4 a4r a5 a5r a6 a6r a7 a7r
1380
 
  b1 b1r b2 b2r b3 b3r b4 b4r b5 b5r b6 b6r b7 b7r
1381
 
  c1 c1r c2 c2r c3 c3r c4 c4r c5 c5r c6 c6r c7 c7r
1382
 
  foolscap legal us usr"
1383
 
      case $2 in
1384
 
        paper-list)
1385
 
          echo "$tcBatchXdviPapers"
1386
 
          ;;
1387
 
        paper)
1388
 
          case $3 in
1389
 
            a1|a1r|a2|a2r|a3|a3r|a4|a4r|a5|a5r|a6|a6r|a7|a7r|b1|b1r|b2|b2r|b3|b3r|b4|b4r|b5|b5r|b6|b6r|b7|b7r|c1|c1r|c2|c2r|c3|c3r|c4|c4r|c5|c5r|c6|c6r|c7|c7r|foolscap|legal|us|usr)
1390
 
              fmgrConfigReplace XDvi paper: "*paper: $3"
1391
 
              ;;
1392
 
            "") echo "$help" >&2; rc=1;;
1393
 
            *)
1394
 
             echo "$progname: unknown PAPER \`$3' given as argument for \`$progname xdvi paper'" >&2
1395
 
             echo "$progname: try \`$progname xdvi paper' for help" >&2
1396
 
             rc=1 ;;
1397
 
          esac ;;
1398
 
        "")
1399
 
          echo "$help" >&2; rc=1;;
1400
 
        *)
1401
 
          echo "$progname: unknown option \`$2' given as argument for \`$progname xdvi'" >&2
1402
 
          echo "$progname: try \`$progname xdvi' for help" >&2
1403
 
          rc=1
1404
 
          ;;
1405
 
      esac
1406
 
      ;;
1407
 
    *)
1408
 
      echo "$progname: unknown option \`$1' given as argument for \`$progname'" >&2
1409
 
      echo "$progname: try \`$progname help' for help" >&2
1410
 
      rc=1
1411
 
  esac
1412
 
}
1413
 
 
1414
 
###############################################################################
1415
 
# tcInteractive(void)
1416
 
#   handle interactive mode
1417
 
###############################################################################
1418
 
tcInteractive()
1419
 
{
1420
 
  texconfig-dialog
1421
 
}
1422
 
 
1423
 
###############################################################################
1424
 
# main()
1425
 
###############################################################################
1426
 
rc=0
1427
 
case $# in
1428
 
  0) tcInteractive;;
1429
 
  *) tcBatch "$@";;
1430
 
esac
1431
 
 
1432
 
cleanup $rc