<commit_before>#!/bin/sh
# GitLab pre-install script

DEST_DIR=<%= install_dir %>

skip_migrations_file=/etc/gitlab/skip-auto-migrations

main() {
  if [ -e "${skip_migrations_file}" ] ; then
    # The user wants us to do nothing
    return
  fi

  notify "Backing up GitLab SQL database (excluding Git repositories, uploads)"
  if ! ${DEST_DIR}/bin/gitlab-rake gitlab:backup:create SKIP=repositories,uploads ; then
    notify
    notify "Backup failed! If you want to skip this backup, run the following command and"
    notify "try again:"
    notify
    notify "  sudo touch ${skip_migrations_file}"
    notify
    exit 1
  fi

  notify "Backing up GitLab CI SQL database"
  if ! ${DEST_DIR}/bin/gitlab-ci-rake backup:create ; then
    notify
    notify "Backup failed! If you want to skip this backup, run the following command and"
    notify "try again:"
    notify
    notify "  sudo touch ${skip_migrations_file}"
    notify
    exit 1
  fi
}

notify() {
  echo "gitlab preinstall: $1"
}

if [ -n "${GITLAB_DEBUG}" ] ; then
  notify "debug: arguments: $@"
fi

case "$1" in
  2)<commit_msg>Check if unicorn dir exists as a sign which service is installed.<commit_after>#!/bin/sh
# GitLab pre-install script

DEST_DIR=<%= install_dir %>

skip_migrations_file=/etc/gitlab/skip-auto-migrations

main() {
  if [ -e "${skip_migrations_file}" ] ; then
    # The user wants us to do nothing
    return
  fi

  notify "Backing up GitLab SQL database (excluding Git repositories, uploads)"
  if [ -d ${DEST_DIR}/service/unicorn ] ; then
    if ! ${DEST_DIR}/bin/gitlab-rake gitlab:backup:create SKIP=repositories,uploads ; then
      notify
      notify "Backup failed! If you want to skip this backup, run the following command and"
      notify "try again:"
      notify
      notify "  sudo touch ${skip_migrations_file}"
      notify
      exit 1
    fi
  fi

  notify "Backing up GitLab CI SQL database"
  if [ -d ${DEST_DIR}/service/ci-unicorn ] ; then
    if ! ${DEST_DIR}/bin/gitlab-ci-rake backup:create ; then
      notify
      notify "Backup failed! If you want to skip this backup, run the following command and"
      notify "try again:"
      notify
      notify "  sudo touch ${skip_migrations_file}"
      notify
      exit 1
    fi
  fi
}

notify() {
  echo "gitlab preinstall: $1"
}

if [ -n "${GITLAB_DEBUG}" ] ; then
  notify "debug: arguments: $@"
fi

case "$1" in
  2)
{'fraction_non_alphanumeric': 0.10464629552113855, 'fraction_numerical': 0.004185851820845542, 'mean_word_length': 3.0924657534246576, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7140286', 'n_tokens_mistral': 814, 'n_tokens_neox': 785, 'n_words': 260}