<commit_before>#!/bin/sh
#
# Perform necessary gitlab setup steps
# after package is installed.
#
DEST_DIR=<%= install_dir %>
EXTERNAL_URL="http://gitlab.example.com"

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

tanuki_ascii()
{
  echo "       *.                  *."
  echo "      ***                 ***"
  echo "     *****               *****"
  echo "    .******             *******"
  echo "    ********            ********"
  echo "   ,,,,,,,,,***********,,,,,,,,,"
  echo "  ,,,,,,,,,,,*********,,,,,,,,,,,"
  echo "  .,,,,,,,,,,,*******,,,,,,,,,,,,"
  echo "      ,,,,,,,,,*****,,,,,,,,,."
  echo "         ,,,,,,,****,,,,,,"
  echo "            .,,,***,,,,"
  echo "                ,*,."
}

gitlab_ascii()
{
  echo "     _______ __  __          __"
  echo "    / ____(_) /_/ /   ____ _/ /_"
  echo "   / / __/ / __/ /   / __ \`/ __ \\"
  echo "  / /_/ / / /_/ /___/ /_/ / /_/ /"
  echo "  \____/_/\__/_____/\__,_/_.___/"
}

print_banner()
{
    # Check if we have colors enabled
    tput=$(which tput)
    if [ -n "$tput" ]; then
      ncolors=$($tput colors)
      if [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
        RED="$(tput setaf 1)"
        YELLOW="$(tput setaf 3)"
        NOCOLOR="$(tput sgr0)"
      else
        RED=""
        YELLOW=""
        NOCOLOR=""
      fi
    fi

    echo ""
    echo "$YELLOW"
    echo "$(tanuki_ascii)"
    echo "$RED"
    echo "$(gitlab_ascii)"
    echo "$NOCOLOR"
    echo ""
}

create_config_template()
{
  # Create a minimal gitlab.rb template if /etc/gitlab/gitlab.rb does not exist.
  if ! [ -e /etc/gitlab/gitlab.rb ] ; then
    mkdir -p /etc/gitlab
    cp "${DEST_DIR}/etc/gitlab.rb.template" /etc/gitlab/gitlab.rb
    sed -i 's!GENERATED_EXTERNAL_URL!'$EXTERNAL_URL'!g' /etc/gitlab/gitlab.rb
    chmod 600 /etc/gitlab/gitlab.rb
  else
    EXTERNAL_URL=$(awk '/^external_url/ { print $2 }' /etc/gitlab/gitlab.rb | tr -d "'\"")
  fi
}

fix_directory_permissions()
{
  if [ -x /usr/bin/dpkg-query ] ; then
    # We are in the land of .deb packages. We should fix package directory owners
    # because of the faulty 7.2.0 / 7.2.1 .deb packages.
    /usr/bin/dpkg-query -L gitlab-ce gitlab-ee 2>/dev/null | while read f ; do
    if [ -d "$f" ] ; then
      # This directory may have been created when installing omnibus-gitlab
      # 7.2.0 / 7.2.1, so it could have the wrong owner.
      chown root:root "$f"
    fi
  done
fi
}

print_welcome()
{
  print_banner
  notify "Thank you for installing GitLab!"
  notify "To configure and start GitLab, RUN THE FOLLOWING COMMAND:"
  echo ""
  echo "sudo gitlab-ctl reconfigure"
  echo ""
  notify "GitLab should be reachable at ${EXTERNAL_URL}"
  notify "Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file"
  notify "And running reconfigure again."
  notify
  notify "For a comprehensive list of configuration options please see the Omnibus GitLab readme"
  notify "https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md"
  notify
}

print_upgrade_info()
{
  local version=$(cat /var/opt/gitlab/postgresql/data/PG_VERSION 2>/dev/null)
  local new_version=$(awk '$1 == "postgresql_new" {print $2}' /opt/gitlab/version-manifest.txt)
  if [ -n "${new_version}" -a "${new_version#*$version}" = "${new_version}" ]
  then
    echo
    notify "GitLab now ships with a newer version of PostgreSQL (${new_version}), and will be used"
    notify "as the default in the next major relase. To upgrade, RUN THE FOLLOWING COMMANDS:"
    echo
    echo "sudo gitlab-ctl pg-upgrade"
    echo
    notify "For more details, please see:"
    notify "https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server"
    notify
  fi
}<commit_msg>Add notification for new PostgreSQL version<commit_after>#!/bin/sh
#
# Perform necessary gitlab setup steps
# after package is installed.
#
DEST_DIR=<%= install_dir %>
EXTERNAL_URL="http://gitlab.example.com"

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

tanuki_ascii()
{
  echo "       *.                  *."
  echo "      ***                 ***"
  echo "     *****               *****"
  echo "    .******             *******"
  echo "    ********            ********"
  echo "   ,,,,,,,,,***********,,,,,,,,,"
  echo "  ,,,,,,,,,,,*********,,,,,,,,,,,"
  echo "  .,,,,,,,,,,,*******,,,,,,,,,,,,"
  echo "      ,,,,,,,,,*****,,,,,,,,,."
  echo "         ,,,,,,,****,,,,,,"
  echo "            .,,,***,,,,"
  echo "                ,*,."
}

gitlab_ascii()
{
  echo "     _______ __  __          __"
  echo "    / ____(_) /_/ /   ____ _/ /_"
  echo "   / / __/ / __/ /   / __ \`/ __ \\"
  echo "  / /_/ / / /_/ /___/ /_/ / /_/ /"
  echo "  \____/_/\__/_____/\__,_/_.___/"
}

print_banner()
{
    # Check if we have colors enabled
    tput=$(which tput)
    if [ -n "$tput" ]; then
      ncolors=$($tput colors)
      if [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
        RED="$(tput setaf 1)"
        YELLOW="$(tput setaf 3)"
        NOCOLOR="$(tput sgr0)"
      else
        RED=""
        YELLOW=""
        NOCOLOR=""
      fi
    fi

    echo ""
    echo "$YELLOW"
    echo "$(tanuki_ascii)"
    echo "$RED"
    echo "$(gitlab_ascii)"
    echo "$NOCOLOR"
    echo ""
}

create_config_template()
{
  # Create a minimal gitlab.rb template if /etc/gitlab/gitlab.rb does not exist.
  if ! [ -e /etc/gitlab/gitlab.rb ] ; then
    mkdir -p /etc/gitlab
    cp "${DEST_DIR}/etc/gitlab.rb.template" /etc/gitlab/gitlab.rb
    sed -i 's!GENERATED_EXTERNAL_URL!'$EXTERNAL_URL'!g' /etc/gitlab/gitlab.rb
    chmod 600 /etc/gitlab/gitlab.rb
  else
    EXTERNAL_URL=$(awk '/^external_url/ { print $2 }' /etc/gitlab/gitlab.rb | tr -d "'\"")
  fi
}

fix_directory_permissions()
{
  if [ -x /usr/bin/dpkg-query ] ; then
    # We are in the land of .deb packages. We should fix package directory owners
    # because of the faulty 7.2.0 / 7.2.1 .deb packages.
    /usr/bin/dpkg-query -L gitlab-ce gitlab-ee 2>/dev/null | while read f ; do
    if [ -d "$f" ] ; then
      # This directory may have been created when installing omnibus-gitlab
      # 7.2.0 / 7.2.1, so it could have the wrong owner.
      chown root:root "$f"
    fi
  done
fi
}

print_welcome()
{
  print_banner
  notify "Thank you for installing GitLab!"
  notify "To configure and start GitLab, RUN THE FOLLOWING COMMAND:"
  echo ""
  echo "sudo gitlab-ctl reconfigure"
  echo ""
  notify "GitLab should be reachable at ${EXTERNAL_URL}"
  notify "Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file"
  notify "And running reconfigure again."
  notify
  notify "For a comprehensive list of configuration options please see the Omnibus GitLab readme"
  notify "https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md"
  notify
}

print_upgrade_info()
{
  local version=$(cat /var/opt/gitlab/postgresql/data/PG_VERSION 2>/dev/null || true)
  local new_version=$(awk '$1 == "postgresql_new" {print $2}' /opt/gitlab/version-manifest.txt)
  if [ -n "${new_version}" -a "${new_version#*$version}" = "${new_version}" ]
  then
    echo
    notify "GitLab now ships with a newer version of PostgreSQL (${new_version}), and will be used"
    notify "as the default in the next major relase. To upgrade, RUN THE FOLLOWING COMMANDS:"
    echo
    echo "sudo gitlab-ctl pg-upgrade"
    echo
    notify "For more details, please see:"
    notify "https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server"
    notify
  fi
}
{'fraction_non_alphanumeric': 0.1837065012139196, 'fraction_numerical': 0.006743997841920691, 'mean_word_length': 2.4233610341643583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '924739', 'n_tokens_mistral': 2702, 'n_tokens_neox': 2584, 'n_words': 638}