<commit_before>#!/bin/bash
set -o noclobber
set -o errexit
set -o nounset
# For debugging
set -o xtrace

# Options
DESTDIR=/opt/pwnableweb
DRIVERDEST=/opt/chromedriver
# End options

if [ `id -u` -ne 0 ]; then
  echo "Must be run as root."
  exit 1
fi

function randpw() {
  dd if=/dev/urandom bs=16 count=1 2>/dev/null | base64
}
function randkey() {
  dd if=/dev/urandom bs=48 count=1 2>/dev/null | base64
}

# Get input
echo -n "Domain to run on: "
read DOMAIN
echo -n "MySQL Root password: "
read -s MYSQLPASS
# End input

if [[ `arch` == *64 ]] ; then
  CHROME=https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  DRIVER=https://chromedriver.storage.googleapis.com/2.9/chromedriver_linux64.zip
else
  CHROME=https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
  DRIVER=https://chromedriver.storage.googleapis.com/2.9/chromedriver_linux32.zip
fi

# Are we including scoreboard
if [ -d scoreboard ] ; then
  SCOREBOARD=true
else
  SCOREBOARD=false
fi

# Install prerequisites
# TODO: Support other platforms
apt-get update
# Probably should include current selections?
sudo debconf-set-selections <<EOFSELECTIONS
mysql-server mysql-server/root_password password $MYSQLPASS
mysql-server mysql-server/root_password_again password $MYSQLPASS
EOFSELECTIONS
apt-get -y install python-pip python-dev mysql-server libmysqlclient-dev xvfb \
  curl unzip build-essential nginx
curl -s -o /tmp/chrome.deb $CHROME
dpkg -i /tmp/chrome.deb
# In case of missing deps
apt-get -fy install
curl -s -o /tmp/chromedriver.zip $DRIVER
unzip -d /tmp /tmp/chromedriver.zip
mkdir -p `dirname $DRIVERDEST`
mv /tmp/chromedriver $DRIVERDEST<commit_msg>Fix install script for chrome deps.<commit_after>#!/bin/bash
set -o noclobber
set -o errexit
set -o nounset
# For debugging
set -o xtrace

# Options
DESTDIR=/opt/pwnableweb
DRIVERDEST=/opt/chromedriver
# End options

if [ `id -u` -ne 0 ]; then
  echo "Must be run as root."
  exit 1
fi

function randpw() {
  dd if=/dev/urandom bs=16 count=1 2>/dev/null | base64
}
function randkey() {
  dd if=/dev/urandom bs=48 count=1 2>/dev/null | base64
}

# Get input
echo -n "Domain to run on: "
read DOMAIN
echo -n "MySQL Root password: "
read -s MYSQLPASS
# End input

if [[ `arch` == *64 ]] ; then
  CHROME=https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  DRIVER=https://chromedriver.storage.googleapis.com/2.9/chromedriver_linux64.zip
else
  CHROME=https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
  DRIVER=https://chromedriver.storage.googleapis.com/2.9/chromedriver_linux32.zip
fi

# Are we including scoreboard
if [ -d scoreboard ] ; then
  SCOREBOARD=true
else
  SCOREBOARD=false
fi

# Install prerequisites
# TODO: Support other platforms
apt-get update
# Probably should include current selections?
sudo debconf-set-selections <<EOFSELECTIONS
mysql-server mysql-server/root_password password $MYSQLPASS
mysql-server mysql-server/root_password_again password $MYSQLPASS
EOFSELECTIONS
apt-get -y install python-pip python-dev mysql-server libmysqlclient-dev xvfb \
  curl unzip build-essential nginx
curl -s -o /tmp/chrome.deb $CHROME
dpkg -i /tmp/chrome.deb && apt-get -fy install
curl -s -o /tmp/chromedriver.zip $DRIVER
unzip -d /tmp /tmp/chromedriver.zip
mkdir -p `dirname $DRIVERDEST`
mv /tmp/chromedriver $DRIVERDEST
{'fraction_non_alphanumeric': 0.11247382590487585, 'fraction_numerical': 0.01734968591085851, 'mean_word_length': 4.176470588235294, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3164738', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1198, 'n_words': 323}