diff --git a/README.adoc b/README.adoc index 6b44e7a..9f61be5 100644 --- a/README.adoc +++ b/README.adoc @@ -5,9 +5,9 @@ The script executes the steps documented in link:http://docs.opennms.org/opennms The script is tested with: -* Ubuntu 16.04 (Xenial Xerus) LTS 64bit -* Debian 8 (Jessie) 64bit -* CentOS 7.1 64bit +* Ubuntu 18.04 (Bionic Beaver) 64bit +* Debian 9 (Stretch) 64bit +* CentOS 7.5.1804 64bit == Usage diff --git a/bootstrap-debian-dev.sh b/bootstrap-debian-dev.sh index e5f5167..1b81cca 100644 --- a/bootstrap-debian-dev.sh +++ b/bootstrap-debian-dev.sh @@ -32,6 +32,37 @@ usage() { echo "-h: Show this help" } +checkRequirements() { + # Test if system is supported + uname -a | grep -E "${REQUIRED_SYSTEMS}" 1>/dev/null 2>>"${ERROR_LOG}" + if [ ! "${?}" -eq 0 ]; then + echo "" + echo "This is system is not a supported Ubuntu or Debian system." + echo "" + exit ${E_UNSUPPORTED} + fi + + # Setting Postgres User and changing configuration files require + # root permissions. + if [ "${USER}" != "${REQUIRED_USER}" ]; then + echo "" + echo "This script requires root permissions to be executed." + echo "" + exit ${E_BASH} + fi + + # The sudo command is required to switch to postgres user for DB setup + echo -n "Path to sudo: ">>${ERROR_LOG} + which sudo 1>>${ERROR_LOG} 2>>${ERROR_LOG} + if [ ! "${?}" -eq "0" ]; then + echo "" + echo "This script requires sudo which could not be found." + echo "Please install the sudo package." + echo "" + exit ${E_BASH} + fi +} + showDisclaimer() { echo "" echo "This script installs OpenNMS on your system. It will" @@ -66,24 +97,6 @@ showDisclaimer() { shopt -u nocasematch } -# Test if system is supported -uname -a | grep -E ${REQUIRED_SYSTEMS} 1>/dev/null 2>>${ERROR_LOG} -if [ ! ${?} -eq 0 ]; then - echo "" - echo "This is system is not a supported Ubuntu or Debian system." - echo "" - exit ${E_UNSUPPORTED} -fi - -# Setting Postgres User and changing configuration files require -# root permissions. -if [ "${USER}" != "${REQUIRED_USER}" ]; then - echo "" - echo "This script requires root permissions to be executed." - echo "" - exit ${E_BASH} -fi - #### # The -r option is optional and allows to set the release of OpenNMS. # The -m option allows to overwrite the package repository server. @@ -206,6 +219,8 @@ cloneCode() { # Execute setup procedure clear +showDisclaimer +checkRequirements installOnmsRepo installOracleJdk installPostgres diff --git a/bootstrap-debian.sh b/bootstrap-debian.sh index 311becb..86ed9be 100644 --- a/bootstrap-debian.sh +++ b/bootstrap-debian.sh @@ -32,6 +32,37 @@ usage() { echo "-h: Show this help" } +checkRequirements() { + # Test if system is supported + uname -a | grep -E "${REQUIRED_SYSTEMS}" 1>/dev/null 2>>"${ERROR_LOG}" + if [ ! "${?}" -eq 0 ]; then + echo "" + echo "This is system is not a supported Ubuntu or Debian system." + echo "" + exit ${E_UNSUPPORTED} + fi + + # Setting Postgres User and changing configuration files require + # root permissions. + if [ "${USER}" != "${REQUIRED_USER}" ]; then + echo "" + echo "This script requires root permissions to be executed." + echo "" + exit ${E_BASH} + fi + + # The sudo command is required to switch to postgres user for DB setup + echo -n "Path to sudo: ">>${ERROR_LOG} + which sudo 1>>${ERROR_LOG} 2>>${ERROR_LOG} + if [ ! "${?}" -eq "0" ]; then + echo "" + echo "This script requires sudo which could not be found." + echo "Please install the sudo package." + echo "" + exit ${E_BASH} + fi +} + showDisclaimer() { echo "" echo "This script installs OpenNMS on your system. It will" @@ -77,24 +108,6 @@ showDisclaimer() { shopt -u nocasematch } -# Test if system is supported -uname -a | grep -E "${REQUIRED_SYSTEMS}" 1>/dev/null 2>>"${ERROR_LOG}" -if [ ! "${?}" -eq 0 ]; then - echo "" - echo "This is system is not a supported Ubuntu or Debian system." - echo "" - exit ${E_UNSUPPORTED} -fi - -# Setting Postgres User and changing configuration files require -# root permissions. -if [ "${USER}" != "${REQUIRED_USER}" ]; then - echo "" - echo "This script requires root permissions to be executed." - echo "" - exit ${E_BASH} -fi - #### # The -r option is optional and allows to set the release of OpenNMS. # The -m option allows to overwrite the package repository server. @@ -258,6 +271,7 @@ lockdownDbUser() { # Execute setup procedure clear +checkRequirements showDisclaimer installOnmsRepo installPostgres diff --git a/bootstrap-yum.sh b/bootstrap-yum.sh index ca09b2f..c8ead82 100644 --- a/bootstrap-yum.sh +++ b/bootstrap-yum.sh @@ -33,6 +33,37 @@ usage() { echo "-h: Show this help" } +checkRequirements() { + # Test if system is supported + cat ${RELEASE_FILE} | grep -E ${REQUIRED_SYSTEMS} 1>/dev/null 2>>${ERROR_LOG} + if [ ! ${?} -eq 0 ]; then + echo "" + echo "This is system is not a supported CentOS or Red Hat." + echo "" + exit ${E_UNSUPPORTED} + fi + + # Setting Postgres User and changing configuration files require + # root permissions. + if [ "${USER}" != "${REQUIRED_USER}" ]; then + echo "" + echo "This script requires root permissions to be executed." + echo "" + exit ${E_BASH} + fi + + # The sudo command is required to switch to postgres user for DB setup + echo -n "Path to sudo: ">>${ERROR_LOG} + which sudo 1>>${ERROR_LOG} 2>>${ERROR_LOG} + if [ ! "${?}" -eq "0" ]; then + echo "" + echo "This script requires sudo which could not be found." + echo "Please install the sudo package." + echo "" + exit ${E_BASH} + fi +} + showDisclaimer() { echo "" echo "This script installs OpenNMS on your system. It will" @@ -78,24 +109,6 @@ showDisclaimer() { shopt -u nocasematch } -# Test if system is supported -cat ${RELEASE_FILE} | grep -E ${REQUIRED_SYSTEMS} 1>/dev/null 2>>${ERROR_LOG} -if [ ! ${?} -eq 0 ]; then - echo "" - echo "This is system is not a supported CentOS or Red Hat." - echo "" - exit ${E_UNSUPPORTED} -fi - -# Setting Postgres User and changing configuration files require -# root permissions. -if [ "${USER}" != "${REQUIRED_USER}" ]; then - echo "" - echo "This script requires root permissions to be executed." - echo "" - exit ${E_BASH} -fi - #### # The -r option is optional and allows to set the release of OpenNMS. # The -m option allows to overwrite the package repository server. @@ -247,6 +260,7 @@ restartOnms() { # Execute setup procedure clear +checkRequirements showDisclaimer installOnmsRepo installOnmsApp