From ba41c5f1b5bf8c9f1dbaed021c2d3f44e63c0a5a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 16 Jul 2025 20:49:08 +0000 Subject: [PATCH] GitHub bot: fix linting issues (nobuild) --- ente/rootfs/etc/cont-init.d/99-run.sh | 46 +++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) mode change 100755 => 100644 ente/rootfs/etc/cont-init.d/99-run.sh diff --git a/ente/rootfs/etc/cont-init.d/99-run.sh b/ente/rootfs/etc/cont-init.d/99-run.sh old mode 100755 new mode 100644 index f45acbf35..f41ab1c02 --- a/ente/rootfs/etc/cont-init.d/99-run.sh +++ b/ente/rootfs/etc/cont-init.d/99-run.sh @@ -104,33 +104,33 @@ wait_postgres_ready() { } bootstrap_internal_db() { - if $USE_EXTERNAL_DB; then - return 0 - fi + if $USE_EXTERNAL_DB; then + return 0 + fi - bashio::log.info "Creating role/database if needed..." + bashio::log.info "Creating role/database if needed..." - # Create role if it doesn't exist, else update password to match config - if ! psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname = '${DB_USER}'" | grep -q 1; then - psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres \ - -c "CREATE ROLE \"${DB_USER}\" LOGIN PASSWORD '${DB_PASS//\'/\'\'}';" - else - # update password in case it changed - psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres \ - -c "ALTER ROLE \"${DB_USER}\" PASSWORD '${DB_PASS//\'/\'\'}';" - fi + # Create role if it doesn't exist, else update password to match config + if ! psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname = '${DB_USER}'" | grep -q 1; then + psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres \ + -c "CREATE ROLE \"${DB_USER}\" LOGIN PASSWORD '${DB_PASS//\'/\'\'}';" + else + # update password in case it changed + psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres \ + -c "ALTER ROLE \"${DB_USER}\" PASSWORD '${DB_PASS//\'/\'\'}';" + fi - # Check and create database if it doesn't exist - if ! psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres -tAc "SELECT 1 FROM pg_database WHERE datname = '${DB_NAME}'" | grep -q 1; then - psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres \ - -c "CREATE DATABASE \"${DB_NAME}\" OWNER \"${DB_USER}\";" - else - # Optional: ensure DB ownership - psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres \ - -c "ALTER DATABASE \"${DB_NAME}\" OWNER TO \"${DB_USER}\";" - fi + # Check and create database if it doesn't exist + if ! psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres -tAc "SELECT 1 FROM pg_database WHERE datname = '${DB_NAME}'" | grep -q 1; then + psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres \ + -c "CREATE DATABASE \"${DB_NAME}\" OWNER \"${DB_USER}\";" + else + # Optional: ensure DB ownership + psql -v ON_ERROR_STOP=1 -h "$DB_HOST_INTERNAL" -p "$DB_PORT_INTERNAL" -U postgres \ + -c "ALTER DATABASE \"${DB_NAME}\" OWNER TO \"${DB_USER}\";" + fi - bashio::log.info "Internal Postgres ready." + bashio::log.info "Internal Postgres ready." } start_minio() {