<commit_before>#!/bin/bash

function installDependencies()
{
    runAptGetUpdate

    installPackage 'build-essential'
    installPackage 'libpcre3-dev'
    installPackage 'libssl-dev'
}

function install()
{
    # Clean Up

    rm -rf "${nginxInstallFolder}"
    mkdir -p "${nginxInstallFolder}"

    # Install

    local currentPath="$(pwd)"
    local tempFolder="$(getTemporaryFolder)"

    unzipRemoteFile "${nginxDownloadURL}" "${tempFolder}"
    cd "${tempFolder}"
    "${tempFolder}/configure" --user="${nginxUID}" --group="${nginxGID}" --prefix="${nginxInstallFolder}" --with-http_ssl_module
    make
    make install
    rm -rf "${tempFolder}"
    cd "${currentPath}"

    # Config Server

    local serverConfigData=('__PORT__' "${nginxPort}")

    createFileFromTemplate  "${appPath}/../files/conf/nginx.conf" "${nginxInstallFolder}/conf/nginx.conf" "${serverConfigData[@]}"

    # Config Profile

    local profileConfigData=('__INSTALL_FOLDER__' "${nginxInstallFolder}")

    createFileFromTemplate "${appPath}/../files/profile/nginx.sh" '/etc/profile.d/nginx.sh' "${profileConfigData[@]}"

    # Config Upstart

    local upstartConfigData=('__INSTALL_FOLDER__' "${nginxInstallFolder}")

    createFileFromTemplate "${appPath}/../files/upstart/nginx.conf" "/etc/init/${nginxServiceName}.conf" "${upstartConfigData[@]}"

    # Start

    addSystemUser "${nginxUID}" "${nginxGID}"
    chown -R "${nginxUID}":"${nginxGID}" "${nginxInstallFolder}"
    start "${nginxServiceName}"
}

function main()
{
    appPath="$(cd "$(dirname "${0}")" && pwd)"

    source "${appPath}/../../../lib/util.bash" || exit 1
    source "${appPath}/../attributes/default.bash" || exit 1

    checkRequireDistributor

    header 'INSTALLING NGINX'

    checkRequireRootUser
    checkRequirePort "${nginxPort}"

    installDependencies
    install
    installCleanUp

    displayOpenPorts
}

main "${@}"<commit_msg>show version<commit_after>#!/bin/bash

function installDependencies()
{
    runAptGetUpdate

    installPackage 'build-essential'
    installPackage 'libpcre3-dev'
    installPackage 'libssl-dev'
}

function install()
{
    # Clean Up

    rm -rf "${nginxInstallFolder}"
    mkdir -p "${nginxInstallFolder}"

    # Install

    local currentPath="$(pwd)"
    local tempFolder="$(getTemporaryFolder)"

    unzipRemoteFile "${nginxDownloadURL}" "${tempFolder}"
    cd "${tempFolder}"
    "${tempFolder}/configure" --user="${nginxUID}" --group="${nginxGID}" --prefix="${nginxInstallFolder}" --with-http_ssl_module
    make
    make install
    rm -rf "${tempFolder}"
    cd "${currentPath}"

    # Config Server

    local serverConfigData=('__PORT__' "${nginxPort}")

    createFileFromTemplate  "${appPath}/../files/conf/nginx.conf" "${nginxInstallFolder}/conf/nginx.conf" "${serverConfigData[@]}"

    # Config Profile

    local profileConfigData=('__INSTALL_FOLDER__' "${nginxInstallFolder}")

    createFileFromTemplate "${appPath}/../files/profile/nginx.sh" '/etc/profile.d/nginx.sh' "${profileConfigData[@]}"

    # Config Upstart

    local upstartConfigData=('__INSTALL_FOLDER__' "${nginxInstallFolder}")

    createFileFromTemplate "${appPath}/../files/upstart/nginx.conf" "/etc/init/${nginxServiceName}.conf" "${upstartConfigData[@]}"

    # Start

    addSystemUser "${nginxUID}" "${nginxGID}"
    chown -R "${nginxUID}":"${nginxGID}" "${nginxInstallFolder}"
    start "${nginxServiceName}"

    # Display Version

    info "\n$("${nginxInstallFolder}/sbin/nginx" --version)"
}

function main()
{
    appPath="$(cd "$(dirname "${0}")" && pwd)"

    source "${appPath}/../../../lib/util.bash" || exit 1
    source "${appPath}/../attributes/default.bash" || exit 1

    checkRequireDistributor

    header 'INSTALLING NGINX'

    checkRequireRootUser
    checkRequirePort "${nginxPort}"

    installDependencies
    install
    installCleanUp

    displayOpenPorts
}

main "${@}"
{'fraction_non_alphanumeric': 0.17172236503856042, 'fraction_numerical': 0.002056555269922879, 'mean_word_length': 3.9440914866581958, 'pattern_counts': {'":': 2, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3729585', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1190, 'n_words': 218}