Skip to content

Commit

Permalink
Merge pull request #215 from howcanunot/fix-install-script
Browse files Browse the repository at this point in the history
Install reqired `tlmgr` in install script if necessary
  • Loading branch information
yegor256 committed Mar 20, 2024
2 parents 8750259 + 7bf7876 commit de0da73
Showing 1 changed file with 30 additions and 56 deletions.
86 changes: 30 additions & 56 deletions steps/install.sh
Expand Up @@ -47,41 +47,26 @@ if [ -n "${linux}" ]; then
apt-get install -y coreutils
fi

if ! parallel --version >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
apt-get -y install parallel
else
echo "Install 'parallel' somehow"
exit 1
fi
fi

if ! bc -v >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
apt-get install -y bc
else
echo "Install 'GNU bc' somehow"
exit 1
fi
fi

if ! cloc --version >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
apt-get install -y cloc
else
echo "Install 'cloc' somehow"
exit 1
fi
fi

if ! jq --version >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
apt-get install -y jq
else
echo "Install 'jq' somehow"
exit 1
fi
fi
function install_package() {
local PACKAGE=$1

if ! eval "$PACKAGE" --version >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
apt-get install -y "$PACKAGE"
else
echo "Install '$PACKAGE' somehow"
exit 1
fi
fi
}

install_package "parallel"
install_package "bc"
install_package "cloc"
install_package "jq"
install_package "shellcheck"
install_package "aspell"
install_package "xmlstarlet"

if ! pdftotext -v >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
Expand All @@ -92,29 +77,18 @@ if ! pdftotext -v >/dev/null 2>&1; then
fi
fi

if ! shellcheck --version >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
apt-get install -y shellcheck
else
echo "Install 'shellcheck' somehow"
exit 1
fi
fi

if ! aspell --version >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
apt-get install -y aspell
else
echo "Install 'GNU aspell' somehow"
exit 1
fi
fi

if ! xmlstarlet --version >/dev/null 2>&1; then
if [ ! -d /usr/local/texlive/"$(date +%Y)"/bin ]; then
if [ -n "${linux}" ]; then
apt-get install -y xmlstarlet
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \
zcat < install-tl-unx.tar.gz | tar xf - && \
rm install-tl-unx.tar.gz && \
cd install-tl-"$(date +%Y)"* && \
perl ./install-tl --scheme=e --no-interaction
cd .. && rm -r install-tl-"$(date +%Y)"*
TEXLIVE_DIR=$(ls -d /usr/local/texlive/"$(date +%Y)"/bin/*/)
export PATH="$PATH:$TEXLIVE_DIR"
else
echo "Install 'xmlstarlet' somehow"
echo "Install 'texlive' somehow"
exit 1
fi
fi
Expand Down

0 comments on commit de0da73

Please sign in to comment.