void-packages/srcpkgs/texlive/patches/tlmgr.patch

96 lines
3.1 KiB
Diff

--- a/texk/texlive/linked_scripts/texlive/tlmgr.pl 2023-03-09 08:31:49.000000000 +1100
+++ b/texk/texlive/linked_scripts/texlive/tlmgr.pl 2023-12-18 22:20:18.634173357 +1100
@@ -13,7 +13,7 @@
my $tlmgrrevision;
my $tlmgrversion;
my $prg;
-my $bindir;
+my $bindir = '/usr/bin';
if ($svnrev =~ m/: ([0-9]+) /) {
$tlmgrrevision = $1;
} else {
@@ -44,43 +44,12 @@
BEGIN {
$^W = 1;
- # make subprograms (including kpsewhich) have the right path:
- my $kpsewhichname;
- if ($^O =~ /^MSWin/i) {
- # on w32 $0 and __FILE__ point directly to tlmgr.pl; they can be relative
- $Master = __FILE__;
- $Master =~ s!\\!/!g;
- $Master =~ s![^/]*$!../../..!
- unless ($Master =~ s!/texmf-dist/scripts/texlive/tlmgr\.pl$!!i);
- $bindir = "$Master/bin/windows";
- $kpsewhichname = "kpsewhich.exe";
- # path already set by wrapper batchfile
- } else {
- $Master = __FILE__;
- $Master =~ s,/*[^/]*$,,;
- $bindir = $Master;
- $Master = "$Master/../..";
- # make subprograms (including kpsewhich) have the right path:
- $ENV{"PATH"} = "$bindir:$ENV{PATH}";
- $kpsewhichname = "kpsewhich";
- }
- if (-r "$bindir/$kpsewhichname") {
- # if not in bootstrapping mode => kpsewhich exists, so use it to get $Master
- chomp($Master = `kpsewhich -var-value=TEXMFROOT`);
- }
-
- # if we have no directory in which to find our modules,
- # no point in going on.
- if (! $Master) {
- die ("Could not determine directory of tlmgr executable, "
- . "maybe shared library woes?\nCheck for error messages above");
- }
-
+ $Master = "/usr/share/texmf-dist";
$::installerdir = $Master; # for config.guess et al., see TLUtils.pm
# make Perl find our packages first:
unshift (@INC, "$Master/tlpkg");
- unshift (@INC, "$Master/texmf-dist/scripts/texlive");
+ unshift (@INC, "$Master/scripts/texlive");
}
use Cwd qw/abs_path/;
@@ -622,6 +591,13 @@
tldie("$prg: Try --help if you need it.\n");
}
+ # automatically switch to user mode, and warn
+ if (!$opts{"usermode"} && $action ne "init-usertree") {
+ $opts{"usermode"} = 1;
+ print "(running on Void Linux, switching to user mode!)\n";
+ print "(see https://docs.voidlinux.org/config/texlive.html)\n";
+ }
+
#
# the main tree we will be working on
$::maintree = $Master;
@@ -6260,7 +6236,9 @@
# sets up the user tree for tlmgr in user mode
sub action_init_usertree {
# init_local_db but do not die if localtlpdb is not found!
- init_local_db(2);
+ # we don't ship tlpdb for system files, so don't even
+ # try to initialize it.
+ # init_local_db(2);
my $tlpdb = TeXLive::TLPDB->new;
my $usertree;
if ($opts{"usertree"}) {
@@ -6900,7 +6878,11 @@
if ($should_i_die == 2) {
return undef;
} else {
- die("cannot setup TLPDB in $::maintree");
+ if ($opts{'usermode'}) {
+ die("$prg: user mode not initialized, please read https://docs.voidlinux.org/config/texlive.html!\n");
+ } else {
+ die("cannot setup TLPDB in $::maintree");
+ }
}
}
# setup the programs, for w32 we need the shipped wget/xz etc, so we