File: debian-tlmgr-usermode

package info (click to toggle)
texlive-base 2024.20250309-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,058,192 kB
  • sloc: perl: 44,903; sh: 5,008; makefile: 4,278; javascript: 3,034; ruby: 2,428; tcl: 2,131; xml: 1,874; python: 1,385; pascal: 1,249; cpp: 549; awk: 512; lisp: 447; ansic: 103; sed: 8
file content (91 lines) | stat: -rw-r--r-- 3,337 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
--- texlive-base-2024.20240829.orig/texmf-dist/scripts/texlive/tlmgr.pl
+++ texlive-base-2024.20240829/texmf-dist/scripts/texlive/tlmgr.pl
@@ -44,38 +44,7 @@
 
 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") {
-    # 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/texlive";
   $::installerdir = $Master;  # for config.guess et al., see TLUtils.pm
 
   # make Perl find our packages first:
@@ -628,6 +597,13 @@
     tldie("$prg: Try --help if you need it.\n");
   }
 
+  # automatically switch to user mode on Debian, and warn
+  if (!$opts{"usermode"} && $action ne "init-usertree") {
+    $opts{"usermode"} = 1;
+    print "(running on Debian, switching to user mode!)\n";
+    print "(see /usr/share/doc/texlive-base/README.tlmgr-on-Debian.md)\n";
+  }
+
   # nice to have the version if debugging.
   debug("tlmgr version $tlmgrversion\n");
 
@@ -6364,7 +6340,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);
+  # Debian: 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"}) {
@@ -7149,7 +7127,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 the documentation!\n");
+      } else {
+        die("cannot setup TLPDB in $::maintree");
+      }
     }
   }
   # setup the programs, for w32 we need the shipped wget/xz etc, so we
--- texlive-base-2024.20240829.orig/texmf-dist/doc/man/man1/tlmgr.1
+++ texlive-base-2024.20240829/texmf-dist/doc/man/man1/tlmgr.1
@@ -76,6 +76,8 @@
 <https://tug.org/texlive/tlmgr.html>, along with procedures for updating
 \&\f(CW\*(C`tlmgr\*(C'\fR itself and information about test versions.
 .PP
+WARNING: tlmgr in Debian runs always in user mode
+.PP
 TeX Live is organized into a few top-level \fIschemes\fR, each of which is
 specified as a different set of \fIcollections\fR and \fIpackages\fR, where a
 collection is a set of packages, and a package is what contains actual