feat: drop Ubuntu Bionic support

Fixes #2035
This commit is contained in:
jo 2022-09-09 19:52:46 +02:00 committed by Kyle Robbertze
parent 26bcb6a90d
commit 448cff7600
21 changed files with 54 additions and 196 deletions

49
install
View file

@ -268,11 +268,6 @@ install_service() {
[[ -f "$service_src" ]] || error "service '$service_name' src path '$service_src' does not exists!"
# TODO: Remove when Bionic support is dropped
if [[ $distro == "bionic" ]]; then
mkdir -p "$SERVICE_DIR"
fi
template_file "$service_src" "$service_dest" \
sed \
-e "s|^User=.*|User=${LIBRETIME_USER}|" \
@ -283,13 +278,6 @@ install_service() {
-e "s|@@LOG_DIR@@|${LOG_DIR}|g" \
-e "s|@@WORKING_DIR@@|${WORKING_DIR}|g"
# 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
chmod 0644 "$service_dest"
chown root:root "$service_dest"
systemctl enable "$service_name"
@ -319,12 +307,12 @@ check_distribution() {
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"!
Support for installing LibreTime on Bionic has dropped since 3.1.0.
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.
@ -433,9 +421,7 @@ if $LIBRETIME_SETUP_POSTGRESQL; then
install_packages postgresql postgresql-client
if $is_first_install; then
# TODO: Swap lines when Bionic support is dropped
# if ! sudo -u postgres psql --csv --tuples-only --command='\du' | grep -qw "^$LIBRETIME_POSTGRESQL_USER"; then
if ! sudo -u postgres psql --tuples-only --command='\du' | grep -qw "$LIBRETIME_POSTGRESQL_USER"; then
if ! sudo -u postgres psql --csv --tuples-only --command='\du' | grep -qw "^$LIBRETIME_POSTGRESQL_USER"; then
info "creating PostgreSQL user '$LIBRETIME_POSTGRESQL_USER'"
sudo -u postgres createuser "$LIBRETIME_POSTGRESQL_USER"
sudo -u postgres psql -c "ALTER ROLE $LIBRETIME_POSTGRESQL_USER WITH PASSWORD '$LIBRETIME_POSTGRESQL_PASSWORD';"
@ -446,9 +432,7 @@ if $LIBRETIME_SETUP_POSTGRESQL; then
warning "PostgreSQL user '$LIBRETIME_POSTGRESQL_USER' already exists!"
fi
# TODO: Swap lines when Bionic support is dropped
# if ! sudo -u postgres psql --csv --tuples-only --list | grep -qw "^$LIBRETIME_POSTGRESQL_DATABASE"; then
if ! sudo -u postgres psql --tuples-only --list | grep -qw "$LIBRETIME_POSTGRESQL_DATABASE"; then
if ! sudo -u postgres psql --csv --tuples-only --list | grep -qw "^$LIBRETIME_POSTGRESQL_DATABASE"; then
info "creating PostgreSQL database '$LIBRETIME_POSTGRESQL_DATABASE' with owner '$LIBRETIME_POSTGRESQL_USER'"
sudo -u postgres createdb --template=template0 --encoding=UTF-8 --owner="$LIBRETIME_POSTGRESQL_USER" "$LIBRETIME_POSTGRESQL_DATABASE"
@ -474,9 +458,7 @@ if $LIBRETIME_SETUP_RABBITMQ; then
install_packages rabbitmq-server
if $is_first_install; then
# 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
if ! rabbitmqctl --quiet list_users | grep -qw "^$LIBRETIME_RABBITMQ_USER"; then
info "creating RabbitMQ user '$LIBRETIME_RABBITMQ_USER'"
rabbitmqctl add_user "$LIBRETIME_RABBITMQ_USER" "$LIBRETIME_RABBITMQ_PASSWORD"
@ -486,9 +468,7 @@ if $LIBRETIME_SETUP_RABBITMQ; then
warning "RabbitMQ user '$LIBRETIME_RABBITMQ_USER' already exists!"
fi
# 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
if ! rabbitmqctl --quiet list_vhosts | grep -qw "^$LIBRETIME_RABBITMQ_VHOST"; then
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" '.*' '.*' '.*'
@ -515,11 +495,6 @@ if $LIBRETIME_SETUP_ICECAST; then
install_packages icecast2
systemctl enable icecast2
# TODO: Remove when Bionic support is dropped
if [[ $distro == "bionic" ]]; then
sed --in-place -e "s|^ENABLE=.*$|ENABLE=true|" /etc/default/icecast2
fi
systemctl start icecast2
if $is_first_install; then
@ -568,15 +543,6 @@ section "API"
# shellcheck disable=SC2046
install_packages $(list_packages "$SCRIPT_DIR/api")
# 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
install_python_app "$SCRIPT_DIR/api[prod]"
install_service "libretime-api.service" "$SCRIPT_DIR/api/install/systemd/libretime-api.service"
@ -629,11 +595,6 @@ install_python_app "$SCRIPT_DIR/worker"
info "creating libretime-worker working directory"
mkdir_and_chown "$LIBRETIME_USER" "$WORKING_DIR/worker"
# TODO: Remove when Bionic support is dropped
if [[ $distro == "bionic" ]]; then
ln -sf /bin/sh /usr/bin/sh
fi
install_service "libretime-worker.service" "$SCRIPT_DIR/worker/install/systemd/libretime-worker.service"
# Install Legacy