kopia lustrzana https://github.com/jprochazka/adsb-receiver
Continued work on ADS-B Portal setup scripts.
rodzic
fdd18f5cad
commit
77bfb37850
|
@ -67,6 +67,11 @@ EOF
|
|||
|
||||
## CHANGE SETTINGS IN CONFIGURATION FILES
|
||||
|
||||
# Use sed to locate the "KEY" then replace the "VALUE", in a YAML "FILE"
|
||||
function ChangeYaml {
|
||||
sudo sed -i -e 's/^\('"$1"': \).*$/\1'"$2"'/' $3
|
||||
}
|
||||
|
||||
# Use sed to locate the "SWITCH" then replace the "VALUE", the portion after the equals sign, in the specified "FILE"
|
||||
# This function will replace the value assigned to a specific switch contained within a file
|
||||
function ChangeSwitch {
|
||||
|
@ -98,3 +103,54 @@ function UncommentConfig {
|
|||
sudo sed -i "/#${1}*/ s/#*//" $2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
## LOGGING
|
||||
|
||||
# Logs the "PROJECT NAME" to the console
|
||||
function LogProjectName {
|
||||
echo -e "${DISPLAY_PROJECT_NAME} ${1}${DISPLAY_DEFAULT}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Logs a "HEADING" to the console
|
||||
function LogHeading {
|
||||
echo ""
|
||||
echo -e "${DISPLAY_HEADING} ${1}${DISPLAY_DEFAULT}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Logs a "MESSAGE" to the console
|
||||
function LogMessage {
|
||||
echo -e "${DISPLAY_MESSAGE} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs an alert "HEADING" to the console
|
||||
function LogAlertHeading {
|
||||
echo -e "${DISPLAY_ALERT_HEADING} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs an alert "MESSAGE" to the console
|
||||
function LogAlertMessage {
|
||||
echo -e "${DISPLAY_ALERT_MESSAGE} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs an title "HEADING" to the console
|
||||
function LogTitleHeading {
|
||||
echo -e "${DISPLAY_TITLE_HEADING} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs an title "MESSAGE" to the console
|
||||
function LogTitleMessage {
|
||||
echo -e "${DISPLAY_TITLE_MESSAGE} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs a warning "HEADING" to the console
|
||||
function LogWarningHeading {
|
||||
echo -e "${DISPLAY_WARNING_HEADING} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs a warning "MESSAGE" to the console
|
||||
function LogWarningMessage {
|
||||
echo -e "${DISPLAY_WARNING_MESSAGE} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#####################################################################################
|
||||
# ADS-B RECEIVER #
|
||||
#####################################################################################
|
||||
# #
|
||||
# This script is not meant to be executed directly. #
|
||||
# Instead execute install.sh to begin the installation process. #
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# #
|
||||
# Copyright (c) 2015-2024 Joseph A. Prochazka #
|
||||
# #
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy #
|
||||
# of this software and associated documentation files (the "Software"), to deal #
|
||||
# in the Software without restriction, including without limitation the rights #
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
|
||||
# copies of the Software, and to permit persons to whom the Software is #
|
||||
# furnished to do so, subject to the following conditions: #
|
||||
# #
|
||||
# The above copyright notice and this permission notice shall be included in all #
|
||||
# copies or substantial portions of the Software. #
|
||||
# #
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
|
||||
# SOFTWARE. #
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
## VARIABLES
|
||||
|
||||
PORTAL_BUILD_DIRECTORY="${RECEIVER_BUILD_DIRECTORY}/portal"
|
||||
PORTAL_PYTHON_DIRECTORY="${PORTAL_BUILD_DIRECTORY}/python"
|
||||
|
||||
DATABASEENGINE=${ADSB_DATABASEENGINE}
|
||||
DATABASEHOSTNAME=${ADSB_DATABASEHOSTNAME}
|
||||
DATABASEUSER=${ADSB_DATABASEUSER}
|
||||
DATABASEPASSWORD1=${ADSB_DATABASEPASSWORD1}
|
||||
DATABASENAME=${ADSB_DATABASENAME}
|
||||
|
||||
## SETUP FLIGHT LOGGING
|
||||
|
||||
echo -e ""
|
||||
echo -e "\e[95m Setting up core advanced portal features...\e[97m"
|
||||
echo -e ""
|
||||
|
||||
case ${DATABASEENGINE} in
|
||||
"MySQL")
|
||||
echo -e "\e[94m Creating the flight Python configuration file for MySQL...\e[97m"
|
||||
tee ${PORTAL_PYTHON_DIRECTORY}/config.json > /dev/null <<EOF
|
||||
{
|
||||
"database":{"type":"mysql",
|
||||
"host":"${DATABASEHOSTNAME}",
|
||||
"user":"${DATABASEUSER}",
|
||||
"passwd":"${DATABASEPASSWORD1}",
|
||||
"db":"${DATABASENAME}"}
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
"SQLite")
|
||||
echo -e "\e[94m Creating the Python configuration file for SQLite...\e[97m"
|
||||
tee ${PORTAL_PYTHON_DIRECTORY}/config.json > /dev/null <<EOF
|
||||
{
|
||||
"database":{"type":"sqlite",
|
||||
"host":"${DATABASEHOSTNAME}",
|
||||
"user":"${DATABASEUSER}",
|
||||
"passwd":"${DATABASEPASSWORD1}",
|
||||
"db":"${DATABASENAME}"}
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
echo -e "\e[94m No core setup required...\e[97m"
|
||||
;;
|
||||
esac
|
|
@ -1,190 +0,0 @@
|
|||
## FUNCTIONS
|
||||
|
||||
cancel_setup() {
|
||||
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
|
||||
echo -e " Setup has been halted at the request of the user."
|
||||
echo -e ""
|
||||
echo -e "\e[93m ------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m ADS-B Receiver Project Portal setup halted.\e[39m"
|
||||
echo -e ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
prompt_for_input() {
|
||||
if [[ -z $title ]]; then title = "Password"
|
||||
if [[ -z $message ]]; then title = "Enter the password."
|
||||
while [[ -z $input ]]; do
|
||||
input = $(whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "${title}" \
|
||||
--inputbox "${message}" \
|
||||
8 78 "${default_value}")
|
||||
exit_status = $?
|
||||
if [ $exit_status = 0 ]; then
|
||||
cancel_setup()
|
||||
fi
|
||||
title ="${title} (REQUIRED)"
|
||||
done
|
||||
}
|
||||
|
||||
prompt_for_password() {
|
||||
if [[ -z $title ]]; then title = "Password"
|
||||
if [[ -z $message ]]; then title = "Enter the password."
|
||||
while [[ -z $password ]]; do
|
||||
password = $(whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "${title}" \
|
||||
--passwordbox "${message}" \
|
||||
8 78)
|
||||
exit_status = $?
|
||||
if [ $exit_status = 0 ]; then
|
||||
cancel_setup()
|
||||
fi
|
||||
title ="${title} (REQUIRED)"
|
||||
done
|
||||
}
|
||||
|
||||
prompt_for_username(){
|
||||
if [[ -z $title ]]; then title = "Username"
|
||||
if [[ -z $message ]]; then title = "Enter the username."
|
||||
while [[ -z $user ]]; do
|
||||
user = $(whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "${title}" \
|
||||
--inputbox "${message}" \
|
||||
8 78)
|
||||
exit_status = $?
|
||||
if [ $exit_status = 0 ]; then
|
||||
cancel_setup()
|
||||
fi
|
||||
title = "${title} (REQUIRED)"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
## MYSQL
|
||||
|
||||
setup_mysql() {
|
||||
# Gather information
|
||||
mysql_host = "localhost"
|
||||
database_exists = false
|
||||
if [[ "${PORTAL_LOCAL_MYSQL_SERVER}" = "false" ]]
|
||||
mysql_host = $(whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "MySQL Database Server Hostname" \
|
||||
--nocancel \
|
||||
--inputbox "\nWhat is the remote MySQL server's hostname?" \
|
||||
10 60)
|
||||
|
||||
database_exists = $(whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "Does MySQL Database Exist" \
|
||||
--yesno "Does the database already exist on the host?" \
|
||||
7 80)
|
||||
if
|
||||
|
||||
# Check for and install if needed all MariaDB packages needed to host the database locally
|
||||
if [[ "${mysql_host}" = "localhost" || "${mysql_host}" = "127.0.0.1" ]]
|
||||
CheckPackage mariadb-server
|
||||
CheckPackage mariadb-client
|
||||
fi
|
||||
|
||||
whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "MySQL Secure Installation" \
|
||||
--msgbox "The mysql_secure_installation will now be executed. Follow the on screen instructions to complete the MariaDB (MySQL) server setup." \
|
||||
12 78
|
||||
|
||||
echo -e "\e[94m Executing the mysql_secure_installation script...\e[97m"
|
||||
sudo mysql_secure_installation
|
||||
echo ""
|
||||
|
||||
# Get MySQL administrative user credentials
|
||||
if [[ "${mysql_host}" = "localhost" || "${database_exists}" = "false" ]] ; then
|
||||
whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "Create Remote MySQL Database" \
|
||||
--msgbox "This script will attempt to create the MySQL database for you.\nPlease supply credentials for the root user or another account granted permission to create a new database." \
|
||||
9 78
|
||||
|
||||
title = "MySQL Administrative Username"
|
||||
message = "Enter the MySQL administrator username"
|
||||
default_value = "root"
|
||||
prompt_for_input()
|
||||
admin_user = $input
|
||||
|
||||
title = "MySQL Administrator Password"
|
||||
message = "Enter the MySQL password for username ${admin_user}"
|
||||
prompt_for_password()
|
||||
admin_password_one = $password
|
||||
|
||||
title = "Confirm The MySQL Administrator Password"
|
||||
message = "Reenter the MySQL password for username ${admin_user}"
|
||||
prompt_for_password()
|
||||
admin_password_two = $password
|
||||
|
||||
while [[ ! $admin_password_one = $admin_password_two ]] ; do
|
||||
admin_password_one=""
|
||||
admin_password_two=""
|
||||
|
||||
title = "MySQL Administrator Passwords Did Not Match"
|
||||
message = "Enter the MySQL password for username ${admin_user}"
|
||||
prompt_for_password()
|
||||
admin_password_one = $password
|
||||
|
||||
title = "Confirm The MySQL Administrator Password"
|
||||
message = "Reenter the MySQL password for username ${admin_user}"
|
||||
prompt_for_password()
|
||||
admin_password_two = $password
|
||||
done
|
||||
fi
|
||||
|
||||
# Get MySQL database name and database user credentials
|
||||
title = "MySQL Database Name"
|
||||
message = "Enter the name of the database to be used"
|
||||
if [[ "${database_exists}" = "false" ]] ; then
|
||||
message = "Enter the name of the database to be created"
|
||||
fi
|
||||
default_value = "adsbportal"
|
||||
prompt_for_input()
|
||||
database_name = $input
|
||||
|
||||
title = "MySQL Database Username"
|
||||
message = "Enter the username associated with the database ${database_name}"
|
||||
if [[ "${database_exists}" = "false" ]] ; then
|
||||
message = "Enter the username to be added to the database ${database_name}"
|
||||
fi
|
||||
default_value = "adsbuser"
|
||||
prompt_for_input()
|
||||
database_username = $input
|
||||
|
||||
title = "Database Password"
|
||||
message = "Enter the password assigned to the username ${database_username}"
|
||||
prompt_for_password()
|
||||
database_password_one = $password
|
||||
|
||||
title = "Confirm The Database Password"
|
||||
message = "Reenter the password assigned to username ${database_username}"
|
||||
prompt_for_password()
|
||||
database_password_two = $password
|
||||
|
||||
while [[ ! $database_password_one = $database_password_two ]] ; do
|
||||
database_password_one=""
|
||||
database_password_two=""
|
||||
|
||||
title = "Database Username Passwords Did Not Match"
|
||||
message = "Enter the password assigned to the username ${database_username}"
|
||||
prompt_for_password()
|
||||
database_password_one = $password
|
||||
|
||||
title = "Confirm The Database Username Password"
|
||||
message = "Reenter the password assigned to the username ${database_username}"
|
||||
prompt_for_password()
|
||||
database_password_two = $password
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
## POSTGRESQL
|
||||
|
||||
## SQLITE
|
|
@ -0,0 +1,279 @@
|
|||
## FUNCTIONS
|
||||
|
||||
cancel_setup() {
|
||||
LogAlertHeading "INSTALLATION HALTED"
|
||||
|
||||
LogAlertMessage "Setup has been halted due to error reported by the mysql.sh script"
|
||||
if [[ "${cancel_initiated_by_user}" == "true" ]]
|
||||
LogAlertMessage "Setup has been halted at the request of the user"
|
||||
fi
|
||||
echo ""
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
LogTitleHeading "ADS-B Portal setup has been halted"
|
||||
exit 1
|
||||
}
|
||||
|
||||
prompt_for_input() {
|
||||
if [[ -z $title ]]; then title = "Input"
|
||||
if [[ -z $message ]]; then title = "Enter input."
|
||||
while [[ -z $input ]]; do
|
||||
input = $(whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "${title}" \
|
||||
--inputbox "${message}" \
|
||||
8 78 "${default_value}")
|
||||
exit_status = $?
|
||||
if [ $exit_status = 0 ]; then
|
||||
cancel_initiated_by_user = "true"
|
||||
cancel_setup()
|
||||
fi
|
||||
title ="${title} (REQUIRED)"
|
||||
done
|
||||
default_value = ""
|
||||
}
|
||||
|
||||
prompt_for_password() {
|
||||
if [[ -z $title ]]; then title = "Password"
|
||||
if [[ -z $message ]]; then title = "Enter the password."
|
||||
while [[ -z $password ]]; do
|
||||
password = $(whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "${title}" \
|
||||
--passwordbox "${message}" \
|
||||
8 78)
|
||||
exit_status = $?
|
||||
if [ $exit_status = 0 ]; then
|
||||
cancel_initiated_by_user = "true"
|
||||
cancel_setup()
|
||||
fi
|
||||
title ="${title} (REQUIRED)"
|
||||
done
|
||||
}
|
||||
|
||||
## MYSQL SETUP
|
||||
|
||||
# Start here
|
||||
mysql_setup() {
|
||||
setup_mariadb()
|
||||
get_mysql_admin_credentials()
|
||||
get_mysql_database_credentials()
|
||||
create_mysql_database()
|
||||
create_mysql_user()
|
||||
}
|
||||
|
||||
# Setup MariaDB server if the database is going to be hosted locally
|
||||
setup_mariadb() {
|
||||
LogHeading "MariaDB Setup"
|
||||
if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "ADS-B Portal Database Location" --defaultyes --yesno "Will the ADS-B Portal database be hosted locally?" 10 60; then
|
||||
LogHeading "Local MariaDB server setup will be skipped"
|
||||
|
||||
LogMessage "Requesting the remote MySQL server's hostname"
|
||||
title = "MySQL Database Server Hostname"
|
||||
message = "What is the remote MySQL server's hostname?"
|
||||
default_value = ""
|
||||
prompt_for_input()
|
||||
database_host = $input
|
||||
LogMessage "Setting MySQL server hostname to ${database_host}"
|
||||
|
||||
return
|
||||
fi
|
||||
LogHeading "Begining MariaDB server setup"
|
||||
|
||||
LogMessage "Installing MariaDB server if not already installed"
|
||||
CheckPackage mariadb-server
|
||||
|
||||
whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "Excecuting mysql_secure_installation" \
|
||||
--msgbox "The mysql_secure_installation will now be executed.\nFollow the on screen instructions to complete the MariaDB (MySQL) server setup." \
|
||||
12 78
|
||||
|
||||
LogMessage "Executing the mysql_secure_installation script"
|
||||
echo ""
|
||||
sudo mysql_secure_installation
|
||||
echo ""
|
||||
|
||||
database_host = "localhost"
|
||||
LogMessage "Setting MySQL server hostname to ${database_host}"
|
||||
|
||||
LogMessage "Local MariaDB server setup complete"
|
||||
}
|
||||
|
||||
# Request MySQL administrator credentials
|
||||
get_mysql_admin_credentials() {
|
||||
LogHeading "Requesting MySQL administrative credentials"
|
||||
|
||||
admin_user = ""
|
||||
admin_password_one = ""
|
||||
admin_password_two = ""
|
||||
|
||||
LogMessage "Requesting MySQL administrative user"
|
||||
title = "MySQL Administrative User"
|
||||
message = "Enter the MySQL administrator user"
|
||||
default_value = "root"
|
||||
prompt_for_input()
|
||||
admin_user = $input
|
||||
|
||||
LogMessage "Requesting MySQL administrative password from the user"
|
||||
title = "MySQL Administrator Password"
|
||||
message = "Enter the MySQL password for user ${admin_user}"
|
||||
prompt_for_password()
|
||||
admin_password_one = $password
|
||||
|
||||
title = "Confirm The MySQL Administrator Password"
|
||||
message = "Reenter the MySQL password for user ${admin_user}"
|
||||
prompt_for_password()
|
||||
admin_password_two = $password
|
||||
|
||||
while [[ ! $admin_password_one = $admin_password_two ]] ; do
|
||||
admin_password_one=""
|
||||
admin_password_two=""
|
||||
|
||||
title = "MySQL Administrator Passwords Did Not Match"
|
||||
message = "Enter the MySQL password for user ${admin_user}"
|
||||
prompt_for_password()
|
||||
admin_password_one = $password
|
||||
|
||||
title = "Confirm The MySQL Administrator Password"
|
||||
message = "Reenter the MySQL password for user ${admin_user}"
|
||||
prompt_for_password()
|
||||
admin_password_two = $password
|
||||
done
|
||||
|
||||
LogMessage "Installing MariaDB client if not already installed"
|
||||
CheckPackage mariadb-client
|
||||
|
||||
LogMessage "Attempting to log into the MySQL server using admininstrative credentials"
|
||||
while ! sudo mysql -u $admin_user -p $admin_password_one -h $mysql_host -e ";" ; do
|
||||
LogMessage "Unable to log into the MySQL server using admininstrative credentials"
|
||||
whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "Unable To Log Into MySQL Server" \
|
||||
--msgbox "Unable to log into the MySQL server using the supplied credentials.\nYou will now be prompted to reenter the administrative user credentials." \
|
||||
12 78
|
||||
|
||||
get_mysql_admin_credentials()
|
||||
done
|
||||
LogMessage "Successfully logged into the MySQL server using admininstrative credentials"
|
||||
}
|
||||
|
||||
# Request MySQL database credentials
|
||||
get_mysql_database_credentials() {
|
||||
LogHeading "Requesting MySQL database credentials"
|
||||
|
||||
LogMessage "Requesting MySQL database user"
|
||||
title = "MySQL Database Username"
|
||||
message = "Enter the username associated with the database ${database_name}"
|
||||
if [[ "${database_exists}" = "false" ]] ; then
|
||||
message = "Enter the username to be added to the database ${database_name}"
|
||||
fi
|
||||
default_value = "adsbuser"
|
||||
prompt_for_input()
|
||||
database_username = $input
|
||||
|
||||
LogMessage "Requesting MySQL database password from the user"
|
||||
title = "Database Password"
|
||||
message = "Enter the password assigned to the username ${database_username}"
|
||||
prompt_for_password()
|
||||
database_password_one = $password
|
||||
|
||||
title = "Confirm The Database Password"
|
||||
message = "Reenter the password assigned to username ${database_username}"
|
||||
prompt_for_password()
|
||||
database_password_two = $password
|
||||
|
||||
while [[ ! $database_password_one = $database_password_two ]] ; do
|
||||
database_password_one=""
|
||||
database_password_two=""
|
||||
|
||||
title = "Database Username Passwords Did Not Match"
|
||||
message = "Enter the password assigned to the username ${database_username}"
|
||||
prompt_for_password()
|
||||
database_password_one = $password
|
||||
|
||||
title = "Confirm The Database Username Password"
|
||||
message = "Reenter the password assigned to the username ${database_username}"
|
||||
prompt_for_password()
|
||||
database_password_two = $password
|
||||
done
|
||||
}
|
||||
|
||||
# Create the MySQL database if present
|
||||
create_mysql_database() {
|
||||
LogHeading "Create the ADS-B Portal MySQL database if it does not exist"
|
||||
|
||||
LogMessage "Asking the user for the name of the database to use"
|
||||
title = "MySQL Database Name"
|
||||
message = "Enter the name of the database to use"
|
||||
default_value = "adsbportal"
|
||||
prompt_for_input()
|
||||
database_name = $input
|
||||
|
||||
LogMessage "Checking if MySQL database ${database_name} exists"
|
||||
if mysql -u $admin_user -p $admin_password_one -h $mysql_host -e "USE ${database_name}"; then
|
||||
LogMessage "Database ${database_name} exists"
|
||||
return
|
||||
fi
|
||||
|
||||
LogMessage "Creating MySQL database ${database_name}"
|
||||
if ! mysql -u $admin_user -p $admin_password_one -h $mysql_host -e "CREATE DATABASE USE ${database_name}"; then
|
||||
LogMessage "Creation of MySQL database ${database_name} failed"
|
||||
cancel_setup()
|
||||
fi
|
||||
LogMessage "MySQL database ${database_name} was created successfully"
|
||||
}
|
||||
|
||||
# Create the MySQL user if not present
|
||||
create_mysql_user() {
|
||||
LogHeading "Create the ADS-B Portal MySQL database user if it does not exist"
|
||||
|
||||
LogMessage "Checking if MySQL database user ${database_user} exists"
|
||||
if mysql -u $admin_user -p $admin_password_one -h $mysql_host -e "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = '${database_user}')"; then
|
||||
LogMessage "MySQL database user ${database_user} exists"
|
||||
|
||||
# TODO: CHECK PRIVILEGES
|
||||
LogMessage "Checking MySQL permissions for database user ${database_user} on MySQL database name ${database_name}"
|
||||
user_grants = `mysql $admin_user -p $admin_password_one -h $mysql_host -e "show grants for '${user}'@'localhost';"`
|
||||
if [[ $user_grants != *'GRANT ALL PRIVILEGES ON `adsbportal`.*'* ]]; then
|
||||
LogWarningMessage "Privileges may not be set properly for user ${database_user} on host ${mysql_host}"
|
||||
fi
|
||||
if [[ $user_grants == *'`adsbuser`@`localhost`'* ]]; then
|
||||
LogWarningMessage "Privileges are set only for localhost for user ${database_user} on host ${mysql_host}"
|
||||
fi
|
||||
|
||||
Return
|
||||
fi
|
||||
|
||||
LogMessage "Creating MySQL database user ${database_user}"
|
||||
query = "CREATE USER '${database_user}'@'%' IDENTIFIED BY '${database_password}'"
|
||||
if [[ "${mysql_host}" == "localhost" ]]
|
||||
query = "CREATE USER '${database_user}'@'${$mysql_host}' IDENTIFIED BY '${database_password}'"
|
||||
fi
|
||||
if ! mysql -u $admin_user -p $admin_password_one -h $mysql_host -e $query; then
|
||||
LogMessage "Creation of MySQL database user ${database_name} failed"
|
||||
cancel_setup()
|
||||
fi
|
||||
LogMessage "MySQL database user ${database_user} was created successfully"
|
||||
|
||||
LogMessage "Setting permission for database user ${database_user} on database ${database_name}"
|
||||
query = "GRANT ALL PRIVILEGES ON ${database_name}.* TO '${database_user}'@'%'"
|
||||
if [[ "${mysql_host}" == "localhost" ]]
|
||||
query = "GRANT ALL PRIVILEGES ON ${database_name}.* TO '${database_user}'@'localhost'"
|
||||
fi
|
||||
if ! mysql -u $admin_user -p $admin_password_one -h $mysql_host -e $query; then
|
||||
LogMessage "Failed to set permission on MySQL database ${database_name} for MySQL user ${database_user}"
|
||||
cancel_setup()
|
||||
fi
|
||||
LogMessage "Permissions set on MySQL database ${database_name} for MySQL user ${database_user}"
|
||||
|
||||
LogMessage "Flushing priviledges on the MySQL database server ${mysql_host}"
|
||||
if ! mysql -u $admin_user -p $admin_password_one -h $mysql_host -e "FLUSH PRIVILEGES"; then
|
||||
LogMessage "Failed to flushing priviledges on the MySQL database server ${mysql_host}"
|
||||
cancel_setup()
|
||||
fi
|
||||
LogMessage "Successfully flushed priviledges on the MySQL database server ${mysql_host}"
|
||||
}
|
||||
|
||||
modify_api_config() {
|
||||
|
||||
}
|
|
@ -20,7 +20,6 @@ echo -e ""
|
|||
echo -e "\e[95m Setting up collectd performance graphs...\e[97m"
|
||||
echo -e ""
|
||||
|
||||
|
||||
CheckPackage collectd-core
|
||||
CheckPackage rrdtool
|
||||
|
||||
|
|
|
@ -9,526 +9,91 @@ source ${RECEIVER_BASH_DIRECTORY}/functions.sh
|
|||
## BEGIN SETUP
|
||||
|
||||
clear
|
||||
echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}"
|
||||
echo -e ""
|
||||
echo -e "\e[92m Setting up the ADS-B Receiver Project Portal..."
|
||||
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
|
||||
echo -e ""
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "ADS-B ADS-B Receiver Project Portal Setup" --yesno "The ADS-B ADS-B Receiver Project Portal adds a web accessable portal to your receiver. The portal contains allows you to view performance graphs, system information, and live maps containing the current aircraft being tracked.\n\nBy enabling the portal's advanced features you can also view historical data on flight that have been seen in the past as well as view more detailed information on each of these aircraft.\n\nDo you wish to continue with the ADS-B Receiver Project Portal setup?" 23 78
|
||||
CONTINUE_SETUP=$?
|
||||
if [[ "${CONTINUE_SETUP}" = 1 ]] ; then
|
||||
# Setup has been halted by the user.
|
||||
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
|
||||
echo -e " Setup has been halted at the request of the user."
|
||||
echo -e ""
|
||||
echo -e "\e[93m ------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m ADS-B Receiver Project Portal setup halted.\e[39m"
|
||||
echo -e ""
|
||||
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
|
||||
read -p "Press enter to continue..." CONTINUE
|
||||
fi
|
||||
LogProjectName ${RECEIVER_PROJECT_TITLE}
|
||||
LogTitleHeading "Setting up the ADS-B Portal"
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
echo ""
|
||||
|
||||
if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "ADS-B Portal Setup" --yesno "The ADS-B Portal allows you to view performance graphs, system information, and live maps containing the current aircraft being tracked.\n\nBy enabling the portal's advanced features you can also view historical data on flight that has been seen in the past as well as view more detailed information on each of these aircraft.\n\nDo you wish to continue setting up the ADS-B Portal?" 23 78; then
|
||||
LogAlertHeading "INSTALLATION HALTED"
|
||||
LogAlertMessage "Setup has been halted at the request of the user"
|
||||
echo ""
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
LogTitleHeading "ADS-B Receiver Portal setup halted"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
## GATHER INSTALLATION INFORMATION FROM THE USER
|
||||
|
||||
# TODO: CHECK IF PORTAL IS INSTALLED
|
||||
# Check if there is already an existing portal installation.
|
||||
portal_installed="false"
|
||||
# -----------------------------------------------------------------
|
||||
# TODO: CHECK IF THE ADS-B PORTAL BACKEND AND FRONTEND IS INSTALLED
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
portal_installed = "false"
|
||||
if [[ -f "" ]] ; then
|
||||
portal_installed="true"
|
||||
portal_installed = "true"
|
||||
fi
|
||||
|
||||
if [[ "${portal_installed}" = "true" ]] ; then
|
||||
case "${DATABASEENGINE}" in
|
||||
"mysql") DATABASEENGINE="MySQL" ;;
|
||||
"postgresql") DATABASEENGINE="PostgreSQL" ;;
|
||||
"sqlite") DATABASEENGINE="SQLite" ;;
|
||||
esac
|
||||
database_host_name=`grep 'db_host' ${LIGHTTPD_DOCUMENT_ROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
|
||||
DATABASEUSER=`grep 'db_username' ${LIGHTTPD_DOCUMENT_ROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
|
||||
DATABASEPASSWORD1=`grep 'db_password' ${LIGHTTPD_DOCUMENT_ROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
|
||||
DATABASENAME=`grep 'db_database' ${LIGHTTPD_DOCUMENT_ROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
|
||||
fi
|
||||
|
||||
## EXECUTE THE PROPER ADS-B PORTAL DATABASE CREATION SCRIPT
|
||||
|
||||
else
|
||||
# Ask if advanced features should be enabled.
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "ADS-B Receiver Portal Selection" --defaultno --yesno "NOTE THAT THE ADVANCED FEATURES ARE STILL IN DEVELOPMENT AT THIS TIME\nADVANCED FEATURES SHOULD ONLY BE ENABLED BY DEVELOPERS AND TESTERS ONLY\n\nBy enabling advanced features the portal will log all flights seen as well as the path of the flight. This data is stored in either a MySQL or SQLite database. This will result in a lot more data being stored on your devices hard drive. Keep this and your devices hardware capabilities in mind before selecting to enable these features.\n\nENABLING ADVANCED FEATURES ON DEVICES USING SD CARDS CAN SHORTEN THE LIFE OF THE SD CARD IMMENSELY\n\nDo you wish to enable the portal advanced features?" 19 78
|
||||
RESPONSE=$?
|
||||
case ${RESPONSE} in
|
||||
0) ADVANCED="true" ;;
|
||||
1) ADVANCED="false" ;;
|
||||
esac
|
||||
if [[ "${portal_installed}" = "false" ]]
|
||||
LogHeading "Performing database setup"
|
||||
|
||||
if [[ "${ADVANCED}" = "true" ]] ; then
|
||||
# Ask which type of database to use.
|
||||
DATABASEENGINE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Choose Database Type" --nocancel --menu "\nChoose which type of database to use." 11 80 2 "MySQL" "" "SQLite" "" 3>&1 1>&2 2>&3)
|
||||
LogMessage "Asking the user which type of database engine should be used"
|
||||
database_engine = $(whiptail \
|
||||
--backtitle "${RECEIVER_PROJECT_TITLE}" \
|
||||
--title "Choose Database Engine" \
|
||||
--nocancel \
|
||||
--menu "Choose which database engine to use" \
|
||||
11 80 2 \
|
||||
"MySQL" "" "PostgreSQL" "" "SQLite" "")
|
||||
LogMessage "Database engine set to ${database_engine}"
|
||||
|
||||
if [[ "${DATABASEENGINE}" = "MySQL" ]] ; then
|
||||
# Ask if the database server will be installed locally.
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "MySQL Database Location" --yesno "Will the database be hosted locally on this device?" 7 80
|
||||
RESPONSE=$?
|
||||
case ${RESPONSE} in
|
||||
0) LOCALMYSQLSERVER="true" ;;
|
||||
1) LOCALMYSQLSERVER="false" ;;
|
||||
esac
|
||||
if [[ "${LOCALMYSQLSERVER}" = "false" ]] ; then
|
||||
# Ask for the remote MySQL servers hostname.
|
||||
database_host_name_title="MySQL Database Server Hostname"
|
||||
while [[ -z "${database_host_name}" ]] ; do
|
||||
database_host_name=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEHOSTNAME_TITLE}" --nocancel --inputbox "\nWhat is the remote MySQL server's hostname?" 10 60 3>&1 1>&2 2>&3)
|
||||
database_host_name_title="MySQL Database Server Hostname (REQUIRED)"
|
||||
done
|
||||
|
||||
# Ask if the remote MySQL database already exists.
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Does MySQL Database Exist" --yesno "Has the database already been created?" 7 80
|
||||
RESPONSE=$?
|
||||
case ${RESPONSE} in
|
||||
0) DATABASEEXISTS="true" ;;
|
||||
1) DATABASEEXISTS="false" ;;
|
||||
esac
|
||||
else
|
||||
# Install the MySQL server package now if it is not already installed.
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "MySQL Server Setup" --msgbox "This script will now check for the MySQL server package. If the MySQL server package is not installed it will be installed at this time.\n\nPlease note you may be asked questions used to secure your database server installation after the setup process." 12 78
|
||||
CheckPackage mariadb-server
|
||||
if [[ $(dpkg-query -W -f='${STATUS}' mariadb-server 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
|
||||
echo -e "\e[94m Executing the mysql_secure_installation script...\e[97m"
|
||||
sudo mysql_secure_installation
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Since this is a local installation assume the MySQL database does not already exist.
|
||||
DATABASEEXISTS="false"
|
||||
|
||||
# Since the MySQL database server will run locally assign localhost as it's hostname.
|
||||
database_host_name="localhost"
|
||||
fi
|
||||
|
||||
# Ask for the MySQL administrator credentials if the database does not already exist.
|
||||
if [[ "${LOCALMYSQLSERVER}" = "true" ]] || [[ "${DATABASEEXISTS}" = "false" ]] ; then
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Create Remote MySQL Database" --msgbox "This script can attempt to create the MySQL database for you.\nYou will now be asked for the credentials for a MySQL user who has the ability to create a database on the MySQL server." 9 78
|
||||
DATABASEADMINUSER_TITLE="MySQL Administrator User"
|
||||
while [[ -z "${DATABASEADMINUSER}" ]] ; do
|
||||
DATABASEADMINUSER=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINUSER_TITLE}" --nocancel --inputbox "\nEnter the MySQL administrator user." 8 78 "root" 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINUSER_TITLE="MySQL Administrator User (REQUIRED)"
|
||||
done
|
||||
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password"
|
||||
DATABASEADMINPASSWORD1_MESSAGE="\nEnter the password for the MySQL adminitrator user."
|
||||
while [[ -z "${DATABASEADMINPASSWORD1}" ]] ; do
|
||||
DATABASEADMINPASSWORD1=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINPASSWORD1_TITLE}" --nocancel --passwordbox "${DATABASEADMINPASSWORD1_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password (REQUIRED)"
|
||||
done
|
||||
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password"
|
||||
DATABASEADMINPASSWORD2_MESSAGE="\nConfirm the password for the MySQL adminitrator user."
|
||||
while [[ -z "${DATABASEADMINPASSWORD2}" ]] ; do
|
||||
DATABASEADMINPASSWORD2=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINPASSWORD2_TITLE}" --nocancel --passwordbox "${DATABASEADMINPASSWORD2_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password (REQUIRED)"
|
||||
done
|
||||
while [[ ! "${DATABASEADMINPASSWORD1}" = "${DATABASEADMINPASSWORD2}" ]] ; do
|
||||
DATABASEADMINPASSWORD1=""
|
||||
DATABASEADMINPASSWORD2=""
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
|
||||
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password"
|
||||
while [[ -z "${DATABASEADMINPASSWORD1}" ]] ; do
|
||||
DATABASEADMINPASSWORD1=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINPASSWORD1_TITLE}" --nocancel --passwordbox "DATABASEADMINPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password (REQUIRED)"
|
||||
done
|
||||
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password"
|
||||
while [[ -z "${DATABASEADMINPASSWORD2}" ]] ; do
|
||||
DATABASEADMINPASSWORD2=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINPASSWORD2_TITLE}" --nocancel --passwordbox "DATABASEADMINPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password (REQUIRED)"
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# Get the login information pertaining to the MySQL database itself.
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Create Remote MySQL Database" --msgbox "You will now be asked to supply the name of the database which will store the portal data as well as the login credentials for the MySQL user that has access to this database." 9 78
|
||||
|
||||
DATABASENAME_TITLE="ADS-B Receiver Portal Database Name"
|
||||
while [[ -z "${DATABASENAME}" ]] ; do
|
||||
DATABASENAME=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASENAME_TITLE}" --nocancel --inputbox "\nEnter your ADS-B Receiver Portal database name." 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASENAME_TITLE="ADS-B Receiver Portal Database Name (REQUIRED)"
|
||||
done
|
||||
DATABASEUSER_TITLE="ADS-B Receiver Portal Database User"
|
||||
while [[ -z "${DATABASEUSER}" ]] ; do
|
||||
DATABASEUSER=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEUSER_TITLE}" --nocancel --inputbox "\nEnter the user for the ADS-B Receiver Portal database." 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEUSER_TITLE="ADS-B Receiver Portal Database User (REQUIRED)"
|
||||
done
|
||||
DATABASEPASSWORD1_TITLE="ADS-B Receiver Portal Password"
|
||||
DATABASEPASSWORD1_MESSAGE="\nEnter your ADS-B Receiver Portal database password."
|
||||
while [[ -z "${DATABASEPASSWORD1}" ]] ; do
|
||||
DATABASEPASSWORD1=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEPASSWORD1_TITLE}" --nocancel --passwordbox "${DATABASEPASSWORD1_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEPASSWORD1_TITLE="ADS-B Receiver Portal Password (REQUIRED)"
|
||||
done
|
||||
DATABASEPASSWORD2_TITLE="Confirm The ADS-B Receiver Portal Password"
|
||||
DATABASEPASSWORD2_MESSAGE="\nConfirm your ADS-B Receiver Portal database password."
|
||||
while [[ -z "${DATABASEPASSWORD2}" ]] ; do
|
||||
DATABASEPASSWORD2=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEPASSWORD2_TITLE}" --nocancel --passwordbox "${DATABASEPASSWORD2_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEPASSWORD2_TITLE="Confirm The ADS-B Receiver Portal Password (REQUIRED)"
|
||||
done
|
||||
while [[ ! "${DATABASEPASSWORD1}" = "${DATABASEPASSWORD2}" ]] ; do
|
||||
DATABASEPASSWORD1=""
|
||||
DATABASEPASSWORD2=""
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
|
||||
DATABASEPASSWORD1_TITLE="ADS-B Receiver Portal Password"
|
||||
while [[ -z "${DATABASEPASSWORD1}" ]] ; do
|
||||
DATABASEPASSWORD1=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEPASSWORD1_TITLE}" --nocancel --passwordbox "${DATABASEPASSWORD1_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEPASSWORD1_TITLE="ADS-B Receiver Portal Password (REQUIRED)"
|
||||
done
|
||||
DATABASEPASSWORD2_TITLE="Confirm The ADS-B Receiver Portal Password"
|
||||
while [[ -z "${DATABASEPASSWORD2}" ]] ; do
|
||||
DATABASEPASSWORD2=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEPASSWORD2_TITLE}" --nocancel --passwordbox "${DATABASEPASSWORD2_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEPASSWORD2_TITLE="Confirm The ADS-B Receiver Portal Password (REQUIRED)"
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
## CHECK FOR PREREQUISITE PACKAGES
|
||||
|
||||
DISTRO_PHP_VERSION="5"
|
||||
case $RECEIVER_OS_DISTRIBUTION in
|
||||
ubuntu)
|
||||
DISTRO_PHP_VERSION=""
|
||||
;;
|
||||
debian)
|
||||
if [[ $RECEIVER_OS_CODE_NAME = "bookworm" ]]; then DISTRO_PHP_VERSION="8.2"; fi
|
||||
if [[ $RECEIVER_OS_CODE_NAME = "bullseye" ]]; then DISTRO_PHP_VERSION="7.4"; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Install PHP.
|
||||
CheckPackage php${DISTRO_PHP_VERSION}-cgi
|
||||
if (( $(echo "${DISTRO_PHP_VERSION} < 8" | bc -l) )); then
|
||||
CheckPackage php${DISTRO_PHP_VERSION}-json
|
||||
fi
|
||||
|
||||
# Performance graph dependencies.
|
||||
CheckPackage collectd-core
|
||||
CheckPackage rrdtool
|
||||
|
||||
# Portal dependencies.
|
||||
if [ "$RECEIVER_MTA" == "POSTFIX" ] || [ -z "$RECEIVER_MTA" ]; then
|
||||
CheckPackage postfix
|
||||
fi
|
||||
|
||||
CheckPackage libpython3-stdlib
|
||||
|
||||
# Install packages needed for advanced portal setups.
|
||||
if [[ "${ADVANCED}" = "true" ]] ; then
|
||||
CheckPackage python3-pyinotify
|
||||
CheckPackage python3-apt
|
||||
case "${DATABASEENGINE}" in
|
||||
"MySQL")
|
||||
CheckPackage mariadb-client
|
||||
CheckPackage python3-mysqldb
|
||||
CheckPackage php${DISTRO_PHP_VERSION}-mysql
|
||||
;;
|
||||
"SQLite")
|
||||
CheckPackage sqlite3
|
||||
if [ `bc -l <<< "$DISTRO_PHP_VERSION >= 7.0"` -eq 1 ]; then
|
||||
CheckPackage php${DISTRO_PHP_VERSION}-sqlite3
|
||||
else
|
||||
CheckPackage php${DISTRO_PHP_VERSION}-sqlite
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
if [ ! $DISTRO_PHP_VERSION == "5" ]; then
|
||||
CheckPackage php${DISTRO_PHP_VERSION}-xml
|
||||
fi
|
||||
fi
|
||||
|
||||
# Reload Lighttpd after installing the prerequisite packages.
|
||||
echo -e "\e[94m Reloading Lighttpd...\e[97m"
|
||||
sudo service lighttpd force-reload
|
||||
echo ""
|
||||
|
||||
## SETUP THE PORTAL WEBSITE
|
||||
|
||||
echo -e "\e[95m Setting up the web portal...\e[97m"
|
||||
echo -e ""
|
||||
|
||||
# If this is an existing Lite installation being upgraded backup the XML data files.
|
||||
if [[ "${portal_installed}" = "true" ]] && [[ "${ADVANCED}" = "false" ]] ; then
|
||||
echo -e "\e[94m Backing up the file ${LIGHTTPD_DOCUMENT_ROOT}/data/administrators.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/administrators.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/administrators.backup.xml
|
||||
echo -e "\e[94m Backing up the file ${LIGHTTPD_DOCUMENT_ROOT}/data/blogPosts.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/blogPosts.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/blogPosts.backup.xml
|
||||
echo -e "\e[94m Backing up the file ${LIGHTTPD_DOCUMENT_ROOT}/data/flightNotifications.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/flightNotifications.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/flightNotifications.backup.xml
|
||||
echo -e "\e[94m Backing up the file ${LIGHTTPD_DOCUMENT_ROOT}/data/settings.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/settings.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/settings.backup.xml
|
||||
echo -e "\e[94m Backing up the file ${LIGHTTPD_DOCUMENT_ROOT}/data/links.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/links.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/links.backup.xml
|
||||
echo -e "\e[94m Backing up the file ${LIGHTTPD_DOCUMENT_ROOT}/data/notifications.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/notifications.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/notifications.backup.xml
|
||||
fi
|
||||
|
||||
if [ -f ${LIGHTTPD_DOCUMENT_ROOT}/index.lighttpd.html ]; then
|
||||
echo -e "\e[94m Removing default Lighttpd index file from document root...\e[97m"
|
||||
sudo rm ${LIGHTTPD_DOCUMENT_ROOT}/index.lighttpd.html
|
||||
fi
|
||||
|
||||
echo -e "\e[94m Placing portal files in Lighttpd's root directory...\e[97m"
|
||||
sudo cp -R ${RECEIVER_BUILD_DIRECTORY}/portal/html/* ${LIGHTTPD_DOCUMENT_ROOT}
|
||||
|
||||
# If this is an existing installation being upgraded restore the original XML data files.
|
||||
if [[ "${portal_installed}" = "true" ]] && [[ "${ADVANCED}" = "false" ]] ; then
|
||||
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPD_DOCUMENT_ROOT}/data/administrators.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/administrators.backup.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/administrators.xml
|
||||
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPD_DOCUMENT_ROOT}/data/blogPosts.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/blogPosts.backup.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/blogPosts.xml
|
||||
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPD_DOCUMENT_ROOT}/data/flightNotifications.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/flightNotifications.backup.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/flightNotifications.xml
|
||||
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPD_DOCUMENT_ROOT}/data/settings.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/settings.backup.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/settings.xml
|
||||
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPD_DOCUMENT_ROOT}/data/links.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/links.backup.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/links.xml
|
||||
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPD_DOCUMENT_ROOT}/data/notifications.xml...\e[97m"
|
||||
sudo mv ${LIGHTTPD_DOCUMENT_ROOT}/data/notifications.backup.xml ${LIGHTTPD_DOCUMENT_ROOT}/data/notifications.xml
|
||||
fi
|
||||
|
||||
# Set the proper permissions on certain portal directories.
|
||||
echo -e "\e[94m Making the directory ${LIGHTTPD_DOCUMENT_ROOT}/graphs/ writable...\e[97m"
|
||||
sudo chmod 777 ${LIGHTTPD_DOCUMENT_ROOT}/graphs/
|
||||
echo -e "\e[94m Making the directory ${LIGHTTPD_DOCUMENT_ROOT}/classes/ writable...\e[97m"
|
||||
sudo chmod 777 ${LIGHTTPD_DOCUMENT_ROOT}/classes/
|
||||
echo -e "\e[94m Making the directory ${LIGHTTPD_DOCUMENT_ROOT}/data/ writable...\e[97m"
|
||||
sudo chmod 777 ${LIGHTTPD_DOCUMENT_ROOT}/data/
|
||||
echo -e "\e[94m Making the files contained within the directory ${LIGHTTPD_DOCUMENT_ROOT}/data/ writable...\e[97m"
|
||||
sudo chmod 666 ${LIGHTTPD_DOCUMENT_ROOT}/data/*
|
||||
|
||||
# Check if dump978 was setup.
|
||||
echo -e "\e[94m Checking if dump978 was set up...\e[97m"
|
||||
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
|
||||
# Check if a heywhatsthat.com range file exists in the dump1090 HTML folder.
|
||||
echo -e "\e[94m Checking for the file upintheair.json in the dump1090 HTML folder...\e[97m"
|
||||
if [[ -f "/usr/share/dump1090-mutability/html/upintheair.json" ]] || [[ -f "/usr/share/dump1090-fa/html/upintheair.json" ]] ; then
|
||||
echo -e "\e[94m Copying the file upintheair.json from the dump1090 HTML folder to the dump978 HTML folder...\e[97m"
|
||||
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
|
||||
sudo cp /usr/share/dump1090-mutability/html/upintheair.json ${LIGHTTPD_DOCUMENT_ROOT}/dump978/
|
||||
fi
|
||||
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
|
||||
sudo cp /usr/share/dump1090-fa/html/upintheair.json ${LIGHTTPD_DOCUMENT_ROOT}/dump978/
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add to the Lighttpd configuration.
|
||||
echo -e "\e[94m Adding the Lighttpd portal configuration file...\e[97m"
|
||||
if [[ -f "/etc/lighttpd/conf-available/87-adsb-portal.conf" ]] ; then
|
||||
sudo rm -f /etc/lighttpd/conf-available/87-adsb-portal.conf
|
||||
fi
|
||||
sudo touch /etc/lighttpd/conf-available/87-adsb-portal.conf
|
||||
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
|
||||
sudo tee -a /etc/lighttpd/conf-available/87-adsb-portal.conf > /dev/null <<EOF
|
||||
# Add dump1090 as an alias to the dump1090-fa HTML folder.
|
||||
alias.url += (
|
||||
"/dump1090/data/" => "/run/dump1090-fa/",
|
||||
"/dump1090/" => "/usr/share/skyaware/html/"
|
||||
)
|
||||
# Redirect the slash-less dump1090 URL
|
||||
url.redirect += (
|
||||
"^/dump1090$" => "/dump1090/"
|
||||
)
|
||||
# Add CORS header
|
||||
\$HTTP["url"] =~ "^/dump1090/data/.*\.json$" {
|
||||
setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ ! -L "/etc/lighttpd/conf-enabled/87-adsb-portal.conf" ]] ; then
|
||||
echo -e "\e[94m Enabling the Lighttpd portal configuration file...\e[97m"
|
||||
sudo ln -s /etc/lighttpd/conf-available/87-adsb-portal.conf /etc/lighttpd/conf-enabled/87-adsb-portal.conf
|
||||
fi
|
||||
|
||||
if [[ "${portal_installed}" = "false" ]] ; then
|
||||
echo -e "\e[94m Enabling the Lighttpd fastcgi-php module...\e[97m"
|
||||
echo -e ""
|
||||
sudo lighty-enable-mod fastcgi-php
|
||||
echo -e ""
|
||||
fi
|
||||
|
||||
# Reload or start Lighttpd.
|
||||
if pgrep "lighttpd" > /dev/null; then
|
||||
echo -e "\e[94m Reloading Lighttpd...\e[97m"
|
||||
sudo service lighttpd force-reload
|
||||
else
|
||||
echo -e "\e[94m Starting Lighttpd...\e[97m"
|
||||
sudo service lighttpd start
|
||||
fi
|
||||
|
||||
## SETUP THE MYSQL DATABASE
|
||||
|
||||
if [[ "${portal_installed}" = "false" ]] && [[ "${ADVANCED}" = "true" ]] && [[ "${DATABASEENGINE}" = "MySQL" ]] && [[ "${DATABASEEXISTS}" = "false" ]] ; then
|
||||
# If MariaDB is being used we will switch the plugin from unix_socket to mysql_native_password to keep things on the same page as MySQL setups.
|
||||
if [[ $(dpkg-query -W -f='${STATUS}' mariadb-server-10.1 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
|
||||
echo -e "\e[94m Switching the default MySQL plugin from unix_socket to mysql_native_password...\e[97m"
|
||||
sudo mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${database_host_name} -e "UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket';"
|
||||
echo -e "\e[94m Flushing privileges on the MySQL (MariaDB) server...\e[97m"
|
||||
sudo mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${database_host_name} -e "FLUSH PRIVILEGES;"
|
||||
echo -e "\e[94m Reloading MySQL (MariaDB)...\e[97m"
|
||||
sudo service mysql force-reload
|
||||
fi
|
||||
|
||||
# Attempt to login with the supplied MySQL administrator credentials.
|
||||
echo -e "\e[94m Attempting to log into the MySQL server using the supplied administrator credentials...\e[97m"
|
||||
while ! sudo mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${database_host_name} -e ";" ; do
|
||||
echo -e "\e[94m Unable to log into the MySQL server using the supplied administrator credentials...\e[97m"
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Create Remote MySQL Database" --msgbox "The script was not able to log into the MySQL server using the administrator credentials you supplied. You will now be asked to reenter the MySQL server administrator credentials." 9 78
|
||||
DATABASEADMINPASSWORD1=""
|
||||
DATABASEADMINPASSWORD2=""
|
||||
DATABASEADMINUSER_TITLE="MySQL Administrator User"
|
||||
while [[ -z "${DATABASEADMINUSER}" ]] ; do
|
||||
DATABASEADMINUSER=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINUSER_TITLE}" --nocancel --inputbox "\nEnter the MySQL administrator user." 8 78 "${DATABASEADMINUSER}" 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINUSER_TITLE="MySQL Administrator User (REQUIRED)"
|
||||
done
|
||||
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password"
|
||||
DATABASEADMINPASSWORD1_MESSAGE="\nEnter the password for the MySQL adminitrator user."
|
||||
while [[ -z "${DATABASEADMINPASSWORD1}" ]] ; do
|
||||
DATABASEADMINPASSWORD1=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINPASSWORD1_TITLE}" --nocancel --passwordbox "${DATABASEADMINPASSWORD1_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password (REQUIRED)"
|
||||
done
|
||||
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password"
|
||||
DATABASEADMINPASSWORD2_MESSAGE="\nConfirm the password for the MySQL adminitrator user."
|
||||
while [[ -z "${DATABASEADMINPASSWORD2}" ]] ; do
|
||||
DATABASEADMINPASSWORD2=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINPASSWORD2_TITLE}" --nocancel --passwordbox "${DATABASEADMINPASSWORD2_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password (REQUIRED)"
|
||||
done
|
||||
while [[ ! "${DATABASEADMINPASSWORD1}" = "${DATABASEADMINPASSWORD2}" ]] ; do
|
||||
DATABASEADMINPASSWORD1=""
|
||||
DATABASEADMINPASSWORD2=""
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
|
||||
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password"
|
||||
while [[ -z "${DATABASEADMINPASSWORD1}" ]] ; do
|
||||
DATABASEADMINPASSWORD1=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINPASSWORD1_TITLE}" --nocancel --passwordbox "DATABASEADMINPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password (REQUIRED)"
|
||||
done
|
||||
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password"
|
||||
while [[ -z "${DATABASEADMINPASSWORD2}" ]] ; do
|
||||
DATABASEADMINPASSWORD2=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DATABASEADMINPASSWORD2_TITLE}" --nocancel --passwordbox "DATABASEADMINPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
|
||||
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password (REQUIRED)"
|
||||
done
|
||||
done
|
||||
echo -e "\e[94m Attempting to log into the MySQL server using the new administrator credentials...\e[97m"
|
||||
done
|
||||
|
||||
# Create the database use and database using the information supplied by the user.
|
||||
echo -e "\e[94m Creating the MySQL database \"${DATABASENAME}\"...\e[97m"
|
||||
sudo mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${database_host_name} -e "CREATE DATABASE ${DATABASENAME};"
|
||||
echo -e "\e[94m Creating the MySQL user \"${DATABASEUSER}\"...\e[97m"
|
||||
|
||||
if [[ "${LOCALMYSQLSERVER}" = "false" ]] ; then
|
||||
# If the databse resides on a remote server be sure to allow the newly created user access to it remotly.
|
||||
sudo mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${database_host_name} -e "CREATE USER '${DATABASEUSER}'@'%' IDENTIFIED BY \"${DATABASEPASSWORD1}\";"
|
||||
else
|
||||
# Since this is a local database we will restrict this login to localhost logins only.
|
||||
sudo mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${database_host_name} -e "CREATE USER '${DATABASEUSER}'@'localhost' IDENTIFIED BY \"${DATABASEPASSWORD1}\";"
|
||||
fi
|
||||
echo -e "\e[94m Granting priviledges on the MySQL database \"DATABASENAME\" to the user \"${DATABASEUSER}\"...\e[97m"
|
||||
sudo mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${database_host_name} -e "GRANT ALL PRIVILEGES ON ${DATABASENAME}.* TO '${DATABASEUSER}'@'localhost';"
|
||||
echo -e "\e[94m Flushing priviledges on the MySQL database server...\e[97m"
|
||||
sudo mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${database_host_name} -e "FLUSH PRIVILEGES;"
|
||||
fi
|
||||
|
||||
## SETUP THE PERFORMANCE GRAPHS USING THE SCRIPT GRAPHS.SH
|
||||
|
||||
chmod +x ${RECEIVER_BASH_DIRECTORY}/portal/graphs.sh
|
||||
${RECEIVER_BASH_DIRECTORY}/portal/graphs.sh
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
echo -e ""
|
||||
echo -e "\e[91m THE SCRIPT GRAPHS.SH ENCOUNTERED AN ERROR"
|
||||
echo -e ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## SETUP COMMON PORTAL FEATURES
|
||||
|
||||
# Export variables needed by logging.sh.
|
||||
if [ "${DATABASEENGINE}" = "MySQL" ]; then
|
||||
export ADSB_DATABASEENGINE=${DATABASEENGINE}
|
||||
export ADSB_DATABASEHOSTNAME=${DATABASEHOSTNAME}
|
||||
export ADSB_DATABASEUSER=${DATABASEUSER}
|
||||
export ADSB_DATABASEPASSWORD1=${DATABASEPASSWORD1}
|
||||
export ADSB_DATABASENAME=${DATABASENAME}
|
||||
elif [ "${DATABASEENGINE}" = "SQLite" ]; then
|
||||
if [ -z "${DATABASENAME}" ] ; then
|
||||
if [ ! -f ${LIGHTTPD_DOCUMENT_ROOT}/data/portal.sqlite ]; then
|
||||
echo -e "\e[94m Creating an empty SQLite database file...\e[97m"
|
||||
sudo touch ${LIGHTTPD_DOCUMENT_ROOT}/data/portal.sqlite
|
||||
echo -e "\e[94m Setting write permissions on the empty SQLite database file...\e[97m"
|
||||
sudo chmod 666 ${LIGHTTPD_DOCUMENT_ROOT}/data/portal.sqlite
|
||||
fi
|
||||
DATABASENAME="${LIGHTTPD_DOCUMENT_ROOT}/data/portal.sqlite"
|
||||
fi
|
||||
export ADSB_DATABASEENGINE=${DATABASEENGINE}
|
||||
export ADSB_DATABASEHOSTNAME=""
|
||||
export ADSB_DATABASEUSER=""
|
||||
export ADSB_DATABASEPASSWORD1=""
|
||||
export ADSB_DATABASENAME=${DATABASENAME}
|
||||
else
|
||||
export ADSB_DATABASEENGINE="xml"
|
||||
export ADSB_DATABASEHOSTNAME=""
|
||||
export ADSB_DATABASEUSER=""
|
||||
export ADSB_DATABASEPASSWORD1=""
|
||||
export ADSB_DATABASENAME=""
|
||||
fi
|
||||
|
||||
# Execute the core setup script.
|
||||
chmod +x ${RECEIVER_BASH_DIRECTORY}/portal/core.sh
|
||||
${RECEIVER_BASH_DIRECTORY}/portal/core.sh
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
echo -e ""
|
||||
echo -e " \e[91m THE SCRIPT CORE.SH ENCOUNTERED AN ERROR"
|
||||
echo -e ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## SETUP ADVANCED PORTAL FEATURES
|
||||
|
||||
if [ "${ADVANCED}" = "true" ] ; then
|
||||
chmod +x ${RECEIVER_BASH_DIRECTORY}/portal/logging.sh
|
||||
${RECEIVER_BASH_DIRECTORY}/portal/logging.sh
|
||||
LogMessage "Executing the ${database_engine} database engine setup script"
|
||||
chmod +x $RECEIVER_BASH_DIRECTORY/portal/databases/${database_engine,,}.sh
|
||||
${RECEIVER_BASH_DIRECTORY}/portal/databases/${script_name,,}.sh
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
echo -e ""
|
||||
echo -e " \e[91m THE SCRIPT LOGGING.SH ENCOUNTERED AN ERROR"
|
||||
echo -e ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove exported variables that are no longer needed.
|
||||
unset ADSB_DATABASEENGINE
|
||||
unset ADSB_DATABASEHOSTNAME
|
||||
unset ADSB_DATABASEUSER
|
||||
unset ADSB_DATABASEPASSWORD1
|
||||
unset ADSB_DATABASENAME
|
||||
|
||||
## ADS-B RECEIVER PROJECT PORTAL SETUP COMPLETE
|
||||
## SETUP ADS-B PORTAL BACKEND
|
||||
|
||||
# This assigns the first IP address in the list to the $IPADDRESS variable.
|
||||
IPADDRESS=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'`
|
||||
|
||||
# Display final portal setup instructions to the user.
|
||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "ADS-B Receiver Project Portal Setup" --msgbox "NOTE THAT PORTAL SETUP IS NOT YET COMPLETE!\n\nIn order to complete the portal setup process visit the following URL in your favorite web browser.\n\nhttp://${IPADDRESS}/install/\n\nFollow the instructions and enter the requested information to complete the ADS-B Receiver Project Portal setup." 12 78
|
||||
## SETUP ADS-B PORTAL FRONTEND
|
||||
|
||||
### SETUP COMPLETE
|
||||
|
||||
# Return to the project root directory.
|
||||
echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m"
|
||||
cd ${RECEIVER_ROOT_DIRECTORY} 2>&1
|
||||
## EXECUTE THE PERFORMANCE GRAPHS SETUP SCRIPT
|
||||
LogHeading "Performing performance graphs setup"
|
||||
|
||||
echo -e ""
|
||||
echo -e "\e[93m ------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m ADS-B Receiver Project Portal setup is complete.\e[39m"
|
||||
echo -e ""
|
||||
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
|
||||
read -p "Press enter to continue..." CONTINUE
|
||||
LogMessage "Executing the performance graphs setup script"
|
||||
chmod +x ${RECEIVER_BASH_DIRECTORY}/portal/graphs.sh
|
||||
${RECEIVER_BASH_DIRECTORY}/portal/graphs.sh
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
LogAlertHeading "THE SCRIPT GRAPHS.SH ENCOUNTERED AN ERROR"
|
||||
LogAlertMessage "Setup has been halted due to error reported by the graphs.sh script"
|
||||
echo ""
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
LogTitleHeading "ADS-B Portal setup has been halted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
## SETUP COMPLETE
|
||||
|
||||
LogHeading "Performing post setup steps"
|
||||
echo ""
|
||||
|
||||
LogMessage "Entering the ADS-B Receiver Project root directory"
|
||||
cd ${RECEIVER_ROOT_DIRECTORY}
|
||||
echo ""
|
||||
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
LogTitleHeading "ADS-B Portal setup is complete"
|
||||
echo ""
|
||||
|
||||
exit 0
|
|
@ -3,22 +3,36 @@
|
|||
## SOFTWARE VERSIONS
|
||||
|
||||
# The ADS-B Receiver Project
|
||||
PROJECT_VERSION="2.8.4"
|
||||
PROJECT_VERSION = "2.8.4"
|
||||
|
||||
# FlightAware
|
||||
DUMP1090_FA_VERSION="9.0"
|
||||
DUMP978_FA_VERSION="9.0"
|
||||
PIAWARE_VERSION="9.0.1"
|
||||
SKYAWARE978_VERSION="9.0"
|
||||
DUMP1090_FA_VERSION = "9.0"
|
||||
DUMP978_FA_VERSION = "9.0"
|
||||
PIAWARE_VERSION = "9.0.1"
|
||||
SKYAWARE978_VERSION = "9.0"
|
||||
|
||||
# PlaneFinder Client
|
||||
PLANEFINDER_CLIENT_VERSION_ARMHF="5.0.161"
|
||||
PLANEFINDER_CLIENT_VERSION_ARM64="5.1.440"
|
||||
PLANEFINDER_CLIENT_VERSION_AMD64="5.0.162"
|
||||
PLANEFINDER_CLIENT_VERSION_I386="5.0.161"
|
||||
PLANEFINDER_CLIENT_VERSION_ARMHF = "5.0.161"
|
||||
PLANEFINDER_CLIENT_VERSION_ARM64 = "5.1.440"
|
||||
PLANEFINDER_CLIENT_VERSION_AMD64 = "5.0.162"
|
||||
PLANEFINDER_CLIENT_VERSION_I386 = "5.0.161"
|
||||
|
||||
# Flightradar24 Client
|
||||
FLIGHTRADAR24_CLIENT_VERSION="1.0.18-5"
|
||||
FLIGHTRADAR24_CLIENT_VERSION = "1.0.18-5"
|
||||
|
||||
# OpenSky Network Client
|
||||
OPENSKY_NETWORK_CLIENT_VERSION="2.1.7-1"
|
||||
OPENSKY_NETWORK_CLIENT_VERSION = "2.1.7-1"
|
||||
|
||||
|
||||
## DISPLAY
|
||||
|
||||
DISPLAY_DEFAULT = "\033[0m"
|
||||
DISPLAY_HEADING = "\033[1;36m"
|
||||
DISPLAY_MESSAGE = "\033[2;36m"
|
||||
DISPLAY_PROJECT_NAME = "\033[1;33m"
|
||||
DISPLAY_TITLE_HEADING = "\033[1;32m"
|
||||
DISPLAY_TITLE_MESSAGE = "\033[2;32m"
|
||||
DISPLAY_WARNING_HEADING = "\033[1;33m"
|
||||
DISPLAY_WARNING_MESSAGE = "\033[2;33m"
|
||||
DISPLAY_ALERT_HEADING = "\033[1;31m"
|
||||
DISPLAY_ALERT_MESSAGE = "\033[2;31m"
|
Ładowanie…
Reference in New Issue