2021-08-16 17:44:19 +02:00
|
|
|
#!/usr/bin/env bash
|
2017-03-08 12:39:59 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
set -eu
|
2014-11-26 16:35:54 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
red='\e[0;31m'
|
|
|
|
yellow='\e[1;33m'
|
|
|
|
cyan='\e[0;36m'
|
|
|
|
reset='\e[0m'
|
2014-11-26 16:35:54 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
info() {
|
|
|
|
printf "${cyan}info: $*${reset}\n"
|
2014-12-11 18:58:34 +01:00
|
|
|
}
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
warning() {
|
|
|
|
printf >&2 "${yellow}warning: $*${reset}\n"
|
2014-11-26 16:35:54 +01:00
|
|
|
}
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
error() {
|
|
|
|
printf >&2 "${red}error: $*${reset}\n"
|
|
|
|
exit 1
|
2022-01-13 16:11:37 +01:00
|
|
|
}
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
section() {
|
|
|
|
text="$*"
|
|
|
|
printf -v bar '═%.0s' {1..78}
|
|
|
|
printf -v fill ' %.0s' {1..76}
|
|
|
|
printf "$cyan"
|
|
|
|
printf '╔%s╗\n' "$bar"
|
|
|
|
printf '║ %s ║\n' "${text}${fill:${#text}}"
|
|
|
|
printf '╚%s╝\n' "$bar"
|
|
|
|
printf "$reset"
|
2014-12-11 18:58:34 +01:00
|
|
|
}
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
banner() {
|
|
|
|
printf "${cyan}"
|
|
|
|
cat << EOF
|
2014-12-04 00:04:47 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
██╗ ██╗██████╗ ██████╗ ███████╗████████╗██╗███╗ ███╗███████╗
|
|
|
|
██║ ██║██╔══██╗██╔══██╗██╔════╝╚══██╔══╝██║████╗ ████║██╔════╝
|
|
|
|
██║ ██║██████╔╝██████╔╝█████╗ ██║ ██║██╔████╔██║█████╗
|
|
|
|
██║ ██║██╔══██╗██╔══██╗██╔══╝ ██║ ██║██║╚██╔╝██║██╔══╝
|
|
|
|
███████╗██║██████╔╝██║ ██║███████╗ ██║ ██║██║ ╚═╝ ██║███████╗
|
|
|
|
╚══════╝╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
|
|
|
|
|
|
|
|
EOF
|
|
|
|
printf "${reset}"
|
2014-12-11 21:55:16 +01:00
|
|
|
}
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
SCRIPT_DIR="$( cd "$( dirname "$0")" && pwd)"
|
|
|
|
|
|
|
|
version() {
|
|
|
|
if [ ! -f "$SCRIPT_DIR/VERSION" ]; then
|
|
|
|
make VERSION > /dev/null
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2022-05-23 17:16:02 +02:00
|
|
|
echo "LibreTime Version $(cat "$SCRIPT_DIR/VERSION")"
|
|
|
|
exit 0
|
2015-02-11 00:06:46 +01:00
|
|
|
}
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
usage() {
|
|
|
|
cat >&2 << EOF
|
|
|
|
Usage: $0 [option]... [public_url]
|
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
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
Install LibreTime on the system.
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
|
|
|
--user USER, -u USER User used to run LibreTime.
|
|
|
|
--listen-port PORT, -p PORT Listen port for LibreTime.
|
|
|
|
|
|
|
|
--in-place, -i Install LibreTime in place.
|
|
|
|
|
|
|
|
--no-setup-icecast Do not setup Icecast.
|
|
|
|
--no-setup-postgresql Do not setup Postgresql.
|
|
|
|
--no-setup-rabbitmq Do not setup RabbitMQ.
|
|
|
|
|
2023-02-03 14:18:35 +01:00
|
|
|
--update-nginx Update nginx files during upgrades.
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
Environment variables:
|
|
|
|
|
|
|
|
Advanced options can be changed using environment variables (flags will take
|
|
|
|
precedence over environment variables).
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
while read line; do
|
|
|
|
if echo "$line" | grep -q '^#'; then
|
|
|
|
line="${cyan}${line}${reset}"
|
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
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Pretty print variable definition
|
|
|
|
line=$(echo "$line" | sed -E 's/=\$\{[A-Z_]+\:-(.*)\}/=\1/g')
|
|
|
|
|
|
|
|
printf " ${line}\n"
|
|
|
|
done <<< "$(grep -A1 '^# >' "$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
|
|
|
}
|
|
|
|
|
2022-07-06 14:44:58 +02:00
|
|
|
# Load .env file if exists
|
|
|
|
[[ -f "$SCRIPT_DIR/.env" ]] && source "$SCRIPT_DIR/.env"
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Configuration
|
|
|
|
# > User used to run LibreTime.
|
2022-07-06 16:21:40 +02:00
|
|
|
LIBRETIME_USER=${LIBRETIME_USER:-"libretime"}
|
2022-05-23 17:16:02 +02:00
|
|
|
# > Listen port for LibreTime.
|
|
|
|
LIBRETIME_LISTEN_PORT=${LIBRETIME_LISTEN_PORT:-"80"}
|
|
|
|
# > Public URL for LibreTime.
|
|
|
|
LIBRETIME_PUBLIC_URL=${LIBRETIME_PUBLIC_URL:-}
|
|
|
|
|
|
|
|
# > Install LibreTime in editable mode.
|
|
|
|
# > Will keep working files in the project directory.
|
|
|
|
LIBRETIME_INSTALL_IN_PLACE=${LIBRETIME_INSTALL_IN_PLACE:-false}
|
|
|
|
# > Install a default icecast configuration.
|
|
|
|
LIBRETIME_SETUP_ICECAST=${LIBRETIME_SETUP_ICECAST:-true}
|
|
|
|
# > Create a default postgresql user with a random password.
|
|
|
|
LIBRETIME_SETUP_POSTGRESQL=${LIBRETIME_SETUP_POSTGRESQL:-true}
|
|
|
|
# > Create a default rabbitmq user with a random password.
|
|
|
|
LIBRETIME_SETUP_RABBITMQ=${LIBRETIME_SETUP_RABBITMQ:-true}
|
|
|
|
|
2023-02-03 14:18:35 +01:00
|
|
|
# > Update nginx files during upgrades.
|
|
|
|
LIBRETIME_UPDATE_NGINX=${LIBRETIME_UPDATE_NGINX:-false}
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# > Comma separated list of sections to exclude from packages list.
|
|
|
|
LIBRETIME_PACKAGES_EXCLUDES=${LIBRETIME_PACKAGES_EXCLUDES:-}
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
2021-08-16 13:45:32 +02:00
|
|
|
case "$1" in
|
2022-05-23 17:16:02 +02:00
|
|
|
--user | -u)
|
|
|
|
LIBRETIME_USER=$2
|
|
|
|
shift 2
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
--listen-port | -p)
|
|
|
|
LIBRETIME_LISTEN_PORT=$2
|
|
|
|
shift 2
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
--in-place | -i)
|
|
|
|
LIBRETIME_INSTALL_IN_PLACE=true
|
|
|
|
shift 1
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2023-02-03 14:18:35 +01:00
|
|
|
--update-nginx)
|
|
|
|
LIBRETIME_UPDATE_NGINX=true
|
|
|
|
shift 1
|
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
--no-setup-icecast)
|
|
|
|
LIBRETIME_SETUP_ICECAST=false
|
|
|
|
shift 1
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
--no-setup-postgresql)
|
|
|
|
LIBRETIME_SETUP_POSTGRESQL=false
|
|
|
|
shift 1
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
--no-setup-rabbitmq)
|
|
|
|
LIBRETIME_SETUP_RABBITMQ=false
|
|
|
|
shift 1
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
--packages-excludes)
|
|
|
|
LIBRETIME_PACKAGES_EXCLUDES=$2
|
|
|
|
shift 2
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
--help | -h)
|
|
|
|
usage
|
|
|
|
exit 0
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
--version)
|
|
|
|
version
|
|
|
|
exit 0
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
2022-05-23 17:16:02 +02:00
|
|
|
-*)
|
|
|
|
usage
|
2021-08-16 13:45:32 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
2022-05-23 17:16:02 +02:00
|
|
|
LIBRETIME_PUBLIC_URL=$1
|
|
|
|
shift 1
|
2021-08-16 13:45:32 +02:00
|
|
|
;;
|
|
|
|
esac
|
2014-11-26 16:35:54 +01:00
|
|
|
done
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Variables
|
|
|
|
PYTHON="python3"
|
|
|
|
PIP="$PYTHON -m pip"
|
|
|
|
|
2022-07-06 16:21:40 +02:00
|
|
|
DEFAULT_WEB_USER="www-data"
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Paths
|
|
|
|
CONFIG_DIR="/etc/libretime"
|
|
|
|
CONFIG_FILEPATH="$CONFIG_DIR/config.yml"
|
|
|
|
CONFIG_TMP_FILEPATH="$CONFIG_DIR/config.yml.tmp"
|
|
|
|
CONFIG_EXAMPLE_FILEPATH="$SCRIPT_DIR/installer/config.yml"
|
|
|
|
WORKING_DIR="/var/lib/libretime"
|
|
|
|
LOG_DIR="/var/log/libretime"
|
|
|
|
STORAGE_DIR="/srv/libretime"
|
2022-06-06 00:06:48 +02:00
|
|
|
LEGACY_WEB_ROOT="/usr/share/libretime/legacy"
|
2022-05-23 17:16:02 +02:00
|
|
|
|
|
|
|
SERVICE_DIR="/usr/lib/systemd/system"
|
|
|
|
|
|
|
|
# command_exist <command>
|
|
|
|
command_exist() {
|
|
|
|
command -v "$1" > /dev/null || error "$1 command not found!"
|
|
|
|
}
|
2021-08-17 13:38:31 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# generate_random_password
|
|
|
|
generate_random_password() {
|
|
|
|
tr -cd '[:alnum:]' < /dev/urandom | head -c32
|
|
|
|
}
|
|
|
|
|
|
|
|
# mkdir_and_chown <user> <path>
|
|
|
|
mkdir_and_chown() {
|
|
|
|
mkdir -p "$2"
|
|
|
|
chown -R "$1:$1" "$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
# backup_if_exists <file>
|
|
|
|
backup_if_exists() {
|
|
|
|
if [[ -f "$1" ]]; then
|
|
|
|
backup="$1.$(date --iso-8601=seconds).bak"
|
|
|
|
warning "found existing $1, creating a backup to $backup"
|
|
|
|
mv "$1" "$backup"
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2022-05-23 17:16:02 +02: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
|
|
|
|
2023-02-03 14:07:07 +01:00
|
|
|
# diff_if_exists <src> <dest>
|
|
|
|
diff_if_exists() {
|
|
|
|
src="$1"
|
|
|
|
dest="$2"
|
|
|
|
shift 2
|
|
|
|
|
|
|
|
if [[ -f "$dest" ]]; then
|
|
|
|
src_explicit_filename="$(dirname "$src")/$(basename "$dest").new"
|
|
|
|
cp "$src" "$src_explicit_filename"
|
|
|
|
# print what the existing file $dest would become if $src is copied
|
|
|
|
diff -u --color=always "$dest" "$src_explicit_filename" || :
|
|
|
|
rm -f "$src_explicit_filename"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# cp_if_different <src> <dest>
|
|
|
|
cp_if_different() {
|
|
|
|
if [[ -f "$2" ]] && diff -q "$1" "$2" > /dev/null; then
|
|
|
|
return
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2023-02-03 14:07:07 +01:00
|
|
|
diff_if_exists "$1" "$2"
|
2022-05-23 17:16:02 +02:00
|
|
|
backup_if_exists "$2"
|
|
|
|
cp "$1" "$2"
|
|
|
|
}
|
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
|
|
|
|
2023-02-03 13:15:53 +01:00
|
|
|
# template_file <action> <src> <dest> <render...>
|
2022-05-23 17:16:02 +02:00
|
|
|
template_file() {
|
2023-02-03 13:15:53 +01:00
|
|
|
action="$1"
|
|
|
|
src="$2"
|
|
|
|
dest="$3"
|
|
|
|
shift 3
|
2021-09-02 14:08:20 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
tmp_file=$(mktemp)
|
|
|
|
"$@" "$src" > "$tmp_file"
|
2023-02-03 13:15:53 +01:00
|
|
|
$action "$tmp_file" "$dest"
|
2022-05-23 17:16:02 +02:00
|
|
|
rm "$tmp_file"
|
|
|
|
}
|
2021-09-02 14:11:40 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# set_config <value> <key...>
|
|
|
|
set_config() {
|
|
|
|
value="${1}" && shift
|
2014-12-11 18:58:34 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Build sed query
|
2022-08-01 14:37:19 +02:00
|
|
|
query="/^${1}:/\n"
|
2022-05-23 17:16:02 +02:00
|
|
|
while [[ $# -gt 1 ]]; do
|
|
|
|
shift
|
2022-08-01 14:37:19 +02:00
|
|
|
query+="/${1}:/\n"
|
2022-05-23 17:16:02 +02:00
|
|
|
done
|
2022-08-01 14:37:19 +02:00
|
|
|
query+="s|\(${1}:\).*|\1 ${value}|\n"
|
|
|
|
query+="wq"
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2022-08-01 14:37:19 +02:00
|
|
|
echo -e "$query" | ed --quiet "$CONFIG_TMP_FILEPATH" > /dev/null
|
2022-05-23 17:16:02 +02:00
|
|
|
}
|
2022-04-11 11:44:27 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# install_python_app <path>
|
|
|
|
install_python_app() {
|
|
|
|
info "installing python app from $1"
|
2022-09-01 18:52:35 +02:00
|
|
|
$PIP install \
|
|
|
|
--upgrade \
|
|
|
|
--upgrade-strategy only-if-needed \
|
|
|
|
"$1"
|
2022-05-23 17:16:02 +02:00
|
|
|
}
|
2022-03-26 19:25:31 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# install_service <name> <filepath>
|
|
|
|
#
|
|
|
|
# <filepath> has to be relative to the project root
|
|
|
|
install_service() {
|
|
|
|
command_exist systemctl
|
|
|
|
|
|
|
|
local service_name="$1"
|
|
|
|
local service_src="$2"
|
|
|
|
local service_dest="$SERVICE_DIR/$service_name"
|
|
|
|
|
|
|
|
info "deploying $service_name service"
|
|
|
|
|
|
|
|
[[ -f "$service_src" ]] || error "service '$service_name' src path '$service_src' does not exists!"
|
|
|
|
|
2022-09-01 18:51:48 +02:00
|
|
|
# TODO: Remove when Bionic support is dropped
|
|
|
|
if [[ $distro == "bionic" ]]; then
|
|
|
|
mkdir -p "$SERVICE_DIR"
|
|
|
|
fi
|
|
|
|
|
2023-02-03 13:15:53 +01:00
|
|
|
template_file cp_if_different "$service_src" "$service_dest" \
|
2022-05-23 17:16:02 +02:00
|
|
|
sed \
|
2022-07-06 14:21:55 +02:00
|
|
|
-e "s|^User=.*|User=${LIBRETIME_USER}|" \
|
|
|
|
-e "s|^Group=.*|Group=${LIBRETIME_USER}|" \
|
|
|
|
-e "s|@@DEFAULT_WEB_USER@@|${DEFAULT_WEB_USER}|g" \
|
2022-05-23 17:16:02 +02:00
|
|
|
-e "s|@@CONFIG_DIR@@|${CONFIG_DIR}|g" \
|
|
|
|
-e "s|@@CONFIG_FILEPATH@@|${CONFIG_FILEPATH}|g" \
|
|
|
|
-e "s|@@LOG_DIR@@|${LOG_DIR}|g" \
|
|
|
|
-e "s|@@WORKING_DIR@@|${WORKING_DIR}|g"
|
|
|
|
|
2022-10-10 16:57:56 +02:00
|
|
|
# TODO: Remove when Bionic support is dropped
|
|
|
|
if [[ $distro == "bionic" ]]; then
|
|
|
|
for feature in ProtectClock ProtectHostname ProtectKernelLogs ProtectProc; do
|
|
|
|
sed -i -e "s|^${feature}=|#${feature}=|" "$service_dest"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
chmod 0644 "$service_dest"
|
|
|
|
chown root:root "$service_dest"
|
|
|
|
systemctl enable "$service_name"
|
|
|
|
}
|
|
|
|
|
|
|
|
# service_restart_if_active <name>
|
|
|
|
service_restart_if_active() {
|
|
|
|
if systemctl is-active "$1" > /dev/null; then
|
|
|
|
info "restarting $1 service"
|
|
|
|
systemctl restart "$1"
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2022-05-23 17:16:02 +02:00
|
|
|
}
|
2015-01-15 19:48:40 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
is_ubuntu=false
|
|
|
|
is_debian=false
|
|
|
|
distro="unknown"
|
2015-07-01 06:24:11 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
check_distribution() {
|
|
|
|
local ID="unknown"
|
|
|
|
local VERSION_ID="unknown"
|
2021-09-11 04:45:07 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
if [[ -f "/etc/os-release" ]]; then
|
|
|
|
source "/etc/os-release"
|
|
|
|
fi
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# shellcheck disable=SC2034
|
|
|
|
case "$ID-$VERSION_ID" in
|
|
|
|
debian-10) is_debian=true && distro="buster" ;;
|
|
|
|
debian-11) is_debian=true && distro="bullseye" ;;
|
|
|
|
ubuntu-18.04) is_ubuntu=true && distro="bionic" ;;
|
|
|
|
ubuntu-20.04) is_ubuntu=true && distro="focal" ;;
|
|
|
|
*)
|
|
|
|
error << "EOF"
|
|
|
|
could not determine supported distribution "$ID-$VERSION_ID"!
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2022-09-08 17:49:54 +02:00
|
|
|
Support for installing LibreTime on Xenial has dropped since 3.0.0-alpha.10.
|
|
|
|
Support for installing LibreTime on Stretch has dropped since 3.0.0-alpha.10.
|
|
|
|
Support for installing LibreTime on Jessie has dropped since 3.0.0-alpha.8.
|
2022-05-23 17:16:02 +02:00
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
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
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# list_packages <packages_file>
|
|
|
|
list_packages() {
|
|
|
|
extra_args=()
|
|
|
|
for section in $LIBRETIME_PACKAGES_EXCLUDES; do
|
|
|
|
extra_args+=("--exclude=$section")
|
|
|
|
done
|
|
|
|
|
|
|
|
"$SCRIPT_DIR/tools/packages.py" \
|
|
|
|
"$distro" \
|
|
|
|
"$1" \
|
|
|
|
--format=line \
|
|
|
|
"${extra_args[@]}"
|
|
|
|
}
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
prepare_packages_install() {
|
|
|
|
if $is_ubuntu || $is_debian; then
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get -q update
|
|
|
|
fi
|
2021-05-19 19:22:15 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
if $is_ubuntu; then
|
|
|
|
install_packages software-properties-common
|
|
|
|
add-apt-repository -y ppa:libretime/libretime
|
2021-08-16 13:45:32 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get -q update
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2022-05-23 17:16:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# install_packages <packages...>
|
|
|
|
install_packages() {
|
|
|
|
if $is_ubuntu || $is_debian; then
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get -qq -y install "$@"
|
|
|
|
else
|
|
|
|
warning "installing dependencies is not supported for this distribution"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Prepare
|
|
|
|
########################################################################################
|
|
|
|
|
|
|
|
# Make sure only root can run our script
|
|
|
|
(($( id -u) == 0)) || error "this script must be run as root!"
|
|
|
|
|
|
|
|
banner
|
|
|
|
check_distribution
|
2015-01-14 22:11:49 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
is_first_install=true
|
|
|
|
if [[ -f "$CONFIG_FILEPATH" ]]; then
|
|
|
|
is_first_install=false
|
|
|
|
warning "a configuration file already exists at $CONFIG_FILEPATH, only running upgrade steps!"
|
2021-05-19 19:22:15 +02:00
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
section "Prepare"
|
|
|
|
|
|
|
|
prepare_packages_install
|
|
|
|
|
2022-12-08 17:23:34 +01:00
|
|
|
install_packages sudo git make ed
|
2022-05-23 17:16:02 +02:00
|
|
|
make VERSION
|
|
|
|
|
2022-07-06 16:21:40 +02:00
|
|
|
info "creating project user"
|
|
|
|
if ! id "$LIBRETIME_USER" &> /dev/null; then
|
|
|
|
useradd --no-create-home --home-dir "$WORKING_DIR" "$LIBRETIME_USER"
|
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
info "creating project directories"
|
2022-09-08 18:49:33 +02:00
|
|
|
mkdir -p "$CONFIG_DIR"
|
2022-05-23 17:16:02 +02:00
|
|
|
mkdir_and_chown "$LIBRETIME_USER" "$WORKING_DIR"
|
|
|
|
mkdir_and_chown "$LIBRETIME_USER" "$LOG_DIR"
|
|
|
|
|
|
|
|
if $is_first_install; then
|
|
|
|
[[ -f "$CONFIG_TMP_FILEPATH" ]] || cp "$CONFIG_EXAMPLE_FILEPATH" "$CONFIG_TMP_FILEPATH"
|
|
|
|
chown "$LIBRETIME_USER:$LIBRETIME_USER" "$CONFIG_TMP_FILEPATH"
|
2022-09-08 18:53:52 +02:00
|
|
|
chmod 640 "$CONFIG_TMP_FILEPATH"
|
2022-05-23 17:16:02 +02:00
|
|
|
|
|
|
|
if [[ -n "$LIBRETIME_PUBLIC_URL" ]]; then
|
|
|
|
set_config "$LIBRETIME_PUBLIC_URL" general public_url
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2022-05-23 17:16:02 +02:00
|
|
|
set_config "$(generate_random_password)" general api_key
|
2022-04-18 20:34:38 +02:00
|
|
|
|
|
|
|
mkdir_and_chown "$LIBRETIME_USER" "$STORAGE_DIR"
|
|
|
|
set_config "$STORAGE_DIR" storage path
|
2014-12-11 21:55:16 +01:00
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# PostgreSQL
|
|
|
|
########################################################################################
|
2014-12-19 19:49:33 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# > LibreTime PostgreSQL user
|
|
|
|
LIBRETIME_POSTGRESQL_USER=${LIBRETIME_POSTGRESQL_USER:-"libretime"}
|
|
|
|
# > LibreTime PostgreSQL user password
|
|
|
|
LIBRETIME_POSTGRESQL_PASSWORD=${LIBRETIME_POSTGRESQL_PASSWORD:-$(generate_random_password)}
|
|
|
|
# > LibreTime PostgreSQL database
|
|
|
|
LIBRETIME_POSTGRESQL_DATABASE=${LIBRETIME_POSTGRESQL_DATABASE:-"libretime"}
|
2021-08-16 13:45:32 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
if $LIBRETIME_SETUP_POSTGRESQL; then
|
|
|
|
section "PostgreSQL"
|
|
|
|
install_packages postgresql postgresql-client
|
2014-12-04 00:04:47 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
if $is_first_install; then
|
2022-09-01 18:51:48 +02:00
|
|
|
# TODO: Swap lines when Bionic support is dropped
|
2022-12-08 16:03:36 +01:00
|
|
|
# if ! sudo -iH -u postgres psql --csv --tuples-only --command='\du' | grep -qw "^$LIBRETIME_POSTGRESQL_USER"; then
|
|
|
|
if ! sudo -iH -u postgres psql --tuples-only --command='\du' | grep -qw "$LIBRETIME_POSTGRESQL_USER"; then
|
2022-05-23 17:16:02 +02:00
|
|
|
info "creating PostgreSQL user '$LIBRETIME_POSTGRESQL_USER'"
|
2022-12-08 16:03:36 +01:00
|
|
|
sudo -iH -u postgres createuser "$LIBRETIME_POSTGRESQL_USER"
|
|
|
|
sudo -iH -u postgres psql -c "ALTER ROLE $LIBRETIME_POSTGRESQL_USER WITH PASSWORD '$LIBRETIME_POSTGRESQL_PASSWORD';"
|
2022-04-25 12:46:30 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
set_config "$LIBRETIME_POSTGRESQL_USER" database user
|
|
|
|
set_config "$LIBRETIME_POSTGRESQL_PASSWORD" database password
|
|
|
|
else
|
|
|
|
warning "PostgreSQL user '$LIBRETIME_POSTGRESQL_USER' already exists!"
|
2014-12-04 00:04:47 +01:00
|
|
|
fi
|
|
|
|
|
2022-09-01 18:51:48 +02:00
|
|
|
# TODO: Swap lines when Bionic support is dropped
|
2022-12-08 16:03:36 +01:00
|
|
|
# if ! sudo -iH -u postgres psql --csv --tuples-only --list | grep -qw "^$LIBRETIME_POSTGRESQL_DATABASE"; then
|
|
|
|
if ! sudo -iH -u postgres psql --tuples-only --list | grep -qw "$LIBRETIME_POSTGRESQL_DATABASE"; then
|
2022-05-23 17:16:02 +02:00
|
|
|
info "creating PostgreSQL database '$LIBRETIME_POSTGRESQL_DATABASE' with owner '$LIBRETIME_POSTGRESQL_USER'"
|
2022-12-08 16:03:36 +01:00
|
|
|
sudo -iH -u postgres createdb --template=template0 --encoding=UTF-8 --owner="$LIBRETIME_POSTGRESQL_USER" "$LIBRETIME_POSTGRESQL_DATABASE"
|
2022-05-23 17:16:02 +02:00
|
|
|
|
|
|
|
set_config "$LIBRETIME_POSTGRESQL_DATABASE" database name
|
|
|
|
else
|
|
|
|
warning "PostgreSQL database '$LIBRETIME_POSTGRESQL_DATABASE' already exists!"
|
2014-12-04 00:04:47 +01:00
|
|
|
fi
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2014-12-11 18:58:34 +01:00
|
|
|
fi
|
2014-12-04 00:04:47 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# RabbitMQ
|
|
|
|
########################################################################################
|
|
|
|
|
|
|
|
# > LibreTime RabbitMQ user
|
|
|
|
LIBRETIME_RABBITMQ_USER=${LIBRETIME_RABBITMQ_USER:-"libretime"}
|
|
|
|
# > LibreTime RabbitMQ user password
|
|
|
|
LIBRETIME_RABBITMQ_PASSWORD=${LIBRETIME_RABBITMQ_PASSWORD:-$(generate_random_password)}
|
|
|
|
# > LibreTime RabbitMQ vhost
|
|
|
|
LIBRETIME_RABBITMQ_VHOST=${LIBRETIME_RABBITMQ_VHOST:-"/libretime"}
|
|
|
|
|
|
|
|
if $LIBRETIME_SETUP_RABBITMQ; then
|
|
|
|
section "RabbitMQ"
|
|
|
|
install_packages rabbitmq-server
|
|
|
|
|
|
|
|
if $is_first_install; then
|
2022-09-01 18:51:48 +02:00
|
|
|
# TODO: Swap lines when Bionic support is dropped
|
|
|
|
# if ! rabbitmqctl --quiet list_users | grep -qw "^$LIBRETIME_RABBITMQ_USER"; then
|
|
|
|
if ! rabbitmqctl -q list_users | grep -qw "^$LIBRETIME_RABBITMQ_USER"; then
|
2022-05-23 17:16:02 +02:00
|
|
|
info "creating RabbitMQ user '$LIBRETIME_RABBITMQ_USER'"
|
|
|
|
rabbitmqctl add_user "$LIBRETIME_RABBITMQ_USER" "$LIBRETIME_RABBITMQ_PASSWORD"
|
|
|
|
|
|
|
|
set_config "$LIBRETIME_RABBITMQ_USER" rabbitmq user
|
|
|
|
set_config "$LIBRETIME_RABBITMQ_PASSWORD" rabbitmq password
|
|
|
|
else
|
|
|
|
warning "RabbitMQ user '$LIBRETIME_RABBITMQ_USER' already exists!"
|
|
|
|
fi
|
|
|
|
|
2022-09-01 18:51:48 +02:00
|
|
|
# TODO: Swap lines when Bionic support is dropped
|
|
|
|
# if ! rabbitmqctl --quiet list_vhosts | grep -qw "^$LIBRETIME_RABBITMQ_VHOST"; then
|
|
|
|
if ! rabbitmqctl -q list_vhosts | grep -qw "^$LIBRETIME_RABBITMQ_VHOST"; then
|
2022-05-23 17:16:02 +02:00
|
|
|
info "creating RabbitMQ vhost '$LIBRETIME_RABBITMQ_VHOST' with owner '$LIBRETIME_RABBITMQ_USER'"
|
|
|
|
rabbitmqctl add_vhost "$LIBRETIME_RABBITMQ_VHOST"
|
|
|
|
rabbitmqctl set_permissions -p "$LIBRETIME_RABBITMQ_VHOST" "$LIBRETIME_RABBITMQ_USER" '.*' '.*' '.*'
|
|
|
|
|
|
|
|
set_config "$LIBRETIME_RABBITMQ_VHOST" rabbitmq vhost
|
|
|
|
else
|
|
|
|
warning "RabbitMQ vhost '$LIBRETIME_RABBITMQ_VHOST' already exists!"
|
|
|
|
fi
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2014-12-16 18:24:41 +01:00
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Icecast
|
|
|
|
########################################################################################
|
2021-08-16 13:45:32 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# > LibreTime Icecast admin password
|
|
|
|
LIBRETIME_ICECAST_ADMIN_PASSWORD=${LIBRETIME_ICECAST_ADMIN_PASSWORD:-$(generate_random_password)}
|
|
|
|
# > LibreTime Icecast source password
|
|
|
|
LIBRETIME_ICECAST_SOURCE_PASSWORD=${LIBRETIME_ICECAST_SOURCE_PASSWORD:-$(generate_random_password)}
|
|
|
|
# > LibreTime Icecast relay password
|
|
|
|
LIBRETIME_ICECAST_RELAY_PASSWORD=${LIBRETIME_ICECAST_RELAY_PASSWORD:-$(generate_random_password)}
|
|
|
|
|
|
|
|
if $LIBRETIME_SETUP_ICECAST; then
|
|
|
|
section "Icecast"
|
|
|
|
install_packages icecast2
|
|
|
|
systemctl enable icecast2
|
2022-09-01 18:51:48 +02:00
|
|
|
|
|
|
|
# TODO: Remove when Bionic support is dropped
|
|
|
|
if [[ $distro == "bionic" ]]; then
|
|
|
|
sed --in-place -e "s|^ENABLE=.*$|ENABLE=true|" /etc/default/icecast2
|
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
systemctl start icecast2
|
|
|
|
|
|
|
|
if $is_first_install; then
|
|
|
|
icecast_config_filepath="/etc/icecast2/icecast.xml"
|
|
|
|
|
|
|
|
sed --in-place \
|
|
|
|
-e "s|<admin-password>[^<]*</admin-password>|<admin-password>${LIBRETIME_ICECAST_ADMIN_PASSWORD}</admin-password>|" \
|
|
|
|
-e "s|<source-password>[^<]*</source-password>|<source-password>${LIBRETIME_ICECAST_SOURCE_PASSWORD}</source-password>|" \
|
|
|
|
-e "s|<relay-password>[^<]*</relay-password>|<relay-password>${LIBRETIME_ICECAST_RELAY_PASSWORD}</relay-password>|" \
|
|
|
|
"$icecast_config_filepath"
|
|
|
|
|
|
|
|
service_restart_if_active icecast2
|
|
|
|
|
2022-08-01 16:12:30 +02:00
|
|
|
set_config "$LIBRETIME_ICECAST_ADMIN_PASSWORD" stream outputs .default_icecast_output admin_password
|
|
|
|
set_config "$LIBRETIME_ICECAST_SOURCE_PASSWORD" stream outputs .default_icecast_output source_password
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2014-12-15 15:54:15 +01:00
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Prepare python
|
|
|
|
########################################################################################
|
2014-12-16 18:24:41 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
section "Python3"
|
2022-09-01 18:51:48 +02:00
|
|
|
install_packages python3 python3-pip python3-wheel
|
2022-01-17 09:26:30 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
info "upgrading python3 tools"
|
|
|
|
$PIP install --upgrade setuptools~=58.0
|
2020-01-16 15:32:51 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Install Shared and API client
|
|
|
|
########################################################################################
|
2014-12-16 18:24:41 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
section "Shared"
|
2022-09-08 17:50:39 +02:00
|
|
|
|
|
|
|
# shellcheck disable=SC2046
|
|
|
|
install_packages $(list_packages "$SCRIPT_DIR/shared")
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
install_python_app "$SCRIPT_DIR/shared"
|
2017-05-01 17:53:22 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
section "API client"
|
|
|
|
install_python_app "$SCRIPT_DIR/api-client"
|
2017-05-01 17:53:22 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Install API
|
|
|
|
########################################################################################
|
2014-12-17 01:05:17 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
section "API"
|
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
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# shellcheck disable=SC2046
|
|
|
|
install_packages $(list_packages "$SCRIPT_DIR/api")
|
2014-11-26 16:35:54 +01:00
|
|
|
|
2022-09-01 15:51:09 +02:00
|
|
|
# TODO: Remove when Bionic support is dropped
|
|
|
|
if [[ $distro == "bionic" ]]; then
|
|
|
|
info "installing gunicorn"
|
|
|
|
$PIP install \
|
|
|
|
'gunicorn' \
|
|
|
|
'uvicorn>=0.16.0,<0.17'
|
|
|
|
ln -sf /usr/local/bin/gunicorn /usr/bin/gunicorn
|
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
install_python_app "$SCRIPT_DIR/api[prod]"
|
2014-11-26 16:35:54 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
install_service "libretime-api.service" "$SCRIPT_DIR/api/install/systemd/libretime-api.service"
|
2022-07-06 14:21:55 +02:00
|
|
|
install_service "libretime-api.socket" "$SCRIPT_DIR/api/install/systemd/libretime-api.socket"
|
2021-08-16 13:45:32 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Install Playout
|
|
|
|
########################################################################################
|
2021-08-16 13:45:32 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
section "Playout"
|
2021-08-16 13:45:32 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# shellcheck disable=SC2046
|
|
|
|
install_packages $(list_packages "$SCRIPT_DIR/playout")
|
2021-08-16 13:45:32 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
install_python_app "$SCRIPT_DIR/playout"
|
|
|
|
|
|
|
|
info "creating libretime-playout working directory"
|
|
|
|
mkdir_and_chown "$LIBRETIME_USER" "$WORKING_DIR/playout"
|
|
|
|
|
|
|
|
install_service "libretime-liquidsoap.service" "$SCRIPT_DIR/playout/install/systemd/libretime-liquidsoap.service"
|
|
|
|
install_service "libretime-playout.service" "$SCRIPT_DIR/playout/install/systemd/libretime-playout.service"
|
|
|
|
|
|
|
|
info "deploying libretime-liquidsoap logrotate config"
|
2023-02-03 13:15:53 +01:00
|
|
|
template_file cp_if_different \
|
|
|
|
"$SCRIPT_DIR/playout/install/logrotate/libretime-liquidsoap.conf" \
|
|
|
|
"/etc/logrotate.d/libretime-liquidsoap" \
|
2022-05-23 17:16:02 +02:00
|
|
|
sed \
|
|
|
|
-e "s|@@LOG_DIR@@|${LOG_DIR}|g" \
|
|
|
|
-e "s|@@USER@@|${LIBRETIME_USER}|g"
|
|
|
|
|
|
|
|
# Install Analyzer
|
|
|
|
########################################################################################
|
|
|
|
|
|
|
|
section "Analyzer"
|
|
|
|
|
|
|
|
# shellcheck disable=SC2046
|
|
|
|
install_packages $(list_packages "$SCRIPT_DIR/analyzer")
|
|
|
|
|
|
|
|
install_python_app "$SCRIPT_DIR/analyzer"
|
|
|
|
|
|
|
|
info "creating libretime-analyzer working directory"
|
|
|
|
mkdir_and_chown "$LIBRETIME_USER" "$WORKING_DIR/analyzer"
|
|
|
|
|
|
|
|
install_service "libretime-analyzer.service" "$SCRIPT_DIR/analyzer/install/systemd/libretime-analyzer.service"
|
|
|
|
|
|
|
|
# Install Worker
|
|
|
|
########################################################################################
|
|
|
|
|
|
|
|
section "Worker"
|
|
|
|
|
|
|
|
install_python_app "$SCRIPT_DIR/worker"
|
|
|
|
|
2022-08-20 08:13:30 +02:00
|
|
|
info "creating libretime-worker working directory"
|
2022-05-23 17:16:02 +02:00
|
|
|
mkdir_and_chown "$LIBRETIME_USER" "$WORKING_DIR/worker"
|
|
|
|
|
2022-09-01 18:51:48 +02:00
|
|
|
# TODO: Remove when Bionic support is dropped
|
|
|
|
if [[ $distro == "bionic" ]]; then
|
|
|
|
ln -sf /bin/sh /usr/bin/sh
|
|
|
|
fi
|
|
|
|
|
2022-08-20 08:13:30 +02:00
|
|
|
install_service "libretime-worker.service" "$SCRIPT_DIR/worker/install/systemd/libretime-worker.service"
|
2022-05-23 17:16:02 +02:00
|
|
|
|
|
|
|
# Install Legacy
|
|
|
|
########################################################################################
|
|
|
|
|
|
|
|
section "Legacy"
|
|
|
|
|
|
|
|
install_composer() {
|
|
|
|
install_packages unzip
|
|
|
|
|
|
|
|
curl -sS https://composer.github.io/installer.sig > installer.sig
|
|
|
|
echo " composer-setup.php" >> installer.sig
|
|
|
|
|
|
|
|
curl -sS https://getcomposer.org/installer > composer-setup.php
|
|
|
|
|
|
|
|
if ! sha384sum installer.sig; then
|
|
|
|
rm -f composer-setup.php
|
|
|
|
error "invalid composer-setup.php checksum"
|
2021-08-16 13:45:32 +02:00
|
|
|
fi
|
2018-09-16 13:55:55 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
php -f composer-setup.php -- \
|
|
|
|
--install-dir=/usr/local/bin \
|
|
|
|
--filename=composer \
|
|
|
|
--quiet
|
2014-12-09 23:48:16 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
rm -f composer-setup.php installer.sig
|
|
|
|
}
|
2014-12-11 18:58:34 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# shellcheck disable=SC2046
|
|
|
|
install_packages $(list_packages "$SCRIPT_DIR/legacy")
|
|
|
|
|
|
|
|
if ! command -v "composer" > /dev/null; then
|
|
|
|
info "installing Composer"
|
|
|
|
install_composer
|
2014-12-11 18:58:34 +01:00
|
|
|
fi
|
2017-03-05 01:44:01 +01:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
info "building libretime-legacy files"
|
|
|
|
make -C legacy build
|
|
|
|
cp "$SCRIPT_DIR/VERSION" "$SCRIPT_DIR/legacy/"
|
|
|
|
|
|
|
|
info "deploying libretime-legacy files"
|
|
|
|
if $LIBRETIME_INSTALL_IN_PLACE; then
|
|
|
|
LEGACY_WEB_ROOT="$SCRIPT_DIR/legacy"
|
|
|
|
else
|
2022-07-27 09:51:34 +02:00
|
|
|
if [[ -d "$LEGACY_WEB_ROOT" ]]; then
|
|
|
|
info "cleaning old libretime-legacy files"
|
|
|
|
rm -Rf "$LEGACY_WEB_ROOT"
|
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
mkdir_and_chown "$LIBRETIME_USER" "$LEGACY_WEB_ROOT"
|
|
|
|
cp -R "$SCRIPT_DIR/legacy/." "$LEGACY_WEB_ROOT"
|
|
|
|
chown -R "$LIBRETIME_USER:$LIBRETIME_USER" "$LEGACY_WEB_ROOT"
|
2020-01-09 13:58:29 +01:00
|
|
|
fi
|
2017-03-05 01:44:01 +01:00
|
|
|
|
2022-07-06 16:23:52 +02:00
|
|
|
PHP_VERSION="$(php-config --version | awk -F . '{ print $1 "." $2 }')"
|
|
|
|
|
|
|
|
info "deploying libretime-legacy php-fpm config"
|
2023-02-03 13:15:53 +01:00
|
|
|
template_file cp_if_different \
|
|
|
|
"$SCRIPT_DIR/legacy/install/php-fpm/libretime-legacy.conf" \
|
|
|
|
"/etc/php/$PHP_VERSION/fpm/pool.d/libretime-legacy.conf" \
|
2022-07-06 16:23:52 +02:00
|
|
|
sed \
|
|
|
|
-e "s|@@DEFAULT_WEB_USER@@|${DEFAULT_WEB_USER}|g" \
|
|
|
|
-e "s|@@USER@@|${LIBRETIME_USER}|g"
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
info "deploying libretime-legacy logrotate config"
|
2023-02-03 13:15:53 +01:00
|
|
|
template_file cp_if_different \
|
|
|
|
"$SCRIPT_DIR/legacy/install/logrotate/libretime-legacy.conf" \
|
|
|
|
"/etc/logrotate.d/libretime-legacy" \
|
2022-05-23 17:16:02 +02:00
|
|
|
sed \
|
|
|
|
-e "s|@@LOG_DIR@@|${LOG_DIR}|g" \
|
|
|
|
-e "s|@@USER@@|${LIBRETIME_USER}|g"
|
|
|
|
|
2022-07-06 16:23:52 +02:00
|
|
|
# Install Nginx
|
2022-05-23 17:16:02 +02:00
|
|
|
########################################################################################
|
|
|
|
|
2022-07-06 16:23:52 +02:00
|
|
|
section "Nginx"
|
2022-05-23 17:16:02 +02:00
|
|
|
|
2023-02-03 14:18:35 +01:00
|
|
|
if $is_first_install || $LIBRETIME_UPDATE_NGINX; then
|
|
|
|
install_packages nginx
|
2014-12-09 23:48:16 +01:00
|
|
|
|
2023-02-03 14:18:35 +01:00
|
|
|
info "disabling nginx default site"
|
|
|
|
rm -f "/etc/nginx/sites-enabled/default"
|
|
|
|
fi
|
2022-05-23 17:16:02 +02:00
|
|
|
|
2023-02-03 14:18:35 +01:00
|
|
|
nginx_config_template_args=(
|
|
|
|
"${SCRIPT_DIR}/installer/nginx/libretime.conf"
|
|
|
|
"/etc/nginx/sites-available/libretime.conf"
|
|
|
|
sed
|
|
|
|
-e "s|@@LISTEN_PORT@@|${LIBRETIME_LISTEN_PORT}|g"
|
2022-05-23 17:16:02 +02:00
|
|
|
-e "s|@@LEGACY_WEB_ROOT@@|${LEGACY_WEB_ROOT}|g"
|
2023-02-03 14:18:35 +01:00
|
|
|
)
|
2022-05-23 17:16:02 +02:00
|
|
|
|
2023-02-03 14:18:35 +01:00
|
|
|
if $is_first_install || $LIBRETIME_UPDATE_NGINX; then
|
|
|
|
info "deploying libretime nginx config"
|
|
|
|
template_file cp_if_different "${nginx_config_template_args[@]}"
|
|
|
|
else
|
|
|
|
info "printing libretime nginx config differences"
|
|
|
|
template_file diff_if_exists "${nginx_config_template_args[@]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $is_first_install || $LIBRETIME_UPDATE_NGINX; then
|
|
|
|
info "enabling libretime nginx config"
|
|
|
|
ln -s --force \
|
|
|
|
"/etc/nginx/sites-available/libretime.conf" \
|
|
|
|
"/etc/nginx/sites-enabled/libretime.conf"
|
|
|
|
fi
|
2022-05-23 17:16:02 +02:00
|
|
|
|
|
|
|
# Finalize
|
|
|
|
########################################################################################
|
|
|
|
|
|
|
|
if $is_first_install; then
|
|
|
|
section "Finalize"
|
|
|
|
info "moving config file in place"
|
|
|
|
mv "$CONFIG_TMP_FILEPATH" "$CONFIG_FILEPATH"
|
2017-03-13 14:10:29 +01:00
|
|
|
fi
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Services
|
|
|
|
########################################################################################
|
|
|
|
|
|
|
|
section "Services"
|
2022-05-08 19:20:03 +02:00
|
|
|
|
|
|
|
install_service "libretime.target" "$SCRIPT_DIR/installer/systemd/libretime.target"
|
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
systemctl daemon-reload
|
|
|
|
|
2022-07-06 16:23:52 +02:00
|
|
|
service_restart_if_active "php$PHP_VERSION-fpm"
|
|
|
|
service_restart_if_active "nginx"
|
2022-04-25 12:46:30 +02:00
|
|
|
|
2022-05-23 17:16:02 +02:00
|
|
|
# Instructions
|
|
|
|
########################################################################################
|
|
|
|
|
|
|
|
if $is_first_install; then
|
|
|
|
section "Instructions"
|
2022-05-08 16:20:52 +02:00
|
|
|
printf "
|
|
|
|
${yellow}\
|
|
|
|
To finalize the installation process, start by editing your configuration file $CONFIG_FILEPATH.
|
|
|
|
|
|
|
|
Once configured, run the following command to setup the database:
|
|
|
|
|
|
|
|
${cyan}\
|
|
|
|
$ sudo -u $LIBRETIME_USER libretime-api migrate
|
|
|
|
|
2022-05-08 19:20:03 +02:00
|
|
|
${yellow}\
|
|
|
|
Finally, start LibreTime using the following command:
|
|
|
|
|
|
|
|
${cyan}\
|
|
|
|
$ sudo systemctl start libretime.target
|
|
|
|
|
2022-07-17 23:58:51 +02:00
|
|
|
${reset}"
|
|
|
|
|
|
|
|
else
|
|
|
|
printf "
|
2022-09-15 16:07:13 +02:00
|
|
|
${yellow}\
|
|
|
|
Once upgraded, run the following command to migrate the database:
|
|
|
|
|
|
|
|
${cyan}\
|
|
|
|
$ sudo -u $LIBRETIME_USER libretime-api migrate
|
|
|
|
|
2022-07-17 23:58:51 +02:00
|
|
|
${yellow}\
|
|
|
|
You can restart LibreTime using the following command:
|
|
|
|
|
|
|
|
${cyan}\
|
|
|
|
$ sudo systemctl restart libretime.target
|
|
|
|
|
2022-05-08 16:20:52 +02:00
|
|
|
${reset}"
|
2017-03-08 12:39:59 +01:00
|
|
|
fi
|