mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-21 12:08:12 +01:00
First build
This commit is contained in:
16
postgres/rootfs/entrypoint.sh
Normal file
16
postgres/rootfs/entrypoint.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
echo "Starting..."
|
||||
|
||||
####################
|
||||
# Starting scripts #
|
||||
####################
|
||||
|
||||
for SCRIPTS in /etc/cont-init.d/*; do
|
||||
[ -e "$SCRIPTS" ] || continue
|
||||
echo "$SCRIPTS: executing"
|
||||
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
||||
chmod a+x "$SCRIPTS"
|
||||
# Change shebang if no s6 supervision
|
||||
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS"
|
||||
/."$SCRIPTS" || echo "$SCRIPTS: exiting $?"
|
||||
done
|
||||
3
postgres/rootfs/etc/cont-init.d/20-folders.sh
Normal file
3
postgres/rootfs/etc/cont-init.d/20-folders.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
46
postgres/rootfs/etc/cont-init.d/99-run.sh
Normal file
46
postgres/rootfs/etc/cont-init.d/99-run.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Use new config file
|
||||
CONFIG_HOME="$(bashio::config "CONFIG_LOCATION")"
|
||||
CONFIG_HOME="$(dirname "$CONFIG_HOME")"
|
||||
if [ ! -f "$CONFIG_HOME"/postgresql.conf.sample ]; then
|
||||
# Copy default config.env
|
||||
if [ -f /usr/local/share/postgresql/postgresql.conf.sample ]; then
|
||||
cp /usr/local/share/postgresql/postgresql.conf.sample "$CONFIG_HOME"/postgresql.conf
|
||||
elif [ -f /usr/share/postgresql/postgresql.conf.sample ]
|
||||
cp /usr/share/postgresql/postgresql.conf.sample "$CONFIG_HOME"/postgresql.conf
|
||||
else
|
||||
bashio::exit.nok "Config file not found, please ask maintainer"
|
||||
fi
|
||||
bashio::log.warning "A default config.env file was copied in $CONFIG_HOME. Please customize according to https://hub.docker.com/_/postgres and restart the add-on"
|
||||
else
|
||||
bashio::log.warning "The config.env file found in $CONFIG_HOME will be used. Please customize according to https://hub.docker.com/_/postgres and restart the add-on"
|
||||
fi
|
||||
|
||||
# Define home
|
||||
# Creating config location
|
||||
mkdir -p "$PGDATA"
|
||||
chown -R postgres:postgres "$PGDATA"
|
||||
chmod 1777 "$PGDATA"
|
||||
|
||||
# Permissions
|
||||
chmod -R 777 "$CONFIG_HOME"
|
||||
|
||||
# Copy new file
|
||||
cp "$CONFIG_HOME"/postgresql.conf /data/
|
||||
|
||||
##############
|
||||
# Launch App #
|
||||
##############
|
||||
|
||||
# Go to folder
|
||||
cd /data || true
|
||||
|
||||
echo " "
|
||||
bashio::log.info "Starting the app"
|
||||
echo " "
|
||||
|
||||
# Add docker-entrypoint command
|
||||
# shellcheck disable=SC2086
|
||||
docker-entrypoint.sh postgres
|
||||
Reference in New Issue
Block a user