From 2b66ce22aa97a5a4ef8478f2617ea3aef586c7be Mon Sep 17 00:00:00 2001
From: Akira Kakuto <kakuto@fuk.kindai.ac.jp>
Date: Wed, 20 Jun 2018 03:55:23 +0000
Subject: support scripts in trees other than TEXMFDIST

git-svn-id: svn://tug.org/texlive/trunk@48059 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/bin/win32/runscript.tlu | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'Master/bin/win32')

diff --git a/Master/bin/win32/runscript.tlu b/Master/bin/win32/runscript.tlu
index 729293ea579..6a9d2cc398e 100755
--- a/Master/bin/win32/runscript.tlu
+++ b/Master/bin/win32/runscript.tlu
@@ -267,6 +267,9 @@ local docstr = [[
     2018/04/06
         - introduce a new function is_64bit_windows_os() to
           check Windows OS.
+    2018/06/20
+        - support also scripts in trees other than TEXMFDIST:
+          https://tug.org/pipermail/tex-live/2018-June/041922.html
 ]]
 
 -- HELPER SUBROUTINES --
@@ -767,8 +770,14 @@ if not ARGV then
   os.setenv('TEXMF', TEXMFDIST)
   local extlist = '.tlu;.texlua;.pl;.lua;.rb;.py;.tcl;.jar;.vbs;.js;.bat;.cmd;\0'
   local progfullname = search_path(progname, BINDIR, '.tlu;.bat;.cmd') or
-                       assert(find_texmfscript(progname, extlist))
+                       find_texmfscript(progname, extlist)
   os.setenv('TEXMF', nil)
+  if progfullname == nil then
+-- scripts in $TEXMFLOCAL etc. can't be found without the following
+-- line !!
+    kpse.set_program_name('runscript')
+    progfullname = assert(find_texmfscript(progname, extlist))
+  end
   local ext = string.match(string.lower(progfullname), '%.[^\\/.]*$') or ''
   if (ext == '.lua') or (ext == '.tlu') or (ext == '.texlua') then -- lua script
     arg[0] = progfullname
-- 
cgit v1.2.3