From 1fd85d196c40dc1eb8821c41b599197d7281c1d3 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Thu, 9 Jun 2022 21:25:32 +0200 Subject: [PATCH] update --- seafile/rootfs/etc/cont-init.d/99-run.sh | 15 ++-- seafile/rootfs/etc/cont-init.d/99-run2.sh | 95 ----------------------- 2 files changed, 8 insertions(+), 102 deletions(-) delete mode 100644 seafile/rootfs/etc/cont-init.d/99-run2.sh diff --git a/seafile/rootfs/etc/cont-init.d/99-run.sh b/seafile/rootfs/etc/cont-init.d/99-run.sh index fecb5a899..11d957b4d 100644 --- a/seafile/rootfs/etc/cont-init.d/99-run.sh +++ b/seafile/rootfs/etc/cont-init.d/99-run.sh @@ -25,30 +25,31 @@ sed -i "s|DATABASE_DIR=./db|DATABASE_DIR=$(bashio::config 'data_location'/db)|g" ################### bashio::log.info "Defining database" case $(bashio::config 'database') in - + # Use sqlite - sed -i "s|SQLITE=0|SQLITE=1|g" .env sqlite) + sed -i "s|SQLITE=0|SQLITE=1|g" .env + ;; # Use mariadb mariadb_addon) bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." if ! bashio::services.available 'mysql'; then bashio::log.fatal \ - "Local database access should be provided by the MariaDB addon" + "Local database access should be provided by the MariaDB addon" bashio::exit.nok \ - "Please ensure it is installed and started" + "Please ensure it is installed and started" fi - + # Use values sed -i "s|MYSQL_HOST=db|MYSQL_HOST=$(bashio::services "mysql" "host")|g" .env sed -i "s|MYSQL_USER_PASSWD=secret|MYSQL_USER_PASSWD=$(bashio::services "mysql" "username")|g" .env sed -i "s|MYSQL_ROOT_PASSWD=secret|MYSQL_USER_PASSWD=$(bashio::services "mysql" "password")|g" .env - + bashio::log.warning "This addon is using the Maria DB addon" bashio::log.warning "Please ensure this is included in your backups" bashio::log.warning "Uninstalling the MariaDB addon will remove any data" - ;; + ;; esac ############## diff --git a/seafile/rootfs/etc/cont-init.d/99-run2.sh b/seafile/rootfs/etc/cont-init.d/99-run2.sh deleted file mode 100644 index 7fe4dc6b6..000000000 --- a/seafile/rootfs/etc/cont-init.d/99-run2.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env bashio - -exit 0 - -################# -# DATA LOCATION # -################# - -DATA_LOCATION="$(bashio::config 'data_location')" - -# Chack Seafile dir -bashio::log.info "Making data folder $DATA_LOCATION" - -# Make dir -echo "Checking location exists" -mkdir -p "$DATA_LOCATION" - -# Make dir -echo "Checking permissions" -chown -R "$(id -u)":"$(id -g)" "$DATA_LOCATION" -chmod -R 755 "$DATA_LOCATION" - -# Create symlink -echo "Checking symlink" -ln -fs "$DATA_LOCATION" /shared - -#################### -# GLOBAL VARIABLES # -#################### - -echo "Exporting variables" -export SEAFILE_SERVER_LETSENCRYPT="$(bashio::config 'seafile_server_letsencrypt')" -export SEAFILE_SERVER_HOSTNAME="$(bashio::config 'seafile_server_hostname')" -export SEAFILE_ADMIN_EMAIL="$(bashio::config 'seafile_admin_email')" -export SEAFILE_ADMIN_PASSWORD="$(bashio::config 'seafile_admin_password')" -bashio::log.blue "SEAFILE_SERVER_LETSENCRYPT=$SEAFILE_SERVER_LETSENCRYPT" -bashio::log.blue "SEAFILE_SERVER_HOSTNAME=$SEAFILE_SERVER_HOSTNAME" -bashio::log.blue "SEAFILE_ADMIN_EMAIL=$SEAFILE_ADMIN_EMAIL" -bashio::log.blue "SEAFILE_ADMIN_PASSWORD=$SEAFILE_ADMIN_PASSWORD" - -################### -# Define database # -################### - -bashio::log.info "Defining database" -case $(bashio::config 'database') in - - # Use sqlite - sqlite) - bashio::log.info "Using a local sqlite database" - ehco "Installing sqlite" - apt-get update &>/dev/null \ - apt-get install -y sqlite3 &>/dev/null \ - apt-get clean &>/dev/null - - echo "Configuring sqlite" - sed -i 's/setup-seafile-mysql\.sh/setup-seafile.sh/g' /scripts/bootstrap.py \ - && sed -i '/def wait_for_mysql()/a\\ return' /scripts/utils.py \ - && touch $DATA_LOCATION/seahub.db \ - && ln -fs "$DATA_LOCATION/seahub.db" /opt/seafile - - export SEAFILE_ADMIN_EMAIL=test@test.test - export SEAFILE_ADMIN_PASSWORD=gf7Ads¤f#B2G - export SEAFILE_SERVER_HOSTNAME=seafile.test - ;; - - # Use mariadb - mariadb_addon) - bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." - if ! bashio::services.available 'mysql'; then - bashio::log.fatal \ - "Local database access should be provided by the MariaDB addon" - bashio::exit.nok \ - "Please ensure it is installed and started" - fi - - # Use values - export MYSQL_SERVER=$(bashio::services "mysql" "host") && bashio::log.blue "MYSQL_SERVER=$MYSQL_SERVER" - export MYSQL_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "MYSQL_PORT=$MYSQL_PORT" - export MYSQL_USER=$(bashio::services "mysql" "username") && bashio::log.blue "MYSQL_USER=$MYSQL_USER" - export MYSQL_PORT=$(bashio::services "mysql" "password") && bashio::log.blue "MYSQL_PORT=$MYSQL_PORT" - - bashio::log.warning "This addon is using the Maria DB addon" - bashio::log.warning "Please ensure this is included in your backups" - bashio::log.warning "Uninstalling the MariaDB addon will remove any data" - ;; -esac - -############## -# LAUNCH APP # -############## - -bashio::log.info "Starting app" -#/sbin/my_init -- /scripts/enterpoint.sh -/./docker_entrypoint.sh