-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall_pdf_dependencies.sh
More file actions
executable file
·98 lines (85 loc) · 2.81 KB
/
install_pdf_dependencies.sh
File metadata and controls
executable file
·98 lines (85 loc) · 2.81 KB
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
92
93
94
95
96
97
98
#!/bin/bash
# Install dependencies for PDF export script
# This script installs the necessary tools for converting Hugo books to PDF
echo "Installing PDF export dependencies..."
# --- OS Detection and Installation ---
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
echo "Detected macOS, installing with Homebrew..."
if ! command -v brew &> /dev/null; then
echo "Homebrew not found. Please install it first."
exit 1
fi
echo "Installing system dependencies: pandoc, librsvg, imagemagick, basictex..."
brew install pandoc librsvg imagemagick
brew install --cask basictex
echo "Installing LaTeX packages via tlmgr..."
sudo tlmgr update --self
sudo tlmgr install ctex fancyhdr titlesec fontspec geometry chngcntr booktabs caption float framed hyperref listings parskip fvextra
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
echo "Detected Linux..."
if command -v apt-get &> /dev/null; then
# Debian/Ubuntu
echo "Using apt-get..."
sudo apt-get update
sudo apt-get install -y \
pandoc \
librsvg2-bin \
imagemagick \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
texlive-xetex \
texlive-lang-chinese \
texlive-font-utils \
texlive-luatex
elif command -v dnf &> /dev/null || command -v yum &> /dev/null; then
# Fedora/CentOS/RHEL
echo "Using dnf/yum..."
if command -v dnf &> /dev/null; then
PKG_MANAGER=dnf
else
PKG_MANAGER=yum
fi
sudo $PKG_MANAGER install -y \
pandoc \
librsvg2-tools \
ImageMagick \
texlive-latex-base \
texlive-latex \
texlive-collection-latexrecommended \
texlive-collection-latexextra \
texlive-collection-langchinese \
texlive-xetex \
texlive-font-utils \
texlive-luatex
elif command -v pacman &> /dev/null; then
# Arch Linux
echo "Using pacman..."
sudo pacman -S --noconfirm --needed \
pandoc \
librsvg \
imagemagick \
texlive-core \
texlive-latexextra \
texlive-langchinese \
texlive-xetex
else
echo "Unsupported Linux distribution. Please install dependencies manually."
exit 1
fi
else
echo "Unsupported operating system: $OSTYPE"
exit 1
fi
echo ""
echo "✅ Dependencies installation completed!"
echo ""
echo "To verify installation, run:"
echo " pandoc --version"
echo " rsvg-convert --version"
echo " convert --version"
echo " xelatex --version"
echo ""
echo "You can now use the PDF export script."