Spaces:
Sleeping
Sleeping
| set -e | |
| echo "📦 Installing tectonic..." | |
| if ! command -v tectonic &> /dev/null; then | |
| wget -O /tmp/tectonic.tar.gz https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%400.15.0/tectonic-0.15.0-x86_64-unknown-linux-gnu.tar.gz | |
| mkdir -p /tmp/tectonic | |
| tar -xzf /tmp/tectonic.tar.gz -C /tmp/tectonic | |
| # 找到可执行文件路径 | |
| TECTONIC_BIN=$(find /tmp/tectonic -type f -name tectonic | head -n 1) | |
| # 默认安装路径 | |
| INSTALL_DIR="/usr/local/bin" | |
| # 如果没有写入权限,就改到用户目录 | |
| if [ ! -w "$INSTALL_DIR" ]; then | |
| INSTALL_DIR="$HOME/.local/bin" | |
| mkdir -p "$INSTALL_DIR" | |
| echo "⚠️ No permission for /usr/local/bin, installing to $INSTALL_DIR" | |
| fi | |
| cp "$TECTONIC_BIN" "$INSTALL_DIR/tectonic" | |
| chmod +x "$INSTALL_DIR/tectonic" | |
| # 自动提示 PATH 设置 | |
| if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then | |
| echo "⚙️ You may need to add this to your ~/.bashrc:" | |
| echo "export PATH=\$PATH:$INSTALL_DIR" | |
| fi | |
| echo "✅ Tectonic installed successfully at $INSTALL_DIR/tectonic" | |
| else | |
| echo "Tectonic already installed." | |
| fi | |