aboutsummaryrefslogtreecommitdiff
path: root/bin/provision
blob: 21ca98e7f66ab3f3a43875d13f5851120850807d (plain)
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
#!/bin/bash
#
# Provisioner
#

# Parameters
DIRNAME="`dirname $0`"
BASEDIR="$DIRNAME/.."

# Load optional customizations
#
# Search in multiple levels to account when this repository is vendorized.
[ -f "$BASEDIR/.env" ] && source $BASEDIR/.env
[ -f "$BASEDIR/../.env" ] && source $BASEDIR/../.env
[ -f "$BASEDIR/../../.env" ] && source $BASEDIR/../../.env

# Bookdown packaging approach
BOOKDOWN_PACKAGING="${BOOKDOWN_PACKAGING:-DEB}"

# Dependencies
DEPENDENCIES="make"
DEPENDENCIES="$DEPENDENCIES texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-extra texlive-extra-utils texlive-xetex texlive-lang-portuguese vim-latexsuite"
DEPENDENCIES="$DEPENDENCIES pandoc pandoc-sidenote"
DEPENDENCIES="$DEPENDENCIES fonts-liberation fonts-linuxlibertine"
DEPENDENCIES="$DEPENDENCIES libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev"
DEPENDENCIES="$DEPENDENCIES r-cran-rmarkdown r-cran-magick"
DEPENDENCIES="$DEPENDENCIES libpoppler-cpp-dev"
DEPENDENCIES="$DEPENDENCIES graphviz"
DEPENDENCIES="$DEPENDENCIES biber pybtex"

# Additional BibTeX dependencies
#DEPENDENCIES="$DEPENDENCIES texlive-bibtex-extra"

# For pdfcrop support
DEPENDENCIES="$DEPENDENCIES texlive-extra-utils"

# Old dependencies
#DEPENDENCIES="$DEPENDENCIES python-yaml python-cheetah python-unidecode python-pycurl python-shortuuid"
#DEPENDNECIES="$DEPENDENCIES python-sphinx python-sphinx-bootstrap-theme python-sphinx-paramlinks python-sphinx-patchqueue python-sphinx-rtd-theme python-sphinx-gallery python-sphinxcontrib.bibtex-doc"
#DEPENDENCIES="$DEPENDENCIES pelican hugo jekyll"

# Check for sudo
if [ "`whoami`" != "root" ]; then
  SUDO="sudo"
fi

# Configure Debian backports
if which trashman &> /dev/null; then
  trashman install debian-backports
fi

# Ensure an up-to-date system
$SUDO apt-get update && $SUDO apt-get dist-upgrade -y && \
  $SUDO apt-get autoremove -y && $SUDO apt-get clean

# Install dependencies
$SUDO apt install -y $DEPENDENCIES

# Additional software
#$SUDO apt install -y python3-pandocfilters

# Try to install pandoc-citeproc, may be unavailable on Debian bookworm onwards
#$SUDO apt install -y pandoc-citeproc

# Tufte CSS
#$SUDO apt install cabal-install
#$SUDO cabal update
#$SUDO cabal install pandoc-sidenote
#$SUDO apt install -y libghc-pandoc-sidenote-dev \
#                     libghc-pandoc-sidenote-doc libghc-pandoc-sidenote-prof

# Bookdown dependencies
$SUDO apt install -y libcurl4-openssl-dev libssl-dev

if [ "$BOOKDOWN_PACKAGING" == "CRAN" ]; then
  $SUDO $DIRNAME/provision.R
else
  $SUDO apt install -y r-cran-bookdown
  $SUDO apt install -y r-cran-pdftools
  $SUDO Rscript -e 'install.packages("eulerr")'
fi