File tetex_scripts.dif of Package texlive-specs-w

---
 texmf-dist/scripts/texlive/fmtutil-sys.sh      |    1 
 texmf-dist/scripts/texlive/fmtutil.pl          |   24 ++++++++---
 texmf-dist/scripts/texlive/mktexlsr.pl         |    7 ++-
 texmf-dist/scripts/texlive/texconfig-dialog.sh |   14 +++++-
 texmf-dist/scripts/texlive/texlinks.sh         |   53 ++++++++++++++++---------
 texmf-dist/scripts/texlive/updmap-sys.sh       |    1 
 texmf-dist/scripts/texlive/updmap.pl           |   19 +++++---
 7 files changed, 85 insertions(+), 34 deletions(-)

--- texmf-dist/scripts/texlive/fmtutil-sys.sh
+++ texmf-dist/scripts/texlive/fmtutil-sys.sh	2016-02-01 15:28:31.009755153 +0000
@@ -22,4 +22,5 @@ PATH="$mydir:$PATH"; export PATH
 # hack around a bug in zsh:
 test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
 
+umask 022
 exec fmtutil --sys ${1+"$@"}
--- texmf-dist/scripts/texlive/fmtutil.pl
+++ texmf-dist/scripts/texlive/fmtutil.pl	2016-06-09 12:03:21.132289331 +0000
@@ -10,16 +10,16 @@
 # History:
 # Original shell script (C) 2001 Thomas Esser, public domain
 
-my $TEXMFROOT;
+my $TEXMFDIST;
 
 BEGIN {
   $^W = 1;
-  $TEXMFROOT = `kpsewhich -var-value=TEXMFROOT`;
+  $TEXMFDIST = `kpsewhich -var-value=TEXMFDIST`;
   if ($?) {
-    die "$0: kpsewhich -var-value=TEXMFROOT failed, aborting early.\n";
+    die "$0: kpsewhich -var-value=TEXMFDIST failed, aborting early.\n";
   }
-  chomp($TEXMFROOT);
-  unshift(@INC, "$TEXMFROOT/tlpkg", "$TEXMFROOT/texmf-dist/scripts/texlive");
+  chomp($TEXMFDIST);
+  unshift(@INC, "$TEXMFDIST/tlpkg", "$TEXMFDIST/scripts/texlive");
   require "mktexlsr.pl";
   TeX::Update->import();
 }
@@ -70,7 +70,7 @@ TeXLive::TLUtils::prepend_own_path();
 # this function checks by itself whether it is running on windows or not
 reset_root_home();
 
-chomp(our $TEXMFDIST = `kpsewhich --var-value=TEXMFDIST`);
+chomp(our $TEXMFROOT = `kpsewhich --var-value=TEXMFROOT`);
 chomp(our $TEXMFVAR = `kpsewhich -var-value=TEXMFVAR`);
 chomp(our $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`);
 chomp(our $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`);
@@ -361,7 +361,14 @@ sub callback_build_formats {
       TeXLive::TLWinGoo::maybe_make_ro ($tmpdir);
     }
   } else {
+    my ($uid, $gid);
     $tmpdir = File::Temp::tempdir(CLEANUP => 1);
+    if ($> == 0 && ($uid=getpwnam("nobody")) && ($gid=getgrnam("mktex"))) {
+      my $cnt = chown $uid, $gid, $tmpdir;
+      die "could not create directory $tmpdir" if $cnt <= 0;
+      $cnt = chmod 0770, $tmpdir;
+      die "could not create directory $tmpdir" if $cnt <= 0;
+    }
   }
   # set up destination directory
   $opts{'fmtdir'} ||= "$texmfvar/web2c";
@@ -576,6 +583,7 @@ sub rebuild_one_format {
   # check for existence of ini file before doing anything else
   if (system("kpsewhich -progname=$fmt -format=$kpsefmt $inifile >$nul 2>&1") != 0) {
     # we didn't find the ini file, skip
+    return $FMT_NOTAVAIL if (!$opts{'no-error-if-no-engine'});
     print_deferred_warning("inifile $inifile for $fmt/$eng not found.\n");
     # The original script just skipped it but in TeX Live we expect that
     # all activated formats are also buildable, thus return failure.
@@ -635,11 +643,15 @@ sub rebuild_one_format {
         ",$opts{'no-error-if-no-engine'}," =~ m/,$eng,/) {
       return $FMT_NOTAVAIL;
     } else {
+      return $FMT_NOTAVAIL if (!$opts{'no-error-if-no-engine'});
       print_deferred_error("not building $fmt due to missing engine $eng.\n");
       return $FMT_FAILURE;
     }
   }
 
+  if ($ENV{batchmode} and $ENV{batchmode} eq "yes") {
+    $texargs="\\batchmode \\input $texargs" if $eng eq "tex" || $eng eq "ptex";
+  }
   my $cmdline = "$eng -ini $tcxflag $recorderswitch $jobswitch "
                   . "$prgswitch $texargs";
   print_verbose("running \`$cmdline' ...\n");
--- texmf-dist/scripts/texlive/mktexlsr.pl
+++ texmf-dist/scripts/texlive/mktexlsr.pl	2016-02-08 09:36:58.465067429 +0000
@@ -72,7 +72,7 @@ output version information and exit
 use strict;
 $^W = 1;
 
-
+use POSIX qw(setgid);
 package mktexlsr;
 
 my $ismain;
@@ -340,6 +340,11 @@ sub write {
   my %params = @_;
   my $fn;
   my $dosort = 0;
+  my $gid = getgrnam("mktex");
+  if (defined($gid) && $> == 0) {
+    POSIX::setgid($gid);
+    umask(0002);
+  }
   $fn = $params{'filename'} if $params{'filename'};
   $dosort = $params{'sort'};
   if (!defined($self->{'root'})) {
--- texmf-dist/scripts/texlive/texconfig-dialog.sh
+++ texmf-dist/scripts/texlive/texconfig-dialog.sh	2016-02-01 15:30:20.646789151 +0000
@@ -157,7 +157,14 @@ termCtl()
 ###############################################################################
 menuMain()
 {
-  cat <<-'eof'
+  rows="$(stty size)"
+  columns=${rows##* }
+  rows=${rows%% *}
+  test -n "$rows"	|| rows=0
+  test -n "$columns"	|| columns=0
+
+  if test $rows -lt 24 -a $columns -lt 80 ; then
+    cat <<-'eof'
 	The interactive texconfig utility will be started now. Make sure
 	your screen has at least 24 rows and 80 columns. If texconfig
 	crashes now, you can still set up your TeX system using the
@@ -169,8 +176,9 @@ menuMain()
 	
 	More likely these days, you're better off using tlmgr.
 	See http://tug.org/texlive/tlmgr.html.
-eof
-  termCtl readln
+	eof
+    termCtl readln
+  fi
 
   while :; do
     logMessage='view logfile'
--- texmf-dist/scripts/texlive/texlinks.sh
+++ texmf-dist/scripts/texlive/texlinks.sh	2009-09-02 12:47:26.000000000 +0000
@@ -100,7 +100,7 @@ setupTmpDir()
 
   trap 'cleanup 1' 1 2 3 7 13 15
   needsCleanup=true
-  (umask 077; mkdir "$tmpdir") \
+  (umask 077; mkdir -m 0700 "$tmpdir") \
     || abort "could not create directory \`$tmpdir'"
 }
 
@@ -108,16 +108,18 @@ setupTmpDir()
 # search a binary along $PATH:
 check_for_binary()
 {
-  testbin=$1
-  set x `echo "$PATH" | sed 's/^:/.:/; s/:$/:./; s/::/:.:/g; s/:/ /g'`; shift
-  for i
-  do
-    if [ -x "$i/$testbin" ]; then
-      echo "$i/$testbin"
-      return 0
-    fi
-  done
-  return 1
+# testbin=$1
+# set x `echo "$PATH" | sed 's/^:/.:/; s/:$/:./; s/::/:.:/g; s/:/ /g'`; shift
+# for i
+# do
+#   if [ -x "$i/$testbin" ]; then
+#     echo "$i/$testbin"
+#     return 0
+#   fi
+# done
+# return 1
+
+  type -p $1
 }
 
 
@@ -208,8 +210,22 @@ search_symlinkdir()
 upd_symlinkdir()
 {
   search_symlinkdir || return 0
-  for i in `sed 's@ .*@@' cnf_file_ln.$$`; do
-    install_link "$selfautoloc/$i" "$symlinkdir/$i"
+  set x `cat cnf_file_ln.$$` ; shift
+  while test $# != 0; do
+    fmt=$1; ini=$3; shift; shift; shift
+
+    # Some broken shells destroy the positional arguments when calling a
+    # shellfunction. Therefore, we save and restore them "by hand" in the
+    # main_args_while variable.
+    main_args_while="$@"
+
+    kpsewhich -progname=$fmt -format=tex $ini >/dev/null 2>&1
+    test $? -ne 0 && continue
+
+    install_link "$selfautoloc/$fmt" "$symlinkdir/$fmt"
+
+    # restore positional arguments:
+    set x $main_args_while; shift
   done
 }
 
@@ -274,12 +290,12 @@ main()
   test -f "$cnf_file" || abort "config file \`$cnf' not found"
 
 
-  tmpdir=${TMPDIR-${TEMP-${TMP-/tmp}}}/texlinks.$$
+  tmpdir=${TMPDIR-${TEMP-${TMP-/tmp}}}/texlinks.$$.$RANDOM
   setupTmpDir
   cd "$tmpdir" || cleanup 1
 
-  sed '/^[ 	]*#/d; /^[ 	]*$/d' $cnf_file \
-    | awk '{print $1, $2}' > cnf_file_ln.$$
+  sed '/^[ 	]*#/d; /^[ 	]*$/d; s%\*%%' $cnf_file \
+    | awk '{print $1, $2, $NF}' > cnf_file_ln.$$
 
   if test -z "$dirs"; then
     if test $multiplatform = true; then
@@ -300,13 +316,16 @@ main()
     # cnf_file_ln.$$ has lines with "format engine" pairs
     set x `cat cnf_file_ln.$$`; shift
     while test $# != 0; do
-      fmt=$1; engine=$2; shift; shift
+      fmt=$1; engine=$2; ini=$3; shift; shift; shift
 
       # Some broken shells destroy the positional arguments when calling a
       # shellfunction. Therefore, we save and restore them "by hand" in the
       # main_args_while variable.
       main_args_while="$@"
 
+      kpsewhich -progname=$fmt -format=tex $ini >/dev/null 2>&1
+      test $? -ne 0 && continue
+
       test "x$fmt" = "x$engine" && continue
       if test -f "$d/$engine$exeext"; then
         case $unlink in
--- texmf-dist/scripts/texlive/updmap-sys.sh
+++ texmf-dist/scripts/texlive/updmap-sys.sh	2016-02-01 15:28:58.194011537 +0000
@@ -22,4 +22,5 @@ PATH="$mydir:$PATH"; export PATH
 # hack around a bug in zsh:
 test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
 
+umask 022
 exec updmap --sys ${1+"$@"}
--- texmf-dist/scripts/texlive/updmap.pl
+++ texmf-dist/scripts/texlive/updmap.pl	2017-04-10 08:48:59.737567193 +0000
@@ -16,15 +16,15 @@
 
 my $svnid = '$Id: updmap.pl 44331 2017-05-14 02:15:43Z preining $';
 
-my $TEXMFROOT;
+my $TEXMFDIST;
 BEGIN {
   $^W = 1;
-  $TEXMFROOT = `kpsewhich -var-value=TEXMFROOT`;
+  $TEXMFDIST = `kpsewhich -var-value=TEXMFDIST`;
   if ($?) {
-    die "$0: kpsewhich -var-value=TEXMFROOT failed, aborting early.\n";
+    die "$0: kpsewhich -var-value=TEXMFDIST failed, aborting early.\n";
   }
-  chomp($TEXMFROOT);
-  unshift(@INC, "$TEXMFROOT/tlpkg");
+  chomp($TEXMFDIST);
+  unshift(@INC, "$TEXMFDIST/tlpkg");
 }
 
 my $lastchdate = '$Date: 2017-05-14 04:15:43 +0200 (Sun, 14 May 2017) $';
@@ -46,7 +46,7 @@ use TeXLive::TLUtils qw(mkdirhier mktexu
 # see more comments at the definition of this function.
 reset_root_home();
 
-chomp(my $TEXMFDIST = `kpsewhich --var-value=TEXMFDIST`);
+chomp(my $TEXMFROOT = `kpsewhich --var-value=TEXMFROOT`);
 chomp(my $TEXMFVAR = `kpsewhich -var-value=TEXMFVAR`);
 chomp(my $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`);
 chomp(my $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`);
@@ -397,7 +397,12 @@ sub main {
       }
       print "in $changes_config_file\n";
       print "Do you really want to continue (y/N)? ";
-      my $answer = <STDIN>;
+      my $answer;
+      if (-t STDIN ) {
+        $answer = <STDIN>;
+      } else {
+        $answer = "y";
+      }
       $answer = "n" if !defined($answer);
       chomp($answer);
       print "answer =$answer=\n";
openSUSE Build Service is sponsored by