<commit_before>#!/bin/sh

# Quick and easy install via curl and wget.
# 
# All of the heavy lifting is done by run_cloud.sh: this
# script just clones the uproxy-docker repo and executes
# run_cloud.sh from there.
#
# Heavily based on Docker's installer at:
#   https://get.docker.com/.

set -e

command_exists() {
  command -v "$@" > /dev/null 2>&1
}

do_install() {
  if ! command_exists docker
  then
    curl -fsSL https://get.docker.com/ | sh
fi

  TMP_DIR=`mktemp -d`
  git clone --depth 1 https://github.com/uProxy/uproxy-docker.git $TMP_DIR
  cd $TMP_DIR/testing/run-scripts

   # TODO: pass arguments, e.g. banner
  ./run_cloud.sh firefox-stable
}

# Wrapped in a function for some protection against half-downloads.
do_install<commit_msg>do not run docker installer unless we think it can succeed<commit_after>#!/bin/sh

# Quick and easy install via curl and wget.
# 
# All of the heavy lifting is done by run_cloud.sh: this
# script just clones the uproxy-docker repo and executes
# run_cloud.sh from there.
#
# Heavily based on Docker's installer at:
#   https://get.docker.com/.

set -e

command_exists() {
  command -v "$@" > /dev/null 2>&1
}

do_install() {
  # uProxy requires Docker. If it's not installed and we think the
  # installer is likely to succeed, run the Docker installer first.
  # Note: Because this installer is run via curl | sh, it's not
  #       possible to ask the user for confirmation.
  if ! command_exists docker
  then
    if [ "$USER" != "root" ]
    then
      echo "uProxy requires Docker. Before running this script, please "
      echo "follow the installation instructions for your system:"
      echo "  https://docs.docker.com/mac/started/"
      exit 1
    fi
    echo "Docker not found, running Docker installer."
    curl -fsSL https://get.docker.com/ | sh
  fi

  TMP_DIR=`mktemp -d`
  git clone --depth 1 https://github.com/uProxy/uproxy-docker.git $TMP_DIR
  cd $TMP_DIR/testing/run-scripts

   # TODO: pass arguments, e.g. banner
  ./run_cloud.sh firefox-stable
}

# Wrapped in a function for some protection against half-downloads.
do_install
{'fraction_non_alphanumeric': 0.10523809523809524, 'fraction_numerical': 0.0033333333333333335, 'mean_word_length': 3.1358267716535435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '716337', 'n_tokens_mistral': 727, 'n_tokens_neox': 675, 'n_words': 243}