Spaces:
Running
Running
Siyuan Hu
feat(tectonic): robust detection of binary in common paths + keep python -m fallback; simplify postBuild; avoid pip tectonic
f3dfa83
| set -e | |
| echo "📦 Installing tectonic..." | |
| if ! command -v tectonic &> /dev/null; then | |
| URL="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 | |
| if command -v curl >/dev/null 2>&1; then | |
| curl -L "$URL" -o /tmp/tectonic.tar.gz | |
| elif command -v wget >/dev/null 2>&1; then | |
| wget -O /tmp/tectonic.tar.gz "$URL" | |
| else | |
| if command -v apt-get >/dev/null 2>&1; then | |
| apt-get update && apt-get install -y wget | |
| wget -O /tmp/tectonic.tar.gz "$URL" | |
| else | |
| echo "❌ Neither curl nor wget available, and apt-get not present." >&2 | |
| exit 1 | |
| fi | |
| fi | |
| 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 PATH: $INSTALL_DIR" | |
| fi | |
| echo "✅ Tectonic installed successfully at $INSTALL_DIR/tectonic" | |
| else | |
| echo "Tectonic already installed." | |
| fi | |