---
 texmf-dist/doc/man/man1/texconfig.1     |   28 +++++++-
 texmf-dist/scripts/texlive/texconfig.sh |  110 +++++++++-----------------------
 2 files changed, 60 insertions(+), 78 deletions(-)

--- texlive-base-2015.20150524.orig/texmf-dist/doc/man/man1/texconfig.1
+++ texlive-base-2015.20150524/texmf-dist/doc/man/man1/texconfig.1
@@ -47,6 +47,20 @@
 .IR TEXMFSYSCONFIG .
 (You may need to be root to do this.)
 .PP
+Note that on a Debian system, changes to formats, font setup,
+hyphenation for different languages, etc. should not be done with
+texconfig, because
+.B fmtutil.cnf(5), updmap.cfg(5), texmf.cnf
+and
+.B language.dat
+are generated files in Debian.  See
+.I TeX-on-Debian.pdf, TeX-on-Debian.txt.gz
+or
+.I TeX-on-Debian.html/index.html
+in
+.I /usr/share/doc/tex-common/
+for alternatives.
+.PP
 .I texconfig
 also offers a non-interactive batch mode which can be accessed with
 the following commands
@@ -129,11 +143,23 @@
 (and their answers).
 .TP
 .B font vardir DIR, font ro, font rw
+These options should not be used on a Debian system unless you really
+know what you are doing.  For details, look at the output of
+.B texconfig fonts
+and read section 2.5, font caching, in the TeX-on-Debian documentation
+in
+.I /usr/share/doc/tex-common/.
 .TP
 .B formats
 This command allows to edit
 .B fmtutil.cnf(5)
-and (re)creates any new or changed formats afterwards.  
+and (re)creates any new or changed formats afterwards.  It should not
+be used on Debian systems, unless you want to temporarily create and
+test a specific format, because
+.B fmtutil.cnf(5)
+is a generated file in Debian, and changes will be overwritten.  See
+.B update-fmtutil
+for details.
 .TP
 .B hyphen FORMAT
 This command allows to edit the hyphenation configuration file for
--- texlive-base-2015.20150524.orig/texmf-dist/scripts/texlive/texconfig.sh
+++ texlive-base-2015.20150524/texmf-dist/scripts/texlive/texconfig.sh
@@ -55,6 +55,7 @@
       FMT=fmt
       test ! -x /bin/fmt && test ! -f /usr/bin/fmt &&
         { test -x /bin/adjust || test -x /usr/bin/adjust; } && FMT=adjust
+      :
       ;;
     *)
       return
@@ -447,7 +448,7 @@
 {
   case $configPsFile in
     "")
-      configPsFile=`tcfmgr --cmd find --file config.ps`
+      configPsFile=`kpsewhich -format='dvips config' config-paper.ps`
       ;;
     *)
       return
@@ -570,7 +571,7 @@
        $progname help                  (or --help; show this help)
        $progname hyphen FORMAT         (edit hyphenation config for FORMAT)
        $progname init [FORMAT]...      (rebuild FORMATs, or all formats
-                                        plus run texlinks and updmap)
+                                        plus run updmap)
        $progname mode MODE             (set Metafont MODE)
        $progname paper PAPER           (set default paper size to PAPER)
        $progname pdftex [OPTION]...    (pdftex options)
@@ -623,7 +624,7 @@
 
     # texconfig dvipdfm
     dvipdfm)
-      help="Usage: $progname dvipdfm paper PAPER
+      help="Usage: $progname dvipdfm [paperconf|paper-list] PAPER
 
 Valid PAPER settings:
   letter legal ledger tabloid a4 a3"
@@ -635,6 +636,8 @@
         paper)
           case $3 in
             letter|legal|ledger|tabloid|a4|a3)
+	      echo "WARNING: On Debian, this change will NOT be persistent"
+	      echo "upon upgrades or changes to the libpaper settings!"
               fmgrConfigReplace config '^p' "p $3";;
             "") echo "$help" >&2; rc=1;;
             *)
@@ -656,7 +659,7 @@
 
     # texconfig dvipdfmx
     dvipdfmx)
-      help="Usage: $progname dvipdfmx paper PAPER
+      help="Usage: $progname dvipdfmx [paperconf,paper-list,paper PAPER]
 
 Valid PAPER settings:
   letter legal ledger tabloid a4 a3"
@@ -668,6 +671,8 @@
         paper)
           case $3 in
             letter|legal|ledger|tabloid|a4|a3)
+	      echo "WARNING: On Debian, this change will NOT be persistent"
+	      echo "upon upgrades or changes to the libpaper settings!"
               fmgrConfigReplace dvipdfmx.cfg '^p' "p $3";;
             "") echo "$help" >&2; rc=1;;
             *)
@@ -782,6 +787,12 @@
                   echo "$progname: configuration file for printer \`$printerName' (config.$printerName) not found" >&2
                   rc=1
                   ;;
+		/usr/share/texmf|/usr/share/texlive/texmf|/usr/share/texlive/texmf-dist)
+		  echo "On Debian system, this command would remove files installed by dpkg."
+		  echo "Please use texconfig dvips del PRINTER only for printers installed by you."
+		  echo "Exiting."
+		  rc=1
+		  ;;
                 *)
                   if rm "$pFile"; then
                     echo "$progname: file \`$pFile' removed" >&2
@@ -812,7 +823,7 @@
               locateConfigPsFile
               case "$configPsFile" in
                 "")
-                  echo "$progname: file config.ps not found" >&2; rc=1
+                  echo "$progname: file $configPsFile not found" >&2; rc=1
                   ;;
                 *)
                   if grep "@ $tcBatchDvipsPaper " $configPsFile >/dev/null 2>&1; then
@@ -892,11 +903,11 @@
       ;;
 
     faq)
-      setupTexmfmain
-      if test -f $MT_TEXMFMAIN/doc/tetex/teTeX-FAQ; then
-        <$MT_TEXMFMAIN/doc/tetex/teTeX-FAQ eval ${PAGER-more}
+      setupTexmfdist
+      if test -f $MT_TEXMFDIST/doc/tetex/teTeX-FAQ.gz; then
+        <$MT_TEXMFDIST/doc/tetex/teTeX-FAQ.gz eval ${PAGER-zless}
       else
-        echo "$progname: faq not found (usually in \$TEXMFMAIN/doc/tetex/teTeX-FAQ)" >&2
+        echo "$progname: faq not found (usually in \$TEXMFDIST/doc/tetex/teTeX-FAQ)" >&2
         rc=1
       fi
       ;;
@@ -1010,21 +1021,6 @@
       ;;
 
     formats)
-      cat >&2 <<EOM
-texconfig formats is no longer supported, because manual edits of
-fmtutil.cnf will be overwritten by the new TeX Live package manager,
-tlmgr, which regenerates that file as needed upon package changes.
-Thus, to add or remove formats, the recommended method is to use tlmgr
-to add or remove the appropriate package.
-
-If you need to make manual additions, you can edit the file
-fmtutil-local.cnf under TEXMFLOCAL.  Further information with
-tlmgr --help and at http://tug.org/texlive/tlmgr.html.
-
-Exiting.
-EOM
-      exit 1  # but leave the real code for posterity
-
       setupTmpDir
       echo "$progname: analyzing old configuration..." >&2
       fmtutil --catcfg > $tmpdir/pre
@@ -1040,7 +1036,6 @@
         for i in `awk '{print $1}' $tmpdir/addOrChange`; do
           fmtutil --byfmt "$i" || rc=1
         done
-        texlinks --multiplatform || rc=1
       fi
       ;;
 
@@ -1050,22 +1045,6 @@
 
     # "hyphen FORMAT"
     hyphen)
-      cat >&2 <<EOM
-texconfig hyphen is no longer supported, because manual edits of
-language.dat (or language.def) will be overwritten by the new TeX Live
-package manager, tlmgr, which regenerates those configuration files as
-needed upon package changes.  Thus, to add or remove hyphenation
-patterns, the recommended method is to use tlmgr to add or remove the
-appropriate package.
-
-If you need to make manual additions, you can edit the files
-language-local.dat and language-local.def under TEXMFLOCAL.  Further
-information with tlmgr --help and at http://tug.org/texlive/tlmgr.html.
-
-Exiting.
-EOM
-      exit 1  # but leave the real code for posterity
-
       tcBatchHyphenFormat=$2
       formatsForHyphen=`getFormatsForHyphen`
       formatsForHyphenFmt=`echo "$formatsForHyphen" | myFmt | sed 's@^@  @'`
@@ -1087,6 +1066,11 @@
                 rc=1
                 return
                 ;;
+	      /var/lib/texmf/*)
+		echo "$progname: The hyphenation file for $tcBatchHyphenFormat is a generated file in Debian"
+		echo "You cannot use this texconfig command, use \`update-language(1)' instead."
+		echo "Please read its manual page or /usr/share/tex-common/TeX-on-Debian*"
+		;;
             esac
 
             getRelDir "$tcBatchHyphenFile"
@@ -1114,7 +1098,7 @@
                 fi
                 ;;
             esac
-            ${VISUAL-${EDITOR-vi}} "$tcBatchHFEdit"
+            ${VISUAL:-${EDITOR:-sensible-editor}} "$tcBatchHFEdit"
             if cmp "$tcBatchHFEdit" "$tcBatchHFOrig" >/dev/null 2>&1; then
               echo "$progname: configuration unchanged." >&2
             else
@@ -1156,7 +1140,6 @@
       case $2 in
         "")
           if fmtutil --all \
-             && texlinks --multiplatform \
              && updmap; then
             :
           else
@@ -1213,41 +1196,10 @@
       ;;
 
     paper)
-      help="Usage: $progname paper PAPER
-
-Valid PAPER settings:
-  letter a4"
-
-      p=$2; pXdvi=$2; pDvips=$2
-      case $2 in
-        letter)
-          pXdvi=us;;
-        a4)
-          pXdvi=a4;;
-        "") echo "$help" >&2; rc=1; return;;
-        *)
-          echo "$progname: unknown PAPER \`$2' given as argument for \`$progname paper'" >&2
-          echo "$progname: try \`$progname paper' for help" >&2
-          rc=1
-          return;;
-      esac
-      if checkForBinary dvips >/dev/null && tcfmgr --cmd find --file config.ps >/dev/null 2>&1; then
-        tcBatch dvips paper $pDvips
-      fi
-      if checkForBinary dvipdfm >/dev/null && tcfmgr --cmd find --file config >/dev/null 2>&1; then
-        tcBatch dvipdfm paper $p
-      fi
-      if checkForBinary dvipdfmx >/dev/null && tcfmgr --cmd find --file dvipdfmx.cfg >/dev/null 2>&1; then
-        tcBatch dvipdfmx paper $p
-      fi
-      if checkForBinary xdvi >/dev/null && tcfmgr --cmd find --file XDvi >/dev/null 2>&1; then
-        tcBatch xdvi paper $pXdvi
-      fi
-      if checkForBinary pdftex >/dev/null && tcfmgr --cmd find --file pdftexconfig.tex >/dev/null 2>&1; then
-        tcBatch pdftex paper $p
-      fi
+      echo "This command shouldn't be used on Debian. Please use 'paperconf' instead."
+      echo
+      rc=1
       ;;
-
     pdftex)
       help="Usage: $progname pdftex paper PAPER
 
@@ -1280,6 +1232,8 @@
           ;;
 
         paper)
+	  echo "WARNING: On Debian, this change will NOT be persistent"
+	  echo "upon upgrades or changes to the libpaper settings!"
           case $3 in
             letter)
               w="8.5 true in"; h="11 true in"
@@ -1388,6 +1342,8 @@
           echo "$tcBatchXdviPapers"
           ;;
         paper)
+	  echo "WARNING: On Debian, this change will NOT be persistent"
+	  echo "upon upgrades or changes to the libpaper settings!"
           case $3 in
             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)
               fmgrConfigReplace XDvi paper: "*paper: $3"
