Skip to content

Commit

Permalink
chore: Check if nimbus-cli is installed first
Browse files Browse the repository at this point in the history
  • Loading branch information
flozia committed Jul 26, 2024
1 parent c153dca commit dcc316b
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/scripts/validate-nimbus-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ TARGET_PATH=/tmp/nimbus-cli
NIMBUS_INSTALL_REMOTE_PATH=https://raw.githubusercontent.com/mozilla/application-services/main/install-nimbus-cli.sh
NIMBUS_INSTALL_LOCAL_PATH=$TARGET_PATH/install.sh

if [ -d "${TARGET_PATH}" ]; then
echo "Directory for \`nimbus-cli\` already exists: $TARGET_PATH"
else
echo "Create directory for \`nimbus-cli\`: $TARGET_PATH"
mkdir -p $TARGET_PATH
fi

if [ -f "${NIMBUS_INSTALL_LOCAL_PATH}" ]; then
echo "Skip download of \`nimbus-cli\` installer"
else
echo "Download \`nimbus-cli\` installer from $NIMBUS_INSTALL_REMOTE_PATH to $TARGET_PATH"
curl --proto '=https' --tlsv1.2 -sSf -o "$NIMBUS_INSTALL_LOCAL_PATH" "$NIMBUS_INSTALL_REMOTE_PATH"
fi

if command -v "${TARGET_PATH}/nimbus-cli"; then
echo "Skip installation of \`nimbus-cli\`"
else
if [ -d "${TARGET_PATH}" ]; then
echo "Directory for \`nimbus-cli\` already exists: $TARGET_PATH"
else
echo "Create directory for \`nimbus-cli\`: $TARGET_PATH"
mkdir -p $TARGET_PATH
fi

if [ -f "${NIMBUS_INSTALL_LOCAL_PATH}" ]; then
echo "Skip download of \`nimbus-cli\` installer"
else
echo "Download \`nimbus-cli\` installer from $NIMBUS_INSTALL_REMOTE_PATH to $TARGET_PATH"
curl --proto '=https' --tlsv1.2 -sSf -o "$NIMBUS_INSTALL_LOCAL_PATH" "$NIMBUS_INSTALL_REMOTE_PATH"
fi

echo "Install \`nimbus-cli\`"
bash $NIMBUS_INSTALL_LOCAL_PATH --directory $TARGET_PATH
fi
Expand Down

0 comments on commit dcc316b

Please sign in to comment.