Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install reqired tlmgr in install script if necessary #215

Merged
merged 12 commits into from Mar 20, 2024
2 changes: 1 addition & 1 deletion steps/discover-repos.rb
Expand Up @@ -102,7 +102,7 @@
puts "Found #{found.count} total repositories in GitHub"

if found.count > opts[:total]
found = found.first(opts[:total]).to_h
found = found.first(opts[:total])
puts "We will use only the first #{opts[:total]} repositories"
end

Expand Down
85 changes: 30 additions & 55 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,32 +77,22 @@ if ! pdftotext -v >/dev/null 2>&1; then
fi
fi

if ! shellcheck --version >/dev/null 2>&1; then
if [ ! -d /usr/local/texlive/"$(date +%Y)"/bin ]; then
if [ -n "${linux}" ]; then
apt-get install -y shellcheck
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)"*
else
echo "Install 'shellcheck' somehow"
echo "Install 'texlive' 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 [ -n "${linux}" ]; then
apt-get install -y xmlstarlet
else
echo "Install 'xmlstarlet' somehow"
exit 1
fi
fi
TEXLIVE_DIR=$(ls -d /usr/local/texlive/"$(date +%Y)"/bin/*/)
PATH="$PATH:$TEXLIVE_DIR"
Copy link
Owner

@yegor256 yegor256 Mar 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@howcanunot I believe, it should be export PATH=... Otherwise, the changes you make will only be visible inside this script. Is is what you intend to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@howcanunot I still think that it's wrongly placed. What if texlive is already installed on my machine? You still want to modify my PATH?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yegor256 well, it won't be worse
but in general it's more logical to put the PATH inside the if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


if [ ! -e "${HOME}/texmf" ]; then
$SUDO tlmgr init-usertree
Expand Down