Skip to content

Commit

Permalink
Use aria2 instead of curl in model-sync script. Do not sync models du…
Browse files Browse the repository at this point in the history
…ring setup stage (#43)
  • Loading branch information
millioner authored Jan 8, 2025
1 parent f89a076 commit be4889f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions setup.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,24 @@ if ! command -v jq >/dev/null 2>&1; then
esac
fi

# Check if aria2 is installed, if not then install it
if ! [ -x "$(command -v aria2c)" ]; then
echo "aria2 not found. Installing aria2..."
case ${OS} in
'Linux')
sudo apt update
sudo apt install -y aria2
;;
'Darwin')
brew install aria2
;;
*)
echo "Unsupported OS for aria2 installation"
exit 1
;;
esac
fi

# Check if PM2 is installed, if not then install it
if ! command -v pm2 >/dev/null 2>&1; then
echo "pm2 not found. Installing pm2..."
Expand Down Expand Up @@ -245,10 +263,6 @@ fi
# Set working directory to install dir
cd "${INSTALL_PATH}" || exit

# Sync remote files for all models
echo "Syncing model files..."
bash "./sync_model_files.sh"

# Display next steps
echo -e "\033[32mOmron has been installed to ${INSTALL_PATH}. Please run \`cd ${INSTALL_PATH}\` to navigate to the directory.\033[0m"
echo -e "\033[32mPlease see ${INSTALL_PATH}/docs/shared_setup_steps.md for the next steps.\033[0m"
2 changes: 1 addition & 1 deletion sync_model_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ for MODEL_FOLDER in $(find "$MODEL_DIR" -maxdepth 1 -type d -name 'model_*'); do
fi
# If the file doesn't exist we'll pull from the URL specified
echo "Downloading ${url} to ${MODEL_FOLDER}/${key}..."
curl -o "${MODEL_FOLDER}/${key}" "${url}"
aria2c ${url} -d "${MODEL_FOLDER}" -o "${key}"
# If the file doesn't download then we'll skip this file and echo the error
if [ $? -ne 0 ]; then
echo "Error: Failed to download ${url} to ${MODEL_FOLDER}/${key}"
Expand Down

0 comments on commit be4889f

Please sign in to comment.