无法使用 Bash 脚本安装 TeX Live

无法使用 Bash 脚本安装 TeX Live

我正在尝试在 Jetbrains Datalore 虚拟机中安装 TeX Live。首次启动时,虚拟机会自动执行init.sh可通过 Datalore GUI 编辑/上传的脚本文件。

这是我的init.sh

#!/bin/bash

# This shell script runs when the machine starts, 
# before the user-installed packages are set up.
#
# Use it to install additional dependencies.
#
# Examples:
#
# sudo apt update && sudo apt install -y some-package
#
# pip install some-package --additional-arguments
#
# The logs are stored in /tmp/log;
# the error log is copied to Notebook files.

#!/bin/bash

# This shell script runs when the machine starts, 
# before the user-installed packages are set up.
#
# Use it to install additional dependencies.
#
# Examples:
#
# sudo apt update && sudo apt install -y some-package
#
# pip install some-package --additional-arguments
#
# The logs are stored in /tmp/log;
# the error log is copied to Notebook files.

#!/bin/bash

# This shell script runs when the machine starts, 
# before the user-installed packages are set up.
#
# Use it to install additional dependencies.
#
# Examples:
#
# sudo apt update && sudo apt install -y some-package
#
# pip install some-package --additional-arguments
#
# The logs are stored in /tmp/log;
# the error log is copied to Notebook files.

sudo apt update -y &&
sudo rm -rf tmp_latex/
sudo mkdir tmp_latex &&
cd tmp_latex &&
sudo wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz &&
sudo tar -xf install-tl-unx.tar.gz --no-same-owner &&
sudo rm install-tl-unx.tar.gz &&
cd install-tl-* &&
sudo wget https://gist.githubusercontent.com/prenone/bebaa5db68dd3e458dccbcefeb596bf3/raw/5e5590abffccbea76f69881fa3ce771d56912013/texlive.profile &&
sudo ./install-tl -profile texlive.profile -no-interaction &&
sudo tlmgr init-usertree &&
sudo tlmgr install amsmath &&
sudo tlmgr install cm-super &&
sudo tlmgr install underscore &&
sudo tlmgr install type1cm &&
sudo tlmgr install dvipng &&
sudo apt install dvipng -y &&
cd ../.. &&
sudo rm -rf tmp_latex/

当我从 shell 单独运行每个命令时,一切正常,TeX Live 与所需的软件包一起成功安装。但是,当脚本在启动时执行时,我收到以下错误日志

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

--2023-03-25 13:28:22--  https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
Resolving mirror.ctan.org (mirror.ctan.org)... 5.35.249.60
Connecting to mirror.ctan.org (mirror.ctan.org)|5.35.249.60|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://ftp.heanet.ie/mirrors/ctan.org/tex/systems/texlive/tlnet/install-tl-unx.tar.gz [following]
--2023-03-25 13:28:22--  https://ftp.heanet.ie/mirrors/ctan.org/tex/systems/texlive/tlnet/install-tl-unx.tar.gz
Resolving ftp.heanet.ie (ftp.heanet.ie)... 193.1.193.10, 2001:770:18:aa40::c101:c10a
Connecting to ftp.heanet.ie (ftp.heanet.ie)|193.1.193.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5737490 (5.5M) [application/x-gzip]
Saving to: ‘install-tl-unx.tar.gz’

     0K .......... .......... .......... .......... ..........  0% 19.6M 0s
    50K .......... .......... .......... .......... ..........  1% 11.8M 0s

# ... more wget progress output ...

5550K .......... .......... .......... .......... .......... 99% 79.8M 0s
  5600K ...                                                   100% 21.7M=0.1s

2023-03-25 13:28:22 (37.0 MB/s) - ‘install-tl-unx.tar.gz’ saved [5737490/5737490]

--2023-03-25 13:28:24--  https://gist.githubusercontent.com/prenone/bebaa5db68dd3e458dccbcefeb596bf3/raw/5e5590abffccbea76f69881fa3ce771d56912013/texlive.profile
Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 933 [text/plain]
Saving to: ‘texlive.profile’

     0K                                                       100% 49.0M=0s

2023-03-25 13:28:24 (49.0 MB/s) - ‘texlive.profile’ saved [933/933]

./install-tl: could not run ./tlpkg/installer/config.guess, cannot proceed, sorry at tlpkg/TeXLive/TLUtils.pm line 372.

如果我尝试手动运行该文件(在 Datalore 自动执行该文件之后),sudo bash init.sh我会收到不同的错误,并且似乎 ./install-lt 甚至不输出

# ...

texlive.profile                  100%[=======================================================>]     933  --.-KB/s    in 0s      

2023-03-25 13:31:31 (4.39 MB/s) - ‘texlive.profile’ saved [933/933]

sudo: tlmgr: command not found

相关内容