<commit_before>#!/bin/bash
#!/usr/local/bin/bash

clean=0
build=0
while [ x"$1" != x ] ; do
    case $1 in
        clean) clean=1
            shift
            rm /etc/init/
           continue;;
        build) build=1
            shift
            continue;;
        *)  echo "argument '$1' ignored"
            shift
            continue;;
    esac
done


echo "------------------------ Settings ---------------------------------------"

##
## In case you configured install-ns.sh to use a different
## ns_install_dir, adjust it here to the same directory
##
ns_install_dir=/usr/local/ns


#
# The following names are CVS tag mostly relevant for checkouts from
# CVS, but as well for naming the service.
#
#   HEAD:
#     the newest version, often not intended to be runable
#
#   oacs-x-y:
#      the newest version of the oacs-x-y branch
#      (not necessarily "released")
#
#   oacs-x-y-compat:
#      the newest "released" version of the oacs-x-y branch
#
#   openacs-x-y-z-final:
#      the version of the packages at the time OpenACS x.y.z was
#      released (similar to a tar file produced at the time of
#      a release of the main OpenACS packages).
#
# For tar releases, one should

oacs_version=5-9
#oacs_version=HEAD

#oacs_core_tag=HEAD
#oacs_core_tag=oacs-5-9
oacs_core_tag=openacs-5-9-compat
#oacs_core_tag=openacs-5-9-0-final

#oacs_packages_tag=HEAD
#oacs_packages_tag=oacs-5-9
oacs_packages_tag=openacs-5-9-compat
#oacs_packages_tag=openacs-5-9-0-final

#
# One can obtain the OpenACS sources either via tar file or via
# cvs. When oacs_tar_release is non-empty, it is used and the CVS tags
# are ignored.
#
oacs_tar_release=openacs-5.9.0
oacs_tar_release_url=http://openacs.org/projects/openacs/download/download/${oacs_tar_release}.tar.gz?revision_id=4869825
#oacs_tar_release_url=



pg_user=postgres
pg_dir=/usr

if [ "${oacs_version}" = "HEAD" ] ; then
    oacs_service=oacs-${oacs_version}
else
    oacs_service=${oacs_version}
fi


source ${ns_install_dir}/lib/nsConfig.sh
if [ "$ns_user" = "" ] ; then
    echo "could not determine ns_user from  ${ns_install_dir}/lib/nsConfig.sh"
    exit
fi
echo "Loaded definitions from ${ns_install_dir}/lib/nsConfig.sh"


oacs_dir=/var/www/${oacs_service}
db_name=${oacs_service}
install_dotlrn=0

#
# inherited/derived variables
#
#build_dir=/usr/local/src
#with_postgres=1
#ns_src_dir=/usr/local/src/naviserver-4.99.6

oacs_user=${ns_user}
oacs_group=${ns_group}

if [ ! "${version_ns}" = "HEAD" ] ; then
    ns_src_dir=${build_dir}/naviserver-${version_ns}
else
    ns_src_dir=${build_dir}/naviserver
fi
modules_src_dir=${build_dir}/modules

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8


# Settings can be overridden by adding settings to custom-local-settings.sh
hostname=localhost
ip_address=127.0.0.1
httpport=8000
httpsport=8443
# Depending on if OpenACS code originates from cvs or github
oacs_core_dir=openacs-core
config_tcl_dir=${oacs_dir}


current_dir="$(realpath .)"
custom_settings="${current_dir}/custom-local-settings.sh"
echo "Checking for existence of '${custom_settings}'"
if [[ -e "${custom_settings}" ]]; then
    source ${custom_settings}
    echo "Loaded local definitions from ${custom_settings}"
    custom_p=1
else
    custom_p=0
fi


echo "
Installation Script for OpenACS

This script configures a (pre-installed) PostgreSQL installation for
OpenACS, installs OpenACS core, basic OpenACS packages (and xowiki, 
xowf and optionally dotlrn on CVS based installs; tar-based installs
can install these packages via 'install from repository'). The script 
generates a config file and startup files (for Ubuntu and Fedora Core). 
The script  assumes a pre-existing NaviServer installation, 
installed e.g. via install-ns.sh

To override settings in this script, create a file 
called 'custom-local-settings.sh' in this directory, 
and set variables using standard bash syntax like this:
  example_dir=/var/mtp

Tested on Ubuntu 12.04, 13.04, 14.04 Fedora Core 18, and CentOS 7, FreeBSD 10
(c) 2013 <NAME>

LICENSE    This program comes with ABSOLUTELY NO WARRANTY;
           This is free software, and you are welcome to redistribute it under certain conditions;
           For details see http://www.gnu.org/licenses.

SETTINGS   OpenACS version              ${oacs_core_tag}
           OpenACS packages             ${oacs_packages_tag}
           OpenACS tar release URL      ${oacs_tar_release_url}
           OpenACS directory            ${oacs_dir}
           OpenACS service              ${oacs_service}
           OpenACS config dir           ${config_tcl_dir}
           OpenACS user                 ${oacs_user}
           OpenACS group                ${oacs_group}
           With PostgresSQL             ${with_postgres}
           PostgresSQL user             ${pg_user}
           PostgreSQL directory         ${pg_dir}
           Database name                ${db_name}
           Naviserver install directory ${ns_install_dir}
           Naviserver src directory     ${ns_src_dir}
           Naviserver modules directory ${modules_src_dir}
           Naviserver user              ${ns_user}
           Naviserver group             ${ns_group}
           Install DotLRN               ${install_dotlrn}
           Make command                 ${make}
           Type command                 ${type}
           values from custom source    ${custom_p}
           hostname                     ${hostname}
           ip_address                   ${ip_address}
           httpport                     ${httpport}
           httpsport                    ${httpsport}
"

if [ "${build}" = "0" ] ; then
    echo "
WARNING    Check Settings AND Cleanup section before running this script!
           If you know what you're doing then call the call the script as
              bash $0 build
"
exit
fi

echo "------------------------ Cleanup -----------------------------------------"
# First we clean up<commit_msg>fixes typo Naviserver s/b NaviServer<commit_after>#!/bin/bash
#!/usr/local/bin/bash

clean=0
build=0
while [ x"$1" != x ] ; do
    case $1 in
        clean) clean=1
            shift
            rm /etc/init/
           continue;;
        build) build=1
            shift
            continue;;
        *)  echo "argument '$1' ignored"
            shift
            continue;;
    esac
done


echo "------------------------ Settings ---------------------------------------"

##
## In case you configured install-ns.sh to use a different
## ns_install_dir, adjust it here to the same directory
##
ns_install_dir=/usr/local/ns


#
# The following names are CVS tag mostly relevant for checkouts from
# CVS, but as well for naming the service.
#
#   HEAD:
#     the newest version, often not intended to be runable
#
#   oacs-x-y:
#      the newest version of the oacs-x-y branch
#      (not necessarily "released")
#
#   oacs-x-y-compat:
#      the newest "released" version of the oacs-x-y branch
#
#   openacs-x-y-z-final:
#      the version of the packages at the time OpenACS x.y.z was
#      released (similar to a tar file produced at the time of
#      a release of the main OpenACS packages).
#
# For tar releases, one should

oacs_version=5-9
#oacs_version=HEAD

#oacs_core_tag=HEAD
#oacs_core_tag=oacs-5-9
oacs_core_tag=openacs-5-9-compat
#oacs_core_tag=openacs-5-9-0-final

#oacs_packages_tag=HEAD
#oacs_packages_tag=oacs-5-9
oacs_packages_tag=openacs-5-9-compat
#oacs_packages_tag=openacs-5-9-0-final

#
# One can obtain the OpenACS sources either via tar file or via
# cvs. When oacs_tar_release is non-empty, it is used and the CVS tags
# are ignored.
#
oacs_tar_release=openacs-5.9.0
oacs_tar_release_url=http://openacs.org/projects/openacs/download/download/${oacs_tar_release}.tar.gz?revision_id=4869825
#oacs_tar_release_url=



pg_user=postgres
pg_dir=/usr

if [ "${oacs_version}" = "HEAD" ] ; then
    oacs_service=oacs-${oacs_version}
else
    oacs_service=${oacs_version}
fi


source ${ns_install_dir}/lib/nsConfig.sh
if [ "$ns_user" = "" ] ; then
    echo "could not determine ns_user from  ${ns_install_dir}/lib/nsConfig.sh"
    exit
fi
echo "Loaded definitions from ${ns_install_dir}/lib/nsConfig.sh"


oacs_dir=/var/www/${oacs_service}
db_name=${oacs_service}
install_dotlrn=0

#
# inherited/derived variables
#
#build_dir=/usr/local/src
#with_postgres=1
#ns_src_dir=/usr/local/src/naviserver-4.99.6

oacs_user=${ns_user}
oacs_group=${ns_group}

if [ ! "${version_ns}" = "HEAD" ] ; then
    ns_src_dir=${build_dir}/naviserver-${version_ns}
else
    ns_src_dir=${build_dir}/naviserver
fi
modules_src_dir=${build_dir}/modules

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8


# Settings can be overridden by adding settings to custom-local-settings.sh
hostname=localhost
ip_address=127.0.0.1
httpport=8000
httpsport=8443
# Depending on if OpenACS code originates from cvs or github
oacs_core_dir=openacs-core
config_tcl_dir=${oacs_dir}


current_dir="$(realpath .)"
custom_settings="${current_dir}/custom-local-settings.sh"
echo "Checking for existence of '${custom_settings}'"
if [[ -e "${custom_settings}" ]]; then
    source ${custom_settings}
    echo "Loaded local definitions from ${custom_settings}"
    custom_p=1
else
    custom_p=0
fi


echo "
Installation Script for OpenACS

This script configures a (pre-installed) PostgreSQL installation for
OpenACS, installs OpenACS core, basic OpenACS packages (and xowiki, 
xowf and optionally dotlrn on CVS based installs; tar-based installs
can install these packages via 'install from repository'). The script 
generates a config file and startup files (for Ubuntu and Fedora Core). 
The script  assumes a pre-existing NaviServer installation, 
installed e.g. via install-ns.sh

To override settings in this script, create a file 
called 'custom-local-settings.sh' in this directory, 
and set variables using standard bash syntax like this:
  example_dir=/var/mtp

Tested on Ubuntu 12.04, 13.04, 14.04 Fedora Core 18, and CentOS 7, FreeBSD 10
(c) 2013 <NAME>

LICENSE    This program comes with ABSOLUTELY NO WARRANTY;
           This is free software, and you are welcome to redistribute it under certain conditions;
           For details see http://www.gnu.org/licenses.

SETTINGS   OpenACS version              ${oacs_core_tag}
           OpenACS packages             ${oacs_packages_tag}
           OpenACS tar release URL      ${oacs_tar_release_url}
           OpenACS directory            ${oacs_dir}
           OpenACS service              ${oacs_service}
           OpenACS config dir           ${config_tcl_dir}
           OpenACS user                 ${oacs_user}
           OpenACS group                ${oacs_group}
           With PostgresSQL             ${with_postgres}
           PostgresSQL user             ${pg_user}
           PostgreSQL directory         ${pg_dir}
           Database name                ${db_name}
           NaviServer install directory ${ns_install_dir}
           NaviServer src directory     ${ns_src_dir}
           NaviServer modules directory ${modules_src_dir}
           NaviServer user              ${ns_user}
           NaviServer group             ${ns_group}
           Install DotLRN               ${install_dotlrn}
           Make command                 ${make}
           Type command                 ${type}
           values from custom source    ${custom_p}
           hostname                     ${hostname}
           ip_address                   ${ip_address}
           httpport                     ${httpport}
           httpsport                    ${httpsport}
"

if [ "${build}" = "0" ] ; then
    echo "
WARNING    Check Settings AND Cleanup section before running this script!
           If you know what you're doing then call the call the script as
              bash $0 build
"
exit
fi

echo "------------------------ Cleanup -----------------------------------------"
# First we clean up
{'fraction_non_alphanumeric': 0.11019306972430655, 'fraction_numerical': 0.01348958772447517, 'mean_word_length': 2.4462521789657177, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1596592', 'n_tokens_mistral': 3795, 'n_tokens_neox': 3612, 'n_words': 1051}