<commit_before>#!/bin/bash

source ./base.sh

create_scripts_dir() {
  echo "* creating butterfinger-scripts dir"
  rm -rf "$SCRIPTS_DIR"
  mkdir -p "$SCRIPTS_DIR"
}

create_directories() {
  echo '* creating directories'
  sudo mkdir -p "$BASE_DIR"
  sudo mkdir -p "$PROJECTS_DIR"
  sudo mkdir -p "$PLEX_CONFIG_DIR"
  sudo mkdir -p "$PLEX_DATA_DIR/.local-secure"
  sudo mkdir -p "$PLEX_DATA_DIR/local-data"
  sudo mkdir -p "$PLEX_DATA_DIR/.b2-secure"
  sudo mkdir -p "$PLEX_DATA_DIR/b2-data"
  sudo mkdir -p "$(dirname "$PLEX_ENV_FILE")"
  sudo mkdir -p "$SERVICES_DIR"
  sudo chmod -R 0775 "$BASE_DIR"
  sudo chgrp -R butterfinger "$BASE_DIR"
}

run_script() {
  local script="$1"
  echo "* running script $script"
  local file_path="${SCRIPTS_DIR}/${script}"
  "$file_path"
}

main() {
  echo "* running init.sh..."
  sudo touch /tmp/.enable-sudo-at-first && \
    create_scripts_dir && \
    create_directories && \
    download_script 'server.sh' && \
    download_script 'docker.sh' && \
    download_script 'file-system.sh' && \
    download_script 'plex.sh' && \
    run_script 'server.sh' && \
    run_script 'docker.sh' && \
    run_script 'file-system.sh' && \
    run_script "plex.sh" && \
    echo '* done with init.sh' && \
    exit 0

  echo "* failed to run init.sh"
  exit 1
}

main "$@"<commit_msg>fixes<commit_after>#!/bin/bash


create_scripts_dir() {
  echo "* creating butterfinger-scripts dir"
  rm -rf "$SCRIPTS_DIR"
  mkdir -p "$SCRIPTS_DIR"
}

create_directories() {
  echo '* creating directories'
  sudo mkdir -p "$BASE_DIR"
  sudo mkdir -p "$PROJECTS_DIR"
  sudo mkdir -p "$PLEX_CONFIG_DIR"
  sudo mkdir -p "$PLEX_DATA_DIR/.local-secure"
  sudo mkdir -p "$PLEX_DATA_DIR/local-data"
  sudo mkdir -p "$PLEX_DATA_DIR/.b2-secure"
  sudo mkdir -p "$PLEX_DATA_DIR/b2-data"
  sudo mkdir -p "$(dirname "$PLEX_ENV_FILE")"
  sudo mkdir -p "$SERVICES_DIR"
  sudo chmod -R 0775 "$BASE_DIR"
  sudo chgrp -R butterfinger "$BASE_DIR"
}

run_script() {
  local script="$1"
  echo "* running script $script"
  local file_path="${SCRIPTS_DIR}/${script}"
  "$file_path"
}

main() {
  echo "* running init.sh..."
  sudo touch /tmp/.enable-sudo-at-first && \
    create_scripts_dir && \
    create_directories && \
    download_script 'base.sh' && \
    source ./base.sh && \
    download_script 'server.sh' && \
    download_script 'docker.sh' && \
    download_script 'file-system.sh' && \
    download_script 'plex.sh' && \
    run_script 'server.sh' && \
    run_script 'docker.sh' && \
    run_script 'file-system.sh' && \
    run_script "plex.sh" && \
    echo '* done with init.sh' && \
    exit 0

  echo "* failed to run init.sh"
  exit 1
}

main "$@"
{'fraction_non_alphanumeric': 0.15929535232383807, 'fraction_numerical': 0.006746626686656672, 'mean_word_length': 3.0935582822085887, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1597092', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1013, 'n_words': 230}