|
|
#!/bin/bash |
|
|
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" |
|
|
|
|
|
|
|
|
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 |
|
|
|