Skip to content

Commit

Permalink
✨ Script works for download standard TinyTex
Browse files Browse the repository at this point in the history
  • Loading branch information
Fbrisset committed Nov 17, 2023
1 parent 67f1e29 commit ed31431
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ source "${plugin_dir}/lib/utils.bash"

mkdir -p "$ASDF_DOWNLOAD_PATH"

# TODO: Adapt this to proper extension and adapt extracting strategy.
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"

# Download tar.gz file to the download directory
Expand Down
13 changes: 7 additions & 6 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -euo pipefail

# TODO: Ensure this is the correct GitHub homepage where releases can be downloaded for tinytex.
GH_REPO="https://github.com/rstudio/tinytex-releases"
TOOL_NAME="tinytex"
TOOL_TEST="tex --version"
Expand Down Expand Up @@ -41,8 +40,7 @@ download_release() {
version="$1"
filename="$2"

# TODO: Adapt the release URL convention for tinytex
url="$GH_REPO/archive/v${version}.tar.gz"
url="$GH_REPO/releases/download/v${version}/TinyTex-v${version}.tar.gz"

echo "* Downloading $TOOL_NAME release $version..."
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
Expand All @@ -51,20 +49,23 @@ download_release() {
install_version() {
local install_type="$1"
local version="$2"
local install_path="${3%/bin}/bin"
local install_path="${3%/bin}"

if [ "$install_type" != "version" ]; then
fail "asdf-$TOOL_NAME supports release installs only"
fi

(
mkdir -p "$install_path"
mkdir -p "$install_path/binaries/"
cp -r "$ASDF_DOWNLOAD_PATH"/bin/* "$install_path/binaries/"
ln -s "$install_path"/binaries/x86_64-linux/ "$install_path/bin"
rm -rf "${ASDF_DOWNLOAD_PATH:?}"/bin/
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"

# TODO: Assert tinytex executable exists.
local tool_cmd
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
test -x "$install_path/$tool_cmd" || fail "Expected $install_path/$tool_cmd to be executable."
test -x "$install_path/bin/$tool_cmd" || fail "Expected $install_path/bin/$tool_cmd to be executable."

echo "$TOOL_NAME $version installation was successful!"
) || (
Expand Down

0 comments on commit ed31431

Please sign in to comment.