2021-08-16 17:44:19 +02:00
|
|
|
#!/usr/bin/env bash
|
2017-03-08 12:39:59 +01:00
|
|
|
|
2021-08-16 17:44:19 +02:00
|
|
|
set -e # Exit if any of the steps fails.
|
2014-11-26 16:35:54 +01:00
|
|
|
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
echo "Please run as root user."
|
|
|
|
exit 1
|
2014-11-26 16:35:54 +01:00
|
|
|
fi
|
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
SCRIPT_DIR="$( cd "$( dirname "$0")" && pwd)"
|
2015-01-12 22:13:39 +01:00
|
|
|
AIRTIMEROOT=${SCRIPT_DIR}
|
2014-12-11 18:58:34 +01:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
showhelp() {
|
2014-12-11 18:58:34 +01:00
|
|
|
echo "Usage: sudo bash install [options]
|
2014-12-11 21:55:16 +01:00
|
|
|
-h, --help, -?
|
2014-12-11 18:58:34 +01:00
|
|
|
Display usage information
|
|
|
|
-V, --version
|
|
|
|
Display version information
|
|
|
|
-v, --verbose
|
|
|
|
More output
|
|
|
|
-q, --quiet, --silent
|
|
|
|
No output except errors
|
2014-12-11 22:42:05 +01:00
|
|
|
-f, --force
|
2014-12-11 21:55:16 +01:00
|
|
|
Turn off interactive prompts
|
2015-05-05 18:41:02 +02:00
|
|
|
--distribution=DISTRIBUTION
|
2015-03-11 19:39:41 +01:00
|
|
|
Linux distribution the installation is being run on
|
2015-05-05 18:41:02 +02:00
|
|
|
--release=RELEASE
|
2015-03-11 19:39:41 +01:00
|
|
|
Distribution release
|
2015-01-19 21:05:13 +01:00
|
|
|
-d, --ignore-dependencies
|
|
|
|
Don't install binary dependencies
|
2014-12-11 18:58:34 +01:00
|
|
|
-w, --web-user=WEB_USER
|
2015-01-13 18:28:36 +01:00
|
|
|
Set the apache web user. Defaults to www-data. Only change
|
|
|
|
this setting if you've changed the default apache web user
|
2014-12-15 15:54:15 +01:00
|
|
|
-r, --web-root=WEB_ROOT
|
2014-12-11 18:58:34 +01:00
|
|
|
Set the web root for Airtime files
|
2015-01-15 02:15:47 +01:00
|
|
|
This will copy the Airtime application files, but you will need
|
2021-05-19 19:22:15 +02:00
|
|
|
to give your web user access to the given directory if it is
|
2015-01-15 02:15:47 +01:00
|
|
|
not accessible
|
2017-03-07 12:55:06 +01:00
|
|
|
--web-port=WEB_PORT
|
|
|
|
Set what port the LibreTime interface should run on.
|
2014-12-16 18:24:41 +01:00
|
|
|
-I, --in-place
|
2015-01-15 02:15:47 +01:00
|
|
|
Set the current Airtime directory as the web root
|
2021-05-19 19:22:15 +02:00
|
|
|
Note that you will need to give your web user permission to
|
2015-01-15 02:15:47 +01:00
|
|
|
access this directory if it is not accessible
|
2014-12-16 18:24:41 +01:00
|
|
|
-p, --postgres
|
2014-12-11 21:55:16 +01:00
|
|
|
Create a default postgres user named 'airtime' with password
|
|
|
|
'airtime'
|
2014-12-11 18:58:34 +01:00
|
|
|
-a, --apache
|
2014-12-15 15:54:15 +01:00
|
|
|
Install apache and deploy a basic configuration for Airtime
|
2014-12-16 18:24:41 +01:00
|
|
|
-i, --icecast
|
2017-03-13 14:10:29 +01:00
|
|
|
Install Icecast 2 and deploy a basic configuration for Airtime
|
|
|
|
--selinux
|
|
|
|
Run restorecon on directories and files that need tagging to
|
2018-09-16 13:55:55 +02:00
|
|
|
allow the WEB_USER access
|
|
|
|
--no-postgres
|
|
|
|
Skips all postgres related install tasks (Useful if you configure
|
|
|
|
postgresql as part of another script / docker builds)
|
|
|
|
--no-rabbitmq
|
2021-08-16 13:45:32 +02:00
|
|
|
Skips all rabbitmq related install tasks."
|
2014-12-11 18:58:34 +01:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
showversion() {
|
|
|
|
if [ ! -f "$SCRIPT_DIR/VERSION" ]; then
|
|
|
|
echo "Please initialize LibreTime by running ./build.sh"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
version=$(cat "$SCRIPT_DIR/VERSION")
|
|
|
|
echo "LibreTime Version ${version}"
|
|
|
|
exit 0
|
2014-11-26 16:35:54 +01:00
|
|
|
}
|
|
|
|
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
web_user=""
|
2021-08-17 21:14:15 +02:00
|
|
|
web_root=""
|
2017-03-07 12:55:06 +01:00
|
|
|
web_port="80"
|
2014-12-11 18:58:34 +01:00
|
|
|
in_place="f"
|
2014-12-15 15:54:15 +01:00
|
|
|
postgres="f"
|
|
|
|
apache="f"
|
|
|
|
icecast="f"
|
2015-01-19 21:05:13 +01:00
|
|
|
ignore_dependencies="f"
|
2017-03-13 14:10:29 +01:00
|
|
|
selinux="f"
|
2014-12-11 21:55:16 +01:00
|
|
|
# Interactive
|
|
|
|
_i=1
|
|
|
|
# Verbose
|
2014-12-11 18:58:34 +01:00
|
|
|
_v=0
|
2014-12-11 21:55:16 +01:00
|
|
|
# Quiet
|
2014-12-11 18:58:34 +01:00
|
|
|
_q=0
|
2015-01-21 16:50:58 +01:00
|
|
|
upgrade="f"
|
2015-03-11 19:39:41 +01:00
|
|
|
dist=""
|
|
|
|
code=""
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
apache_bin=""
|
2018-09-16 14:13:30 +02:00
|
|
|
skip_postgres=0
|
|
|
|
skip_rabbitmq=0
|
2018-12-18 16:34:58 +01:00
|
|
|
default_value="Y"
|
2014-12-11 18:58:34 +01:00
|
|
|
|
2022-01-13 16:11:37 +01:00
|
|
|
# <user:group> <path>
|
|
|
|
mkdir_and_chown() {
|
|
|
|
mkdir -p "$2"
|
|
|
|
chown -R "$1" "$2"
|
|
|
|
}
|
|
|
|
|
2014-12-11 18:58:34 +01:00
|
|
|
function verbose() {
|
2021-08-16 13:45:32 +02:00
|
|
|
if [[ ${_v} -eq 1 ]]; then
|
|
|
|
echo -e "$@"
|
|
|
|
fi
|
2014-12-11 18:58:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function loud() {
|
2021-08-16 13:45:32 +02:00
|
|
|
if [[ ${_q} -eq 0 ]]; then
|
|
|
|
echo -e "$@"
|
|
|
|
fi
|
2014-12-11 18:58:34 +01:00
|
|
|
}
|
2014-12-04 00:04:47 +01:00
|
|
|
|
2021-05-19 19:22:15 +02:00
|
|
|
# Evaluate commands silently if quiet.
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
# If not quiet, output command if verbose.
|
2014-12-11 21:55:16 +01:00
|
|
|
function loudCmd() {
|
2021-08-16 13:45:32 +02:00
|
|
|
if [[ ${_q} -eq 0 ]]; then
|
|
|
|
verbose "$@"
|
2021-11-09 13:11:19 +01:00
|
|
|
# Disable the shellcheck until quoting can be corrected
|
|
|
|
# shellcheck disable=2294
|
|
|
|
eval "$@"
|
2021-08-16 13:45:32 +02:00
|
|
|
else
|
2021-11-09 13:11:19 +01:00
|
|
|
# shellcheck disable=2294
|
|
|
|
eval "$@" > /dev/null
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2014-12-11 21:55:16 +01:00
|
|
|
}
|
|
|
|
|
2015-02-11 00:06:46 +01:00
|
|
|
function checkCommandExists() {
|
2021-08-16 13:45:32 +02:00
|
|
|
set +e
|
2021-08-16 17:44:19 +02:00
|
|
|
command="$1"
|
|
|
|
eval hash "${command}" 2> /dev/null
|
2021-08-16 13:45:32 +02:00
|
|
|
commandFound=$?
|
|
|
|
if [[ ! ${commandFound} -eq 0 ]]; then
|
|
|
|
echo -e "Error: ${command} not found. Please ensure you have the corresponding dependency installed."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
set -e
|
2015-02-11 00:06:46 +01:00
|
|
|
}
|
|
|
|
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
# Function to determine if systemd, Upstart or System V Init is the active
|
2021-05-19 19:22:15 +02:00
|
|
|
# init system. All the newer supported distros use systemd out-of-the-box but
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
# a sysadmin could have installed an alternative init compatibility package.
|
2021-05-19 19:22:15 +02:00
|
|
|
# As a result, making assumptions based on the distribution and release is
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
# not a good idea. The detection works as follows:
|
|
|
|
# 1. Get the process name where PID=1 and follow any symlinks.
|
2021-05-19 19:22:15 +02:00
|
|
|
# 2. Look up that path in the appropriate package manager to get the name
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
# of the package that process is part of.
|
|
|
|
# See https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
|
|
|
|
has_systemd_init=false
|
|
|
|
has_upstart_init=false
|
|
|
|
has_systemv_init=false
|
|
|
|
function systemInitDetect() {
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\nDetecting init system type ..."
|
|
|
|
# Get the path of the command where pid=1 following any symlinks
|
|
|
|
pid_1_path=$(readlink --canonicalize -n /proc/1/exe)
|
|
|
|
# returns '(/usr)?/lib/systemd/systemd' (Debian Buster, CentOS 7)
|
|
|
|
verbose "Detected path to PID=1 process: $pid_1_path"
|
|
|
|
# Get package of PID=1 path as it identifies the init system.
|
|
|
|
# Allow this to fail, at least then the init system can be guessed from the
|
|
|
|
# PID 1 executable alone
|
2021-08-16 17:44:19 +02:00
|
|
|
pid_1_package=$(dpkg -S "$pid_1_path" 2> /dev/null ||
|
|
|
|
rpm --qf '%{name}\n' -qf "$pid_1_path" 2> /dev/null ||
|
2021-08-16 13:45:32 +02:00
|
|
|
echo "unknown")
|
|
|
|
verbose "Detected package name for PID=1 process: $pid_1_package"
|
|
|
|
case "${pid_1_package}:${pid_1_path}" in
|
|
|
|
*systemd*)
|
|
|
|
has_systemd_init=true
|
|
|
|
verbose "Detected init system type: systemd"
|
|
|
|
;;
|
|
|
|
*upstart*)
|
|
|
|
has_upstart_init=true
|
|
|
|
verbose "Detected init system type: Upstart"
|
|
|
|
;;
|
|
|
|
*sysvinit*)
|
|
|
|
has_systemv_init=true
|
|
|
|
verbose "Detected init system type: System V"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "ERROR: Unable to detect init system using package or path of PID=1 process!" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return 0
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Function to wrap installation of services for systemd, Upstart and System V
|
|
|
|
# depending on which one was detected by the systemInitDetect() function.
|
|
|
|
# Service file is copied from a known location and installed into the system.
|
|
|
|
# In the process, filtering is performed for the userid if appropriate.
|
|
|
|
# If required, the service is enabled; then it is started.
|
|
|
|
# Usage:
|
|
|
|
# systemInitInstall service-name [user]
|
|
|
|
function systemInitInstall() {
|
2021-08-16 13:45:32 +02:00
|
|
|
local service_name="$1"
|
|
|
|
local user="$2"
|
2021-08-16 17:44:19 +02:00
|
|
|
# shellcheck disable=SC2034
|
2021-08-16 13:45:32 +02:00
|
|
|
local source_base_path=""
|
|
|
|
local source_path=""
|
|
|
|
local target_path=""
|
|
|
|
local alt_path=""
|
|
|
|
local source_config_path=""
|
|
|
|
local target_config_path=""
|
|
|
|
local python_source_path="${SCRIPT_DIR-$PWD}/python_apps"
|
|
|
|
verbose "\n * Installing service $service_name ..."
|
|
|
|
if $has_systemd_init; then
|
|
|
|
case "$service_name" in
|
|
|
|
libretime-analyzer)
|
2021-10-17 02:39:50 +02:00
|
|
|
source_path="${SCRIPT_DIR}/analyzer/install/systemd/${service_name}.service"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/systemd/system/${service_name}.service"
|
2021-08-16 17:44:19 +02:00
|
|
|
alt_path="${target_path//libretime-/airtime_}"
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
|
|
|
libretime-celery)
|
2021-10-17 02:46:36 +02:00
|
|
|
source_path="${SCRIPT_DIR}/worker/install/systemd/${service_name}.service"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/systemd/system/${service_name}.service"
|
2021-08-16 17:44:19 +02:00
|
|
|
alt_path="${target_path//libretime-/airtime-}"
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
|
|
|
libretime-liquidsoap | libretime-playout)
|
2021-10-17 02:57:09 +02:00
|
|
|
source_path="${SCRIPT_DIR}/playout/install/systemd/${service_name}.service"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/systemd/system/${service_name}.service"
|
2021-08-16 17:44:19 +02:00
|
|
|
alt_path="${target_path//libretime-/airtime-}"
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
|
|
|
libretime-api)
|
|
|
|
source_path="${SCRIPT_DIR-$PWD}/api/install/systemd/${service_name}.service"
|
|
|
|
target_path="/etc/systemd/system/${service_name}.service"
|
2021-08-16 17:44:19 +02:00
|
|
|
alt_path="${target_path//libretime-/airtime-}"
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [[ ! -e $source_path ]]; then
|
2021-08-16 17:44:19 +02:00
|
|
|
echo "$0:${FUNCNAME[0]}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
2021-08-16 13:45:32 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# Stop and disable the service if it already exists
|
|
|
|
if [[ -e $target_path ]]; then
|
|
|
|
verbose "Service $service_name already exists - stopping and disabling."
|
|
|
|
loudCmd "systemctl disable ${service_name}.service"
|
|
|
|
loudCmd "systemctl stop ${service_name}.service"
|
|
|
|
fi
|
|
|
|
local old_style_unit_exists="f"
|
|
|
|
# Migrate old style airtime unit exist if it exists
|
|
|
|
if [[ -e $alt_path && ! -L $alt_path ]]; then
|
2021-08-16 17:44:19 +02:00
|
|
|
local old_service
|
|
|
|
old_service=$(echo "$service_name" | sed 's/libretime/airtime/' | sed 's/-analyzer/_analyzer/')
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "Old service $old_service already exists - migrating."
|
|
|
|
loudCmd "systemctl disable ${old_service}.service"
|
|
|
|
loudCmd "systemctl stop ${old_service}.service"
|
|
|
|
loudCmd "rm $alt_path"
|
|
|
|
old_style_unit_exists="t"
|
|
|
|
fi
|
|
|
|
# If no user defined, then just copy, otherwise filter
|
|
|
|
if [[ -z $user ]]; then
|
|
|
|
loudCmd "cp $source_path $target_path"
|
|
|
|
else
|
|
|
|
sed -e "s/User=.*/User=${user}/" \
|
2021-08-16 17:44:19 +02:00
|
|
|
-e "s/Group=.*/Group=${user}/" "$source_path" > "$target_path"
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
|
|
|
if [[ $old_style_unit_exists == "t" ]]; then
|
|
|
|
verbose "Maintaining compatibility with old systemd unit names"
|
|
|
|
# Alias to old Airtime names
|
|
|
|
loudCmd "ln -s $source_path $alt_path"
|
|
|
|
fi
|
2021-08-16 17:44:19 +02:00
|
|
|
chmod 0644 "$target_path"
|
|
|
|
chown root:root "$target_path"
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "Service ${service_name} installed into ${target_path}"
|
|
|
|
# Enable and start the service
|
|
|
|
loudCmd "systemctl enable ${service_name}.service"
|
|
|
|
verbose "Service ${service_name} enabled and started"
|
|
|
|
elif $has_upstart_init; then
|
|
|
|
case "$service_name" in
|
|
|
|
libretime-analyzer)
|
2021-10-17 02:39:50 +02:00
|
|
|
source_path="${SCRIPT_DIR}/analyzer/install/upstart/${service_name}.conf"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/init/${service_name}.conf"
|
|
|
|
user=${user:-$web_user}
|
|
|
|
;;
|
|
|
|
libretime-celery)
|
2021-10-17 02:46:36 +02:00
|
|
|
source_path="${SCRIPT_DIR}/worker/install/upstart/${service_name}.conf"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/init/${service_name}.conf"
|
|
|
|
user=""
|
|
|
|
;;
|
|
|
|
libretime-liquidsoap | libretime-playout)
|
2021-10-17 02:57:09 +02:00
|
|
|
source_path="${SCRIPT_DIR}/playout/install/upstart/${service_name}.conf.template"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/init/${service_name}.conf"
|
|
|
|
user=${user:-$web_user}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [[ ! -e $source_path ]]; then
|
2021-08-16 17:44:19 +02:00
|
|
|
echo "$0:${FUNCNAME[0]}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
2021-08-16 13:45:32 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# Stop the service if it already exists
|
|
|
|
if [[ -e $target_path ]]; then
|
|
|
|
verbose "Service $service_name already exists - stopping."
|
|
|
|
loudCmd "service ${service_name} stop"
|
|
|
|
fi
|
|
|
|
# If no user defined, then just copy, otherwise filter
|
|
|
|
if [[ -z $user ]]; then
|
|
|
|
loudCmd "cp $source_path $target_path"
|
|
|
|
else
|
|
|
|
sed -e "s/WEB_USER/${user}/g" \
|
2021-08-16 17:44:19 +02:00
|
|
|
-e "/^set[gu]id/{s/www-data/${user}/}" "$source_path" > "$target_path"
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2021-08-16 17:44:19 +02:00
|
|
|
chmod 0644 "$target_path"
|
|
|
|
chown root:root "$target_path"
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "Service ${service_name} installed into ${target_path}"
|
|
|
|
loudCmd "initctl check-config $service_name"
|
|
|
|
elif $has_systemv_init; then
|
|
|
|
case "$service_name" in
|
|
|
|
libretime-analyzer)
|
2021-10-17 02:39:50 +02:00
|
|
|
source_path="${SCRIPT_DIR}/analyzer/install/sysvinit/${service_name}"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/init.d/${service_name}"
|
|
|
|
user=${user:-$web_user}
|
|
|
|
;;
|
|
|
|
libretime-celery)
|
2021-10-17 02:46:36 +02:00
|
|
|
source_path="${SCRIPT_DIR}/worker/install/sysvinit/${service_name}"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/init.d/${service_name}"
|
|
|
|
source_config_path="${python_source_path}/${service_name}/install/conf/${service_name}"
|
|
|
|
target_config_path="/etc/default/${service_name}"
|
|
|
|
user=""
|
|
|
|
;;
|
|
|
|
libretime-liquidsoap | libretime-playout)
|
2021-10-17 02:57:09 +02:00
|
|
|
source_path="${SCRIPT_DIR}/playout/install/sysvinit/${service_name}"
|
2021-08-16 13:45:32 +02:00
|
|
|
target_path="/etc/init.d/${service_name}"
|
|
|
|
user=${user:-$web_user}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [[ ! -e $source_path ]]; then
|
2021-08-16 17:44:19 +02:00
|
|
|
echo "$0:${FUNCNAME[0]}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
2021-08-16 13:45:32 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# Stop the service if it already exists
|
|
|
|
if [[ -e $target_path ]]; then
|
|
|
|
verbose "Service $service_name already exists - stopping."
|
|
|
|
loudCmd "invoke-rc.d $service_name stop"
|
|
|
|
fi
|
|
|
|
# If no user defined, then just copy, otherwise filter
|
|
|
|
if [[ -z $user ]]; then
|
|
|
|
loudCmd "cp $source_path $target_path"
|
|
|
|
[[ -n $source_config_path ]] &&
|
|
|
|
loudCmd "cp $source_config_path $target_config_path"
|
|
|
|
else
|
|
|
|
sed -e "/^USERID/{s/www-data/${user}/}" \
|
2021-08-16 17:44:19 +02:00
|
|
|
-e "/^GROUPID/{s/www-data/${user}/}" "$source_path" > "$target_path"
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
fi
|
2021-08-16 17:44:19 +02:00
|
|
|
chmod 0644 "$target_path"
|
|
|
|
chown root:root "$target_path"
|
2021-08-16 13:45:32 +02:00
|
|
|
if [[ -n $target_config_path ]]; then
|
2021-08-16 17:44:19 +02:00
|
|
|
chmod 0644 "$target_config_path"
|
|
|
|
chown root:root "$target_config_path"
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
|
|
|
verbose "Service ${service_name} installed into ${target_path}"
|
|
|
|
# Create symlinks for the appropriate runlevels
|
|
|
|
loudCmd "update-rc.d $service_name defaults"
|
|
|
|
verbose "Service ${service_name} enabled"
|
|
|
|
fi
|
|
|
|
return 0
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Function to wrap different systemd vs. Upstart init commands depending
|
|
|
|
# on which init system has been detected. Syntax is similar to systemctl.
|
2021-05-19 19:22:15 +02:00
|
|
|
# Usage:
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
# systemInitCommand _command_ [service-name ...]
|
|
|
|
# Where _command_ is one of: start, stop, status, reload, restart
|
|
|
|
# enable, disable and either daemon-reload or reload-configuration.
|
|
|
|
function systemInitCommand() {
|
2021-08-16 13:45:32 +02:00
|
|
|
local command=$1
|
|
|
|
shift
|
|
|
|
case "$command" in
|
|
|
|
start | stop | status | reload | restart)
|
|
|
|
if $has_systemd_init; then
|
2021-08-16 17:44:19 +02:00
|
|
|
loudCmd "systemctl $command $*"
|
2021-08-16 13:45:32 +02:00
|
|
|
elif $has_upstart_init; then
|
2021-08-16 17:44:19 +02:00
|
|
|
for svc_name in "$@"; do
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "service $svc_name $command"
|
|
|
|
done
|
|
|
|
elif $has_systemv_init; then
|
2021-08-16 17:44:19 +02:00
|
|
|
for svc_name in "$@"; do
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "invoke-rc.d $svc_name $command"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
enable | disable) # TODO: REMOVE
|
|
|
|
$has_systemd_init &&
|
|
|
|
loudCmd "systemctl $command $1.service"
|
|
|
|
if $has_systemv_init; then
|
2021-08-16 17:44:19 +02:00
|
|
|
if [[ "$command" == "enable" ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "update-rc.d $1 defaults"
|
|
|
|
else
|
|
|
|
loudCmd "update-rc.d $1 enable"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
daemon-reload | reload-configuration)
|
|
|
|
$has_systemd_init &&
|
|
|
|
loudCmd "systemctl daemon-reload"
|
|
|
|
$has_upstart_init &&
|
|
|
|
loudCmd "initctl reload-configuration"
|
|
|
|
;;
|
|
|
|
*)
|
2021-08-16 17:44:19 +02:00
|
|
|
echo -e "$0:${FUNCNAME[0]}(): ERROR: command \"$command\" is not supported!" >&2
|
2021-08-16 13:45:32 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return 0
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
}
|
|
|
|
|
2014-12-09 23:48:16 +01:00
|
|
|
while :; do
|
2021-08-16 13:45:32 +02:00
|
|
|
case "$1" in
|
|
|
|
--help)
|
|
|
|
showhelp
|
|
|
|
;;
|
|
|
|
--version)
|
|
|
|
showversion
|
|
|
|
;;
|
|
|
|
--verbose)
|
|
|
|
_v=1
|
|
|
|
;;
|
|
|
|
--quiet | --silent)
|
|
|
|
_q=1
|
|
|
|
;;
|
|
|
|
--force)
|
|
|
|
_i=0
|
|
|
|
;;
|
|
|
|
--distribution)
|
|
|
|
if [ "$2" ]; then
|
|
|
|
dist=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
echo 'ERROR: Must specify a non-empty "--distribution DISTRIBUTION" argument.' >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--distribution=?*)
|
|
|
|
dist=${1#*=} # Delete everything up to "=" and assign the remainder.
|
|
|
|
;;
|
|
|
|
--distribution=)
|
|
|
|
echo 'ERROR: Must specify a non-empty "--distribution DISTRIBUTION" argument.' >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
--release)
|
|
|
|
if [ "$2" ]; then
|
|
|
|
code=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
echo 'ERROR: Must specify a non-empty "--release RELEASE" argument.' >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--release=?*)
|
|
|
|
code=${1#*=} # Delete everything up to "=" and assign the remainder.
|
|
|
|
;;
|
|
|
|
--release=)
|
|
|
|
echo 'ERROR: Must specify a non-empty "--release RELEASE" argument.' >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
--ignore-dependencies)
|
|
|
|
ignore_dependencies="t"
|
|
|
|
;;
|
|
|
|
--apache)
|
|
|
|
apache="t"
|
|
|
|
;;
|
|
|
|
--icecast)
|
|
|
|
icecast="t"
|
|
|
|
;;
|
|
|
|
--postgres)
|
|
|
|
postgres="t"
|
|
|
|
;;
|
|
|
|
--in-place)
|
|
|
|
in_place="t"
|
|
|
|
;;
|
|
|
|
--web-user)
|
|
|
|
if [ "$2" ]; then
|
|
|
|
web_user=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
echo 'ERROR: Must specify a non-empty "--web-user WEB_USER" argument.' >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--web-user=?*)
|
|
|
|
web_user=${1#*=} # Delete everything up to "=" and assign the remainder.
|
|
|
|
;;
|
|
|
|
--web-user=)
|
|
|
|
echo 'ERROR: Must specify a non-empty "--web-user=WEB_USER" argument.' >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
--web-root)
|
|
|
|
if [ "$2" ]; then
|
2021-08-16 17:44:19 +02:00
|
|
|
web_root=$(readlink -f "$2")
|
2021-08-16 13:45:32 +02:00
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
echo 'ERROR: Must specify a non-empty "--web-root WEB_ROOT" argument.' >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--web-root=?*)
|
|
|
|
web_root=${1#*=} # Delete everything up to "=" and assign the remainder.
|
|
|
|
;;
|
|
|
|
--web-root=)
|
|
|
|
echo 'ERROR: Must specify a non-empty "--web-root=WEB_ROOT" argument.' >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
--web-port)
|
|
|
|
echo 'ERROR: Please specify a port number.' >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
--web-port=)
|
|
|
|
echo 'ERROR: Please specify a port number.' >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
--web-port=?*)
|
|
|
|
web_port=${1#*=}
|
|
|
|
;;
|
|
|
|
--selinux)
|
|
|
|
selinux="t"
|
|
|
|
;;
|
|
|
|
--no-postgres)
|
|
|
|
skip_postgres=1
|
|
|
|
;;
|
|
|
|
--no-rabbitmq)
|
|
|
|
skip_rabbitmq=1
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
-?*)
|
|
|
|
for ((i = 1; i < ${#1}; i++)); do
|
|
|
|
case "${1:$i:1}" in
|
|
|
|
h | \?)
|
2014-12-09 23:48:16 +01:00
|
|
|
showhelp
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
V)
|
2014-12-11 18:58:34 +01:00
|
|
|
showversion
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
v)
|
2014-12-11 18:58:34 +01:00
|
|
|
_v=1
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
q)
|
2014-12-11 18:58:34 +01:00
|
|
|
_q=1
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
f)
|
2014-12-11 21:55:16 +01:00
|
|
|
_i=0
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
d)
|
2015-01-19 21:05:13 +01:00
|
|
|
ignore_dependencies="t"
|
2014-12-15 15:54:15 +01:00
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
a)
|
2014-12-09 23:48:16 +01:00
|
|
|
apache="t"
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
i)
|
2014-12-15 15:54:15 +01:00
|
|
|
icecast="t"
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
p)
|
2014-12-15 15:54:15 +01:00
|
|
|
postgres="t"
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
I)
|
2014-12-11 18:58:34 +01:00
|
|
|
in_place="t"
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
w)
|
2014-12-09 23:48:16 +01:00
|
|
|
if [ "$2" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
web_user=$2
|
|
|
|
continue
|
2014-12-09 23:48:16 +01:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
echo 'ERROR: Must specify a non-empty "-w WEB_USER" argument.' >&2
|
|
|
|
exit 1
|
2014-12-09 23:48:16 +01:00
|
|
|
fi
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
r)
|
2014-12-11 18:58:34 +01:00
|
|
|
if [ "$2" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
web_root=$(readlink -f $2)
|
|
|
|
continue
|
2014-12-11 18:58:34 +01:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
echo 'ERROR: Must specify a non-empty "-d WEB_ROOT" argument.' >&2
|
|
|
|
exit 1
|
2014-12-11 18:58:34 +01:00
|
|
|
fi
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
*)
|
2021-08-16 17:44:19 +02:00
|
|
|
echo "$0: error - unrecognized option '${1:i:1}'" >&2
|
2021-08-16 13:45:32 +02:00
|
|
|
echo "Try 'install --help' for more information."
|
2014-12-09 23:48:16 +01:00
|
|
|
exit 1
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
2014-11-26 16:35:54 +01:00
|
|
|
done
|
|
|
|
|
2021-08-17 13:38:31 +02:00
|
|
|
# If web_root is given, check that it exists
|
|
|
|
if [[ -n $web_root && ! -d $web_root ]]; then
|
|
|
|
echo "$web_root directory not found!"
|
2021-08-16 13:45:32 +02:00
|
|
|
exit 1
|
2014-12-11 18:58:34 +01:00
|
|
|
fi
|
2021-08-17 13:38:31 +02:00
|
|
|
|
2017-03-05 01:44:01 +01:00
|
|
|
echo -e "\n.____ ._____. ___________.__ "
|
|
|
|
echo "| | |__\_ |_________ ___\__ ___/|__| _____ ____ "
|
|
|
|
echo "| | | || __ \_ __ \_/ __ \| | | |/ \_/ __ \ "
|
|
|
|
echo "| |___| || \_\ \ | \/\ ___/| | | | Y Y \ ___/ "
|
|
|
|
echo "|_______ \__||___ /__| \___ >____| |__|__|_| /\___ >"
|
|
|
|
echo -e " \/ \/ \/ \/ \/\n"
|
2014-12-11 18:58:34 +01:00
|
|
|
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
echo -e "Detecting distribution and release ..."
|
|
|
|
if [ -e /etc/os-release ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
# Access $ID, $VERSION_ID and $PRETTY_NAME
|
2021-08-16 17:44:19 +02:00
|
|
|
# shellcheck disable=SC1091
|
2021-08-16 13:45:32 +02:00
|
|
|
source /etc/os-release
|
|
|
|
echo "Detected distribution id: $ID"
|
|
|
|
echo "Detected distribution release id: $VERSION_ID"
|
|
|
|
echo "Detected distribution description: $PRETTY_NAME"
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
ID=unknown
|
|
|
|
VERSION_ID=unknown
|
|
|
|
PRETTY_NAME="Unknown distribution and release"
|
|
|
|
echo "WARNING: /etc/os-release configuration not found. Unable to detect distribution." >&2
|
2021-08-16 17:44:19 +02:00
|
|
|
if [[ -z $dist || -z $code ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
echo "ERROR: One or both of --distribution and --release options were not specified." >&2
|
|
|
|
echo "This is an unsupported distribution and/or version!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Validate --distribution parameter has a sane value for this OS.
|
|
|
|
if [ -n "$dist" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
dist=${dist,,}
|
|
|
|
verbose "Checking --distribution \"$dist\" to ensure it has a sane value."
|
|
|
|
# If $ID detected above does not match parameter, then do some checking
|
|
|
|
if [ "$dist" != "$ID" ]; then
|
|
|
|
verbose "Detected distribution \"$ID\" does not match specified one of \"$dist\". Checking ..."
|
|
|
|
case "$dist" in
|
|
|
|
centos | rhel)
|
|
|
|
pkg_installer=/usr/bin/yum
|
|
|
|
verbose "Detected yum package installer"
|
|
|
|
;;
|
|
|
|
debian | ubuntu)
|
|
|
|
pkg_installer=/usr/bin/apt-get
|
|
|
|
verbose "Detected apt-get package installer"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "ERROR: the value \"$dist\" specified for --distribution is unsupported." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [ ! -x "$pkg_installer" ]; then
|
|
|
|
echo "ERROR: The value \"$dist\" specified for --distribution does not appear compatible!" >&2
|
|
|
|
exit 1
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
fi
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Validate the distribution and release is a supported one; set boolean flags.
|
|
|
|
is_debian_dist=false
|
2019-01-10 08:08:45 +01:00
|
|
|
is_debian_buster=false
|
2021-11-09 10:21:40 +01:00
|
|
|
is_debian_bullseye=false
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
is_ubuntu_dist=false
|
2021-11-04 08:55:50 +01:00
|
|
|
is_ubuntu_focal=false
|
2018-10-12 19:35:37 +02:00
|
|
|
is_ubuntu_bionic=false
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
is_centos_dist=false
|
2021-08-16 17:44:19 +02:00
|
|
|
# shellcheck disable=SC2034
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
is_centos_7=false
|
2020-12-26 12:50:38 +01:00
|
|
|
is_centos_8=false
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
# Use specified distribution and release or detected otherwise.
|
|
|
|
dist="${dist:-$ID}"
|
|
|
|
code="${code:-$VERSION_ID}"
|
|
|
|
code="${code,,}"
|
|
|
|
verbose "Validating dist-code: ${dist}-${code}"
|
|
|
|
case "${dist}-${code}" in
|
2021-11-04 08:55:50 +01:00
|
|
|
ubuntu-20.04)
|
|
|
|
code="focal"
|
|
|
|
is_ubuntu_dist=true
|
|
|
|
is_ubuntu_focal=true
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
ubuntu-18.04)
|
|
|
|
code="bionic"
|
2022-02-11 14:34:32 +01:00
|
|
|
# shellcheck disable=SC2034
|
2021-08-16 13:45:32 +02:00
|
|
|
is_ubuntu_dist=true
|
|
|
|
is_ubuntu_bionic=true
|
|
|
|
;;
|
|
|
|
ubuntu-16.04 | ubuntu-xenial | ubuntu-xenial_docker_minimal)
|
|
|
|
echo -e "ERROR: Ubuntu Xenial is archived and does not receive any security or other updates since 2021-04-01." >&2
|
|
|
|
echo -e "The LibreTime installer dropped support for installing LibreTime on Xenial in 3.0.0-alpha.10." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
debian-9 | debian-stretch)
|
|
|
|
echo -e "ERROR: Debian Stretch is archived and does not receive any security or other updates since 2020-06-06." >&2
|
|
|
|
echo -e "The LibreTime installer dropped support for installing LibreTime on Stretch in 3.0.0-alpha.10." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
debian-10 | debian-buster)
|
|
|
|
code="buster"
|
|
|
|
is_debian_dist=true
|
|
|
|
is_debian_buster=true
|
|
|
|
;;
|
2021-11-09 10:21:40 +01:00
|
|
|
debian-11 | debian-bullseye)
|
|
|
|
code="bullseye"
|
|
|
|
is_debian_dist=true
|
|
|
|
is_debian_bullseye=true
|
|
|
|
;;
|
2021-08-16 13:45:32 +02:00
|
|
|
#Fix for Raspbian 9 (stretch)
|
2021-08-16 23:00:01 +02:00
|
|
|
raspbian-9)
|
2021-08-16 13:45:32 +02:00
|
|
|
echo -e "ERROR: Raspbian Stretch is archived and does not receive any security or other updates since 2020-06-06." >&2
|
|
|
|
echo -e "The LibreTime installer dropped support for installing LibreTime on Stretch in 3.0.0-alpha.10." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
#End of fix
|
|
|
|
#Fix for Raspbian 10 (buster)
|
2021-08-16 23:00:01 +02:00
|
|
|
raspbian-10)
|
2021-08-16 13:45:32 +02:00
|
|
|
code="buster"
|
|
|
|
dist="debian"
|
2021-08-16 17:44:19 +02:00
|
|
|
# shellcheck disable=SC2034
|
2021-08-16 13:45:32 +02:00
|
|
|
is_debian_dist=true
|
|
|
|
is_debian_buster=true
|
|
|
|
;;
|
|
|
|
#End of fix
|
|
|
|
|
|
|
|
debian-8 | debian-jessie)
|
|
|
|
echo -e "ERROR: Debian Jessie is archived and does not receive any security or other updates since 2018-05-17." >&2
|
|
|
|
echo -e "The LibreTime installer dropped support for installing LibreTime on Jessie in 3.0.0-alpha.8." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
centos-8)
|
|
|
|
is_centos_dist=true
|
2021-08-16 17:44:19 +02:00
|
|
|
# shellcheck disable=SC2034
|
2021-08-16 13:45:32 +02:00
|
|
|
is_centos_8=true
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo -e "ERROR: Distribution \"$PRETTY_NAME\" is not supported with \"${dist}-${code}\"!" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
esac
|
|
|
|
verbose "Using distribution id \"$dist\", release code \"$code\""
|
|
|
|
|
|
|
|
# Detect init system type
|
|
|
|
systemInitDetect
|
|
|
|
|
2021-09-02 14:08:20 +02:00
|
|
|
# SysV is not supported, fail fast instead of cleaning the whole script
|
|
|
|
# from sysv related entries.
|
|
|
|
if $has_systemv_init; then
|
|
|
|
echo "ERROR: Installation on SysV init system is not supported!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-09-02 14:11:40 +02:00
|
|
|
# Upstart is not supported, fail fast instead of cleaning the whole script
|
|
|
|
# from Upstart related entries.
|
|
|
|
if $has_upstart_init; then
|
|
|
|
echo "ERROR: Installation on Upstart init system is not supported!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
if $is_centos_dist; then
|
2021-08-16 13:45:32 +02:00
|
|
|
python_bin="python3.8"
|
|
|
|
apache_bin="httpd"
|
|
|
|
apache_service="httpd"
|
|
|
|
web_user="${web_user:-apache}"
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
python_bin="python3"
|
|
|
|
apache_bin="apache2ctl"
|
|
|
|
apache_service="apache2"
|
|
|
|
web_user="${web_user:-www-data}"
|
2017-03-08 12:39:59 +01:00
|
|
|
fi
|
2014-12-11 18:58:34 +01:00
|
|
|
|
2015-02-11 00:06:46 +01:00
|
|
|
if [ "$ignore_dependencies" = "f" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
set +e
|
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Installing External Dependencies * "
|
|
|
|
loud "-----------------------------------------------------"
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2022-03-26 19:25:31 +01:00
|
|
|
if $is_ubuntu_dist; then
|
2022-04-11 11:30:58 +02:00
|
|
|
loudCmd "DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common"
|
2022-03-26 19:25:31 +01:00
|
|
|
loudCmd "add-apt-repository -y ppa:libretime/libretime"
|
|
|
|
fi
|
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
if [ -x /usr/bin/apt-get ]; then
|
2021-08-17 23:11:04 +02:00
|
|
|
verbose "\n * Reading packages.ini files..."
|
2021-08-16 23:49:15 +02:00
|
|
|
|
2021-08-17 23:11:04 +02:00
|
|
|
packages_files=(
|
|
|
|
"${SCRIPT_DIR}/"
|
2021-10-06 17:32:14 +02:00
|
|
|
"${SCRIPT_DIR}/legacy"
|
2021-08-17 23:11:04 +02:00
|
|
|
"${SCRIPT_DIR}/api"
|
2021-10-17 02:39:50 +02:00
|
|
|
"${SCRIPT_DIR}/analyzer"
|
2021-10-17 02:57:09 +02:00
|
|
|
"${SCRIPT_DIR}/playout"
|
2021-08-17 23:11:04 +02:00
|
|
|
)
|
2021-08-16 13:45:32 +02:00
|
|
|
|
2021-08-17 23:11:04 +02:00
|
|
|
set -e
|
|
|
|
package_list=$(
|
2021-09-07 22:56:35 +02:00
|
|
|
"${SCRIPT_DIR}/tools/packages.py" --format=line "${code}" "${packages_files[@]}" ||
|
2021-08-17 23:11:04 +02:00
|
|
|
(echo "ERROR: could not generate packages list" >&2 && exit 1)
|
|
|
|
)
|
|
|
|
set +e
|
|
|
|
|
|
|
|
loudCmd "apt-get -q update"
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "DEBIAN_FRONTEND=noninteractive apt-get -y install $package_list"
|
|
|
|
[[ "$in_place" == "t" ]] && loudCmd "DEBIAN_FRONTEND=noninteractive apt-get -y install git"
|
|
|
|
else
|
|
|
|
echo "WARNING: installing dependencies is not supported for this distribution" >&2
|
|
|
|
fi
|
|
|
|
set -e
|
2015-02-11 00:06:46 +01:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
checkCommandExists "${apache_bin}"
|
|
|
|
checkCommandExists "rabbitmqctl"
|
|
|
|
checkCommandExists "psql"
|
|
|
|
if [ "$in_place" = "t" ]; then
|
|
|
|
checkCommandExists "git"
|
|
|
|
fi
|
2015-02-11 00:06:46 +01:00
|
|
|
fi
|
2015-01-15 19:48:40 +01:00
|
|
|
|
2015-07-01 06:24:11 +02:00
|
|
|
# Check if composer exists and install if it doesn't
|
2015-08-24 22:25:09 +02:00
|
|
|
set +e
|
2021-08-16 13:45:32 +02:00
|
|
|
eval hash "composer" 2> /dev/null
|
2015-07-01 06:24:11 +02:00
|
|
|
commandFound=$?
|
2015-08-24 22:25:09 +02:00
|
|
|
set -e
|
2015-07-01 06:24:11 +02:00
|
|
|
if [[ ! ${commandFound} -eq 0 ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
curl -sS https://getcomposer.org/installer > get-composer.php
|
|
|
|
php ./get-composer.php --install-dir=/usr/local/bin --filename=composer
|
|
|
|
rm get-composer.php
|
|
|
|
PATH="${PATH}:/usr/local/bin"
|
2015-07-01 06:24:11 +02:00
|
|
|
fi
|
|
|
|
|
2021-09-11 04:45:07 +02:00
|
|
|
make VERSION # Create a VERSION file
|
2021-10-06 17:32:14 +02:00
|
|
|
make -C legacy build # Install php dependencies with composer
|
2021-09-11 04:45:07 +02:00
|
|
|
|
2015-01-14 22:11:49 +01:00
|
|
|
if [ -f /etc/airtime/airtime.conf ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
# TODO use VERSION or some other way to check for updates and handle
|
|
|
|
# media-monitor case on it's own
|
|
|
|
OLD_CONF=$(grep -F "[media-monitor]" /etc/airtime/airtime.conf || true)
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
if [ -n "${OLD_CONF}" ]; then
|
|
|
|
upgrade="t"
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
set +e
|
|
|
|
verbose "Stopping airtime services..."
|
|
|
|
systemInitCommand stop airtime_analyzer airtime-celery airtime-playout airtime-liquidsoap airtime-media-monitor
|
|
|
|
verbose "...Done"
|
2017-08-06 22:29:52 +02:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "Disabling obsolete services..."
|
|
|
|
systemInitCommand disable airtime-media-monitor
|
|
|
|
verbose "...Done"
|
2017-08-06 22:29:52 +02:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
echo "Looks like you have an old version of Airtime. Your current /etc/airtime/airtime.conf \
|
2015-01-15 19:48:40 +01:00
|
|
|
will be moved to /etc/airtime/airtime.conf.tmp"
|
2021-08-16 13:45:32 +02:00
|
|
|
# If we don't remove the existing python files in /usr/lib and the
|
|
|
|
# /etc/init.d startup scripts, services won't work properly
|
|
|
|
if [ -d /usr/lib/airtime/ ]; then
|
|
|
|
rm -rf /usr/lib/airtime/
|
|
|
|
fi
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
rm -f /etc/init.d/airtime*
|
|
|
|
rm -f /etc/init/airtime*
|
|
|
|
rm -f /etc/default/airtime-celery
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
if [ "$apache" = "t" ]; then
|
|
|
|
# If the user selects an "in-place" install or passes in a web root,
|
|
|
|
# we need to replace the old apache airtime.conf
|
|
|
|
rm -f /etc/apache2/sites-available/airtime.conf /etc/apache2/sites-enabled/airtime.conf
|
|
|
|
fi
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2021-08-16 23:00:01 +02:00
|
|
|
if [[ -d "/usr/share/airtime" && $web_root == "/usr/share/airtime" ]]; then
|
|
|
|
rm -rf "/usr/share/airtime"
|
2015-01-14 22:53:19 +01:00
|
|
|
fi
|
2021-08-16 13:45:32 +02:00
|
|
|
|
|
|
|
mv /etc/airtime/airtime.conf /etc/airtime/airtime.conf.tmp
|
|
|
|
set -e
|
|
|
|
fi
|
2015-01-14 22:11:49 +01:00
|
|
|
fi
|
|
|
|
|
2021-05-19 19:22:15 +02:00
|
|
|
API2_APACHE_CONF=$(grep -F "ProxyPass" /etc/apache2/sites-available/airtime.conf || true)
|
2021-08-16 23:00:01 +02:00
|
|
|
if [[ -z "${API2_APACHE_CONF}" && "$apache" == "t" ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
# Remove Apache configuration so that the ProxyPass configuration for API 2.0
|
|
|
|
# is installed
|
|
|
|
rm -f /etc/apache2/sites-available/airtime.conf /etc/apache2/sites-enabled/airtime.conf
|
2021-05-19 19:22:15 +02:00
|
|
|
fi
|
|
|
|
|
2021-08-16 23:00:01 +02:00
|
|
|
if [[ "$apache" = "f" && ${_i} -eq 1 ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
echo -e "Install default Airtime apache configuration? (Y/n): \c"
|
|
|
|
read IN
|
|
|
|
IN=${IN:-$default_value}
|
2021-08-16 23:00:01 +02:00
|
|
|
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
apache="t"
|
|
|
|
fi
|
2014-12-11 21:55:16 +01:00
|
|
|
fi
|
|
|
|
|
2014-12-19 19:49:33 +01:00
|
|
|
if [ "$in_place" = "t" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Setting current Airtime directory as web root..."
|
2021-10-06 17:32:14 +02:00
|
|
|
web_root=${AIRTIMEROOT}/legacy/public
|
2014-12-19 19:49:33 +01:00
|
|
|
elif [ -n "$web_root" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Creating Apache web root directory..."
|
2021-10-06 17:32:14 +02:00
|
|
|
cp -R ${AIRTIMEROOT}/legacy ${web_root}
|
2021-08-16 13:45:32 +02:00
|
|
|
cp ${AIRTIMEROOT}/VERSION ${web_root}
|
2021-10-06 17:32:14 +02:00
|
|
|
web_root=${web_root}/legacy/public/
|
2014-12-19 19:49:33 +01:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Creating default Apache web root directory /usr/share/airtime/php..."
|
|
|
|
web_root="/usr/share/airtime/php"
|
|
|
|
mkdir -p ${web_root}
|
2021-10-06 17:32:14 +02:00
|
|
|
cp -R ${AIRTIMEROOT}/legacy ${web_root}
|
2021-08-16 13:45:32 +02:00
|
|
|
cp ${AIRTIMEROOT}/VERSION ${web_root}
|
2021-10-06 17:32:14 +02:00
|
|
|
web_root=${web_root}/legacy/public/
|
2014-12-19 19:49:33 +01:00
|
|
|
fi
|
2015-01-15 02:15:47 +01:00
|
|
|
verbose "...Done"
|
2014-12-19 19:49:33 +01:00
|
|
|
|
2014-12-11 18:58:34 +01:00
|
|
|
if [ "$apache" = "t" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Configuring Apache * "
|
|
|
|
loud "-----------------------------------------------------"
|
|
|
|
# Detect Apache root folder, e.g. /etc/apache2 or /etc/httpd
|
2021-08-16 23:00:01 +02:00
|
|
|
eval "$($apache_bin -V | awk '/HTTPD_ROOT|SERVER_CONFIG_FILE/ { print $2 }')"
|
2021-08-16 13:45:32 +02:00
|
|
|
apache_conf="${HTTPD_ROOT}/${SERVER_CONFIG_FILE}"
|
|
|
|
verbose "Detected Apache root folder is: ${HTTPD_ROOT}"
|
|
|
|
if [[ ! -e $apache_conf ]]; then
|
|
|
|
echo -e "ERROR: Apache binary \"$apache_bin\" points to a non-existent file \"$apache_conf\""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
verbose "Detected Apache primary .conf file is: ${apache_conf}"
|
|
|
|
if [[ -d ${HTTPD_ROOT}/sites-available ]]; then # debian & ubuntu
|
|
|
|
apache_sitedir="${HTTPD_ROOT}/sites-available/"
|
|
|
|
elif [[ -d ${HTTPD_ROOT}/conf.d ]]; then # centos
|
|
|
|
apache_sitedir="${HTTPD_ROOT}/conf.d/"
|
|
|
|
else
|
|
|
|
echo -e "ERROR: unknown location of Apache sites-available or virtual host directory!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
verbose "Detected Apache sites configuration folder: ${apache_sitedir}"
|
|
|
|
|
|
|
|
set +e
|
|
|
|
# Parse: Server version: Apache/2.2.22 (Ubuntu) -> 2
|
|
|
|
apache_major_version=$($apache_bin -v | awk -F'[ /.]+' 'NR == 1 { print $4 }')
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [[ "$apache_major_version" -ge 2 ]]; then
|
|
|
|
airtimeconfigfile="airtime.conf"
|
|
|
|
oldconfigfile="airtime-vhost.conf"
|
|
|
|
else
|
|
|
|
airtimeconfigfile="airtime"
|
|
|
|
oldconfigfile="airtime-vhost"
|
|
|
|
fi
|
2014-12-04 00:04:47 +01:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
# If we're upgrading (installing over an existing Airtime install) and we've been told to
|
|
|
|
# install apache, we should overwrite any existing configuration. If we don't do this, doing
|
|
|
|
# an in-place installation over an old Airtime install (which installs to /usr/share by default)
|
|
|
|
# will fail
|
2021-08-16 23:00:01 +02:00
|
|
|
if [[ "$upgrade" == "t" || ! -f "${apache_sitedir}${airtimeconfigfile}" ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Creating Apache config for Airtime..."
|
|
|
|
listen_port=""
|
|
|
|
if [ "$web_port" != "80" ]; then
|
|
|
|
listen_port="Listen ${web_port}"
|
2014-12-04 00:04:47 +01:00
|
|
|
fi
|
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
apache_template_file=${SCRIPT_DIR}/installer/apache/airtime-vhost-2.4
|
|
|
|
if [[ "$apache_major_version" -eq 1 ]]; then
|
|
|
|
# fall back to apache 1 config
|
|
|
|
apache_template_file=${SCRIPT_DIR}/installer/apache/airtime-vhost
|
|
|
|
fi
|
|
|
|
sed \
|
|
|
|
-e "s@WEB_PORT_LISTEN@${listen_port}@g" \
|
|
|
|
-e "s@WEB_PORT@${web_port}@g" \
|
|
|
|
-e "s@WEB_ROOT@${web_root}@g" \
|
|
|
|
${apache_template_file} > ${apache_sitedir}${airtimeconfigfile}
|
|
|
|
|
|
|
|
# The a2ensite/a2dissite utilities are not available on CentOS
|
|
|
|
if [[ -x /usr/sbin/a2ensite ]]; then
|
|
|
|
loudCmd "a2dissite 000-default"
|
|
|
|
# If Airtime was previously installed with apt, the vhost file name is different,
|
|
|
|
# so we need to specifically disable it.
|
|
|
|
if [ -f "/etc/apache2/sites-available/${oldconfigfile}" ]; then
|
|
|
|
loudCmd "a2dissite airtime-vhost"
|
|
|
|
fi
|
|
|
|
loudCmd "a2ensite airtime"
|
2014-12-04 00:04:47 +01:00
|
|
|
fi
|
2021-08-16 13:45:32 +02:00
|
|
|
else
|
|
|
|
verbose "\nApache config for Airtime already exists, skipping"
|
|
|
|
fi
|
2014-12-11 18:58:34 +01:00
|
|
|
fi
|
2014-12-04 00:04:47 +01:00
|
|
|
|
2021-08-16 23:00:01 +02:00
|
|
|
if [[ "$icecast" == "f" && ${_i} -eq 1 ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
echo -e "Install default Airtime Icecast configuration? (Y/n): \c"
|
2021-08-16 17:44:19 +02:00
|
|
|
read -r IN
|
2021-08-16 13:45:32 +02:00
|
|
|
IN=${IN:-$default_value}
|
2021-08-16 17:44:19 +02:00
|
|
|
if [[ $IN == "y" || $IN == "Y" ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
icecast="t"
|
|
|
|
fi
|
2014-12-16 18:24:41 +01:00
|
|
|
fi
|
|
|
|
|
2014-12-15 15:54:15 +01:00
|
|
|
if [ "$icecast" = "t" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Configuring Icecast * "
|
|
|
|
loud "-----------------------------------------------------"
|
|
|
|
|
|
|
|
verbose "\n * Enabling Icecast 2..."
|
|
|
|
icecast_unit_name="icecast2"
|
|
|
|
if [ "$dist" != "centos" ]; then
|
|
|
|
sed -i 's/ENABLE=false/ENABLE=true/g' /etc/default/icecast2
|
|
|
|
icecast_config="/etc/icecast2/icecast.xml"
|
|
|
|
else
|
|
|
|
icecast_unit_name="icecast"
|
|
|
|
icecast_config="/etc/icecast.xml"
|
|
|
|
fi
|
2021-08-16 17:44:19 +02:00
|
|
|
systemInitCommand enable "${icecast_unit_name}"
|
2021-08-16 13:45:32 +02:00
|
|
|
# only update icecast password if
|
|
|
|
if [ ! -e "/etc/airtime/airtime.conf" ] && [ ! -e "/etc/airtime/airtime.conf.tmp" ]; then
|
2021-08-16 17:44:19 +02:00
|
|
|
icecast_pass=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c"${1:-12}")
|
|
|
|
echo "$icecast_pass" > /tmp/icecast_pass
|
2021-08-16 13:45:32 +02:00
|
|
|
loud "\n New install detected setting icecast password to random value."
|
2021-08-16 17:44:19 +02:00
|
|
|
xmlstarlet ed --inplace -u /icecast/authentication/source-password -v "$icecast_pass" "$icecast_config"
|
|
|
|
xmlstarlet ed --inplace -u /icecast/authentication/relay-password -v "$icecast_pass" "$icecast_config"
|
|
|
|
xmlstarlet ed --inplace -u /icecast/authentication/admin-password -v "$icecast_pass" "$icecast_config"
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
|
|
|
# restart in case icecast was already started (like is the case on debian)
|
|
|
|
systemInitCommand restart ${icecast_unit_name}
|
|
|
|
verbose "...Done"
|
2014-12-15 15:54:15 +01:00
|
|
|
fi
|
|
|
|
|
2014-12-16 18:24:41 +01:00
|
|
|
loud "\n-----------------------------------------------------"
|
2014-12-16 22:26:58 +01:00
|
|
|
loud " * Installing Airtime Services * "
|
2014-12-16 18:24:41 +01:00
|
|
|
loud "-----------------------------------------------------"
|
|
|
|
|
2022-01-17 09:26:30 +01:00
|
|
|
LIBRETIME_WORKING_DIR="/var/lib/libretime"
|
|
|
|
|
2020-12-26 12:50:38 +01:00
|
|
|
python_version=$($python_bin --version 2>&1 | awk '{ print $2 }')
|
2020-01-16 15:32:51 +01:00
|
|
|
verbose "Detected Python version: $python_version"
|
2021-10-01 17:37:23 +02:00
|
|
|
pip_cmd="$python_bin -m pip"
|
2022-03-28 15:19:38 +02:00
|
|
|
pip_install="$pip_cmd install --upgrade"
|
2020-01-16 15:32:51 +01:00
|
|
|
|
2015-02-11 00:06:46 +01:00
|
|
|
verbose "\n * Installing necessary python services..."
|
2022-03-28 15:19:38 +02:00
|
|
|
loudCmd "$pip_install setuptools~=58.0"
|
2014-12-19 15:47:54 +01:00
|
|
|
verbose "...Done"
|
2014-12-16 18:24:41 +01:00
|
|
|
|
2022-03-28 15:25:01 +02:00
|
|
|
if [ ! -d /var/log/libretime ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Installing Log Files * "
|
|
|
|
loud "-----------------------------------------------------"
|
2017-05-01 17:53:22 +02:00
|
|
|
|
2022-03-28 15:25:01 +02:00
|
|
|
verbose "\n * Creating /var/log/libretime"
|
2022-01-13 16:11:37 +01:00
|
|
|
mkdir_and_chown "$web_user:$web_user" "/var/log/libretime"
|
2017-05-01 17:53:22 +02:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Copying logrotate files..."
|
2021-10-06 17:32:14 +02:00
|
|
|
loudCmd "cp ${AIRTIMEROOT}/legacy/build/airtime-php.logrotate /etc/logrotate.d/airtime-php"
|
2022-01-03 16:39:29 +01:00
|
|
|
loudCmd "cp ${AIRTIMEROOT}/playout/install/logrotate/libretime-liquidsoap.conf /etc/logrotate.d/libretime-liquidsoap"
|
2017-05-01 17:53:22 +02:00
|
|
|
fi
|
2014-12-17 01:05:17 +01:00
|
|
|
|
2022-01-13 16:11:37 +01:00
|
|
|
verbose "\n * Installing Shared..."
|
2022-03-28 15:19:38 +02:00
|
|
|
loudCmd "$pip_install ${AIRTIMEROOT}/shared"
|
2022-01-13 16:11:37 +01:00
|
|
|
verbose "...Done"
|
|
|
|
|
2015-01-28 00:43:36 +01:00
|
|
|
verbose "\n * Installing API client..."
|
2022-04-04 10:25:38 +02:00
|
|
|
loudCmd "$pip_install ${AIRTIMEROOT}/api-client"
|
2014-12-19 18:26:41 +01:00
|
|
|
verbose "...Done"
|
|
|
|
|
2021-10-17 02:57:09 +02:00
|
|
|
verbose "\n * Installing playout and liquidsoap..."
|
2022-03-28 15:19:38 +02:00
|
|
|
loudCmd "$pip_install ${AIRTIMEROOT}/playout"
|
2022-01-18 05:55:16 +01:00
|
|
|
mkdir_and_chown "${web_user}:${web_user}" "${LIBRETIME_WORKING_DIR}/playout"
|
2021-08-16 17:44:19 +02:00
|
|
|
systemInitInstall libretime-liquidsoap "$web_user"
|
|
|
|
systemInitInstall libretime-playout "$web_user"
|
2015-06-24 01:02:55 +02:00
|
|
|
verbose "...Done"
|
|
|
|
|
2021-10-17 02:46:36 +02:00
|
|
|
verbose "\n * Installing celery..."
|
2022-03-28 15:19:38 +02:00
|
|
|
loudCmd "$pip_install ${AIRTIMEROOT}/worker"
|
2022-02-22 20:03:31 +01:00
|
|
|
mkdir_and_chown "${web_user}:${web_user}" "${LIBRETIME_WORKING_DIR}/worker"
|
2017-03-08 12:39:59 +01:00
|
|
|
# Create the Celery user
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
if $is_centos_dist; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "id celery 2>/dev/null || adduser --no-create-home -c 'LibreTime Celery' -r celery || true"
|
2017-03-08 12:39:59 +01:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "id celery 2>/dev/null || adduser --no-create-home --gecos 'LibreTime Celery' --disabled-login --firstuid 1 --lastuid 999 celery"
|
2017-03-08 12:39:59 +01:00
|
|
|
fi
|
|
|
|
# Add celery to the www-data group
|
|
|
|
loudCmd "usermod -G ${web_user} -a celery"
|
2020-05-19 16:16:31 +02:00
|
|
|
# CentOS installs celery in /usr/bin which differs from other distros. Make
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
# available in /usr/local/bin as systemd requires an absolute path.
|
|
|
|
[[ ! -e /usr/local/bin/celery ]] && ln -s /usr/bin/celery /usr/local/bin/celery
|
2022-02-25 14:53:32 +01:00
|
|
|
systemInitInstall libretime-celery celery
|
2014-12-16 21:45:35 +01:00
|
|
|
verbose "...Done"
|
2014-12-16 18:24:41 +01:00
|
|
|
|
2020-12-30 14:17:50 +01:00
|
|
|
verbose "\n * Installing libretime-analyzer..."
|
2022-03-28 15:19:38 +02:00
|
|
|
loudCmd "$pip_install ${AIRTIMEROOT}/analyzer"
|
2022-01-18 05:55:16 +01:00
|
|
|
mkdir_and_chown "${web_user}:${web_user}" "${LIBRETIME_WORKING_DIR}/analyzer"
|
2021-08-16 17:44:19 +02:00
|
|
|
systemInitInstall libretime-analyzer "$web_user"
|
2014-12-19 15:47:54 +01:00
|
|
|
verbose "...Done"
|
|
|
|
|
2020-01-30 14:47:36 +01:00
|
|
|
verbose "\n * Installing API..."
|
2022-03-28 15:19:38 +02:00
|
|
|
loudCmd "$pip_install ${AIRTIMEROOT}/api[prod]"
|
2021-08-16 17:44:19 +02:00
|
|
|
systemInitInstall libretime-api "$web_user"
|
2020-01-30 14:47:36 +01:00
|
|
|
mkdir -p /etc/airtime
|
|
|
|
sed -e "s@WEB_USER@${web_user}@g" \
|
2021-08-16 13:45:32 +02:00
|
|
|
-e "s@WEB_ROOT@${web_root}@g" \
|
2021-08-16 17:44:19 +02:00
|
|
|
"${AIRTIMEROOT}/installer/uwsgi/libretime-api.ini" > /etc/airtime/libretime-api.ini
|
2020-01-30 14:47:36 +01:00
|
|
|
verbose "...Done"
|
|
|
|
|
2022-03-28 20:56:14 +02:00
|
|
|
verbose "\n * Setting permissions on /var/log/libretime..."
|
2017-05-01 17:53:22 +02:00
|
|
|
# Make the airtime log directory group-writable
|
2022-03-28 20:56:14 +02:00
|
|
|
loudCmd "chmod -R 775 /var/log/libretime"
|
2015-01-14 22:11:49 +01:00
|
|
|
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Configuring PHP in Apache * "
|
|
|
|
loud "-----------------------------------------------------"
|
|
|
|
# Test common locations for php conf directory
|
|
|
|
php_conf_dirs=(
|
2021-11-09 10:21:40 +01:00
|
|
|
"/etc/php/7.4/apache2/conf.d" # Debian Bullseye, Ubuntu Focal
|
2021-08-16 13:45:32 +02:00
|
|
|
"/etc/php/7.3/apache2/conf.d" # Debian Buster
|
|
|
|
"/etc/php/7.2/apache2/conf.d" # Ubuntu Bionic
|
|
|
|
"/etc/php/7.0/apache2/conf.d" # Ubuntu Xenial
|
|
|
|
"/etc/php5/apache2/conf.d" # Debian Stretch, Debian Jessie, Ubuntu Trusty
|
|
|
|
"/etc/php.d" # CentOS 7
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
)
|
2021-11-09 10:21:40 +01:00
|
|
|
|
2021-08-16 17:44:19 +02:00
|
|
|
for php_conf in "${php_conf_dirs[@]}"; do
|
2021-08-16 13:45:32 +02:00
|
|
|
[[ -d $php_conf ]] && break
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
done
|
|
|
|
if [[ -d $php_conf ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
libretime_phpini="${php_conf}/airtime.ini"
|
2017-04-11 03:11:23 +02:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
echo -e "ERROR: PHP Apache configuration folder does not exist or is in an unknown location!" >&2
|
|
|
|
exit 1
|
2017-03-08 12:39:59 +01:00
|
|
|
fi
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
verbose "Detected php conf directory at: $php_conf"
|
2017-03-08 12:39:59 +01:00
|
|
|
if [ ! -f "${libretime_phpini}" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Creating LibreTime PHP config for Apache..."
|
|
|
|
cp ${SCRIPT_DIR}/installer/php/airtime.ini ${libretime_phpini}
|
2014-11-26 16:35:54 +01:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\nAirtime PHP config for Apache already exists, skipping"
|
2014-11-26 16:35:54 +01:00
|
|
|
fi
|
|
|
|
|
2015-02-11 00:06:46 +01:00
|
|
|
# Enable Apache modules
|
2021-11-09 10:21:40 +01:00
|
|
|
if $is_debian_bullseye || $is_ubuntu_focal; then
|
2021-11-04 08:55:50 +01:00
|
|
|
loudCmd "a2enmod rewrite php7.4 proxy proxy_http"
|
|
|
|
elif $is_debian_buster; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "a2enmod rewrite php7.3 proxy proxy_http"
|
2019-01-10 08:08:45 +01:00
|
|
|
elif $is_ubuntu_bionic; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "a2enmod rewrite php7.2 proxy proxy_http"
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
elif $is_centos_dist; then
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "TODO: enable Apache modules mod_rewrite, mod_php, mod_proxy and mod_proxy_http manually"
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
loudCmd "a2enmod rewrite php5 proxy proxy_http"
|
2017-03-08 12:39:59 +01:00
|
|
|
fi
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
|
2018-09-16 14:13:30 +02:00
|
|
|
if [ $skip_postgres -eq 0 ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Configuring PostgreSQL * "
|
|
|
|
loud "-----------------------------------------------------"
|
|
|
|
|
|
|
|
# Ensure postgres is running - It isn't after you install the postgres package on Ubuntu 15.04
|
|
|
|
systemInitCommand start postgresql
|
|
|
|
|
|
|
|
setupAirtimePostgresUser() {
|
|
|
|
# here-doc to execute this block as postgres user
|
|
|
|
su postgres << 'EOF'
|
|
|
|
set +e
|
|
|
|
count=$(psql -d postgres -tAc "SELECT count(*) FROM pg_roles WHERE rolname='airtime';")
|
|
|
|
if [[ $count -eq 0 ]]; then
|
|
|
|
psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;"
|
|
|
|
[[ $? -eq 0 ]] &&
|
|
|
|
echo "Created airtime user in PostgreSQL" ||
|
|
|
|
echo "$0:${FUNCNAME}(): ERROR: Can't create airtime user in PostgreSQL!"
|
|
|
|
else
|
|
|
|
echo "airtime user already exists in PostgreSQL"
|
|
|
|
fi
|
|
|
|
set -e
|
2014-12-15 15:54:15 +01:00
|
|
|
# don't indent this!
|
2014-12-11 22:42:05 +01:00
|
|
|
EOF
|
2021-08-16 13:45:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$postgres" = "t" ]; then
|
|
|
|
setupAirtimePostgresUser
|
|
|
|
elif [ ${_i} -eq 1 ]; then
|
|
|
|
echo -e "Create default airtime postgres user? (Y/n): \c"
|
|
|
|
read IN
|
|
|
|
IN=${IN:-$default_value}
|
2021-08-16 23:00:01 +02:00
|
|
|
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
setupAirtimePostgresUser
|
2014-12-11 21:55:16 +01:00
|
|
|
fi
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2014-12-11 21:55:16 +01:00
|
|
|
fi
|
2014-11-26 16:35:54 +01:00
|
|
|
|
2018-09-16 14:13:30 +02:00
|
|
|
if [ $skip_rabbitmq -eq 0 ]; then
|
2014-11-26 16:35:54 +01:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Configuring RabbitMQ * "
|
|
|
|
loud "-----------------------------------------------------"
|
|
|
|
|
|
|
|
RABBITMQ_VHOST=/airtime
|
|
|
|
RABBITMQ_USER=airtime
|
|
|
|
RABBITMQ_PASSWORD=airtime
|
2021-08-16 23:00:01 +02:00
|
|
|
# EXCHANGES="airtime-pypo|pypo-fetch|airtime-analyzer|media-monitor"
|
2021-08-16 13:45:32 +02:00
|
|
|
|
|
|
|
# Ignore errors in this check to avoid dying when vhost isn't found
|
|
|
|
set +e
|
|
|
|
rabbitmqctl list_vhosts | grep -w "^${RABBITMQ_VHOST}$" > /dev/null
|
|
|
|
RESULT="$?"
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Only run these if the vhost doesn't exist
|
|
|
|
if [ "$RESULT" != "0" ]; then
|
|
|
|
verbose "\n * Creating RabbitMQ user ${RABBITMQ_USER}..."
|
|
|
|
|
|
|
|
rabbitmqctl add_vhost ${RABBITMQ_VHOST}
|
|
|
|
rabbitmqctl add_user ${RABBITMQ_USER} ${RABBITMQ_PASSWORD}
|
|
|
|
else
|
|
|
|
verbose "\nRabbitMQ user already exists, skipping creation"
|
|
|
|
fi
|
2018-09-16 13:55:55 +02:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Setting RabbitMQ user permissions..."
|
|
|
|
#loudCmd "rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} \"$EXCHANGES\" \"$EXCHANGES\" \"$EXCHANGES\""
|
|
|
|
loudCmd "rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} .\* .\* .\*"
|
2018-09-16 13:55:55 +02:00
|
|
|
fi
|
2014-12-09 23:48:16 +01:00
|
|
|
|
2014-12-11 18:58:34 +01:00
|
|
|
if [ ! -d "/etc/airtime" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Installing Libretime * "
|
|
|
|
loud "-----------------------------------------------------"
|
2014-12-11 18:58:34 +01:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Creating /etc/airtime/ directory..."
|
|
|
|
mkdir /etc/airtime
|
2014-12-11 18:58:34 +01:00
|
|
|
fi
|
2017-03-05 01:44:01 +01:00
|
|
|
|
2021-08-11 17:19:23 +02:00
|
|
|
if [ "$icecast" = "t" ]; then
|
|
|
|
if [ ! -e "/etc/airtime/airtime.conf" ] && [ ! -e "/etc/airtime/airtime.conf.tmp" ]; then
|
2020-01-09 13:58:29 +01:00
|
|
|
# need to copy the icecast_pass from temp to /etc/airtime so web-based installer can read it
|
|
|
|
cp /tmp/icecast_pass /etc/airtime/icecast_pass
|
2021-08-11 17:19:23 +02:00
|
|
|
fi
|
2020-01-09 13:58:29 +01:00
|
|
|
fi
|
2017-03-05 01:44:01 +01:00
|
|
|
|
2015-01-13 23:40:31 +01:00
|
|
|
chown -R ${web_user}:${web_user} /etc/airtime
|
2014-12-09 23:48:16 +01:00
|
|
|
|
2014-12-15 15:54:15 +01:00
|
|
|
if [ ! -d "/srv/airtime" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
mkdir -p /srv/airtime
|
2014-12-16 18:24:41 +01:00
|
|
|
fi
|
2015-01-14 22:53:19 +01:00
|
|
|
chown -R ${web_user}:${web_user} /srv/airtime
|
2014-12-16 18:24:41 +01:00
|
|
|
|
2017-03-13 14:10:29 +01:00
|
|
|
# If the user requested it we run restorecon on files that need
|
|
|
|
# tagging for selinux.
|
|
|
|
if [ "$selinux" = "t" ]; then
|
2021-08-16 13:45:32 +02:00
|
|
|
loud "\n-----------------------------------------------------"
|
|
|
|
loud " * Restoring SELinux Tags * "
|
|
|
|
loud "-----------------------------------------------------"
|
2017-03-13 14:10:29 +01:00
|
|
|
|
2021-08-16 13:45:32 +02:00
|
|
|
verbose "\n * Running restorecon..."
|
|
|
|
loudCmd "restorecon -Rv /etc/airtime /srv/airtime > /dev/null 2>&1"
|
|
|
|
verbose "...Done"
|
2017-03-13 14:10:29 +01:00
|
|
|
fi
|
|
|
|
|
2015-02-11 00:06:46 +01:00
|
|
|
verbose "\n * Reloading apache..."
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
systemInitCommand restart ${apache_service}
|
|
|
|
# NOTE: ip command works on all supported platforms
|
|
|
|
if $is_centos_dist; then
|
2021-08-16 13:45:32 +02:00
|
|
|
IP=$(ip -o -4 address show dev eth0 | grep -Po 'inet \K[\d.]+')
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
else
|
2021-08-16 13:45:32 +02:00
|
|
|
# not on centos
|
|
|
|
ip_device="eth0"
|
|
|
|
IP=$(ifconfig ${ip_device} 2> /dev/null | awk -F'[ :]+' '/inet addr:/ {print $4}')
|
2017-03-08 12:39:59 +01:00
|
|
|
fi
|
Installer auto-detects distro, portable system init
The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
|
|
|
verbose "...Done"
|
2015-01-16 23:20:50 +01:00
|
|
|
|
2014-11-26 16:35:54 +01:00
|
|
|
echo -e "\n-----------------------------------------------------"
|
|
|
|
echo " * Basic Setup DONE! * "
|
|
|
|
echo " "
|
2021-11-04 08:55:50 +01:00
|
|
|
echo " To get started with Libretime, visit ${IP} "
|
2015-01-16 23:20:50 +01:00
|
|
|
echo " or, if you've set up your own web configuration, "
|
2021-11-04 08:55:50 +01:00
|
|
|
echo " the Libretime webroot on your webserver "
|
2014-11-26 17:38:53 +01:00
|
|
|
echo "-----------------------------------------------------"
|