Skip to content

Commit

Permalink
Fixes pkg_dir location logic and makes unzip more forgiving
Browse files Browse the repository at this point in the history
  • Loading branch information
vctrstrm committed Dec 10, 2021
1 parent 5d2ba33 commit b665c8f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions gamechangerml/scripts/download_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash
echo "Be sure to set up environment variables for s3 by sourcing setup_env.sh if running this manually"

function download_and_unpack_deps() {

local pkg_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" >/dev/null 2>&1 && pwd )"
local pkg_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )"
local models_dest_dir="$pkg_dir/models/"
local data_dest_dir="$pkg_dir/data/"

Expand Down Expand Up @@ -34,15 +34,14 @@ function download_and_unpack_deps() {
aws s3 cp "$S3_ML_DATA_PATH" "$data_dest_dir"

echo "Uncompressing all tar files in models"
for f in ./gamechangerml/models/*.tar.gz; do
tar kxvfz "$f" --exclude '*/.git/*' --exclude '*/.DS_Store/*' -C "$models_dest_dir";
done
find "$models_dest_dir" -maxdepth 1 -type f -name "*.tar.gz" | while IFS=$'\n' read -r f; do
tar kxzvf "$f" --exclude '*/.git/*' --exclude '*/.DS_Store/*' -C "$models_dest_dir"
done

echo "Uncompressing all tar files in data"
for f in ./gamechangerml/data/*.tar.gz; do
tar kxvfz "$f" --exclude '*/.git/*' --exclude '*/.DS_Store/*' -C "$data_dest_dir";
find "$data_dest_dir" -maxdepth 1 -type f -name "*.tar.gz" | while IFS=$'\n' read -r f; do
tar kxzvf "$f" --exclude '*/.git/*' --exclude '*/.DS_Store/*' -C "$data_dest_dir"
done

}

download_and_unpack_deps
download_and_unpack_deps

0 comments on commit b665c8f

Please sign in to comment.