<commit_before>#!/bin/bash

# Current work directory
CWD=`pwd`

# Current script directory
CSD=$(cd `dirname $0`; pwd)

# I18n
CURRENT_LANG=${LANG%.*}
if [ -f "$CSD/i18n/$CURRENT_LANG.sh" ]; then
  source "$CSD/i18n/$CURRENT_LANG.sh"
else
  source "$CSD/i18n/en.sh"
fi

# Check permission
if [ `id -u` != '0' ]; then
  echo $LANG_NON_ROOT_ERROR
  exit 1
fi

set -e

# Applications
APPLICATIONS=(
  bind
  docker
  git
  ruby
  nginx
  node
  python3
)

# Defaults
source "$CSD/defaults.sh"

# Config
if [ -f "$CSD/config.sh" ]; then
  source "$CSD/config.sh"
fi

# Options
if [ -z $BASIC_SETUP ]; then
  typeset -u BASIC_SETUP
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_BASIC_SETUP[Y/N]: ($DEFAULT_BASIC_SETUP) " BASIC_SETUP
  fi
  if [ -z $BASIC_SETUP ]; then
    BASIC_SETUP=$DEFAULT_BASIC_SETUP
  fi
fi
if [ $BASIC_SETUP == 'Y' ]; then
  if [[ -z $HOSTNAME && $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
    read -p "$LANG_HOSTNAME: " HOSTNAME
  fi
  if [[ -z $USERNAME && $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
    read -p "$LANG_USERNAME: " USERNAME
  fi
  if [[ -z $TIMEOUT && $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
    read -p "$LANG_TIMEOUT[>=0]($LANG_SECONDS): " TIMEOUT
  fi
fi

if [ -z $YUM_UPDATE ]; then
  typeset -u YUM_UPDATE
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_YUM_UPDATE[Y/N]: ($DEFAULT_YUM_UPDATE) " YUM_UPDATE
  fi
  if [ -z $YUM_UPDATE ]; then
    YUM_UPDATE=$DEFAULT_YUM_UPDATE
  fi
fi

if [ -z $YUM_UPGRADE ]; then
  typeset -u YUM_UPGRADE
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_YUM_UPGRADE[Y/N]: ($DEFAULT_YUM_UPGRADE) " YUM_UPGRADE
  fi
  if [ -z $YUM_UPGRADE ]; then
    YUM_UPGRADE=$DEFAULT_YUM_UPGRADE
  fi
fi

if [ -z $COMMON_LIBRARY ]; then
  typeset -u COMMON_LIBRARY
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_INSTALL_COMMON_LIBRARIES[Y/N]: ($DEFAULT_COMMON_LIBRARY) " COMMON_LIBRARY
  fi
  if [ -z $COMMON_LIBRARY ]; then
    COMMON_LIBRARY=$DEFAULT_COMMON_LIBRARY
  fi
fi

if [ -z $INSTALLATION_PATH ]; then
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_COMMON_INSTALLATION_PATH: ($DEFAULT_INSTALLATION_PATH) " INSTALLATION_PATH
  fi
  if [ -z $INSTALLATION_PATH ]; then
    INSTALLATION_PATH=$DEFAULT_INSTALLATION_PATH
  fi
fi

for((i = 0, len = ${#APPLICATIONS[*]}; i < len; i++))
do
  source "$CSD/applications/${APPLICATIONS[$i]}.sh"
done

# Go to tmp directory
cd $CSD/tmp

# Install
if [ $DEFAULT_INSTALLATION_MODE == 'Y' ]; then
  set -x
  $LANG_DEFAULT_INSTALLATION_MODE
  set +x
fi
if [ $BASIC_SETUP == 'Y' ]; then
  if [ -n "$HOSTNAME" ]; then
    set -x
    hostnamectl set-hostname $HOSTNAME
    set +x
  fi
  if [ -n "$TIMEOUT" ]; then
    set -x
    echo "TMOUT=$TIMEOUT" > /etc/profile.d/tmout.sh
    set +x
  fi
  if [ -n "$USERNAME" ]; then
    set -x
    useradd $USERNAME
    # chcon -Rt httpd_sys_rw_content_t /home/$USERNAME
    set +x
  fi<commit_msg>deploy<commit_after>#!/bin/bash

# Current work directory
CWD=`pwd`

# Current script directory
CSD=$(cd `dirname $0`; pwd)

# I18n
CURRENT_LANG=${LANG%.*}
if [ -f "$CSD/i18n/$CURRENT_LANG.sh" ]; then
  source "$CSD/i18n/$CURRENT_LANG.sh"
else
  source "$CSD/i18n/en.sh"
fi

# Check permission
if [ `id -u` != '0' ]; then
  echo $LANG_NON_ROOT_ERROR
  exit 1
fi

set -e

# Applications
APPLICATIONS=(
  bind
  docker
  git
  ruby
  nginx
  node
  python3
)

# Defaults
source "$CSD/defaults.sh"

# Config
if [ -f "$CSD/config.sh" ]; then
  source "$CSD/config.sh"
fi

# Options
if [ -z $BASIC_SETUP ]; then
  typeset -u BASIC_SETUP
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_BASIC_SETUP[Y/N]: ($DEFAULT_BASIC_SETUP) " BASIC_SETUP
  fi
  if [ -z $BASIC_SETUP ]; then
    BASIC_SETUP=$DEFAULT_BASIC_SETUP
  fi
fi
if [ $BASIC_SETUP == 'Y' ]; then
  if [[ -z $HOSTNAME && $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
    read -p "$LANG_HOSTNAME: " HOSTNAME
  fi
  if [[ -z $USERNAME && $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
    read -p "$LANG_USERNAME: " USERNAME
  fi
  if [[ -z $TIMEOUT && $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
    read -p "$LANG_TIMEOUT[>=0]($LANG_SECONDS): " TIMEOUT
  fi
fi

if [ -z $YUM_UPDATE ]; then
  typeset -u YUM_UPDATE
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_YUM_UPDATE[Y/N]: ($DEFAULT_YUM_UPDATE) " YUM_UPDATE
  fi
  if [ -z $YUM_UPDATE ]; then
    YUM_UPDATE=$DEFAULT_YUM_UPDATE
  fi
fi

if [ -z $YUM_UPGRADE ]; then
  typeset -u YUM_UPGRADE
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_YUM_UPGRADE[Y/N]: ($DEFAULT_YUM_UPGRADE) " YUM_UPGRADE
  fi
  if [ -z $YUM_UPGRADE ]; then
    YUM_UPGRADE=$DEFAULT_YUM_UPGRADE
  fi
fi

if [ -z $COMMON_LIBRARY ]; then
  typeset -u COMMON_LIBRARY
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_INSTALL_COMMON_LIBRARIES[Y/N]: ($DEFAULT_COMMON_LIBRARY) " COMMON_LIBRARY
  fi
  if [ -z $COMMON_LIBRARY ]; then
    COMMON_LIBRARY=$DEFAULT_COMMON_LIBRARY
  fi
fi

if [ -z $INSTALLATION_PATH ]; then
  if [ $DEFAULT_INSTALLATION_MODE != 'Y' ]; then
    read -p "$LANG_COMMON_INSTALLATION_PATH: ($DEFAULT_INSTALLATION_PATH) " INSTALLATION_PATH
  fi
  if [ -z $INSTALLATION_PATH ]; then
    INSTALLATION_PATH=$DEFAULT_INSTALLATION_PATH
  fi
fi

for((i = 0, len = ${#APPLICATIONS[*]}; i < len; i++))
do
  source "$CSD/applications/${APPLICATIONS[$i]}.sh"
done

# Go to tmp directory
cd $CSD/tmp

# Install
if [ $DEFAULT_INSTALLATION_MODE == 'Y' ]; then
  echo $LANG_DEFAULT_INSTALLATION_MODE
fi
if [ $BASIC_SETUP == 'Y' ]; then
  if [ -n "$HOSTNAME" ]; then
    set -x
    hostnamectl set-hostname $HOSTNAME
    set +x
  fi
  if [ -n "$TIMEOUT" ]; then
    set -x
    echo "TMOUT=$TIMEOUT" > /etc/profile.d/tmout.sh
    set +x
  fi
  if [ -n "$USERNAME" ]; then
    set -x
    useradd $USERNAME
    # chcon -Rt httpd_sys_rw_content_t /home/$USERNAME
    set +x
  fi
{'fraction_non_alphanumeric': 0.1420299727520436, 'fraction_numerical': 0.004768392370572207, 'mean_word_length': 3.472962680883473, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '1809241', 'n_tokens_mistral': 2501, 'n_tokens_neox': 2393, 'n_words': 566}