mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-01 03:36:06 +02:00
Merge branch 'master' of https://github.com/alexbelgium/hassio-addons
This commit is contained in:
@@ -35,6 +35,9 @@ CONFIGSOURCE="$CONFIGLOCATION"/config.yaml
|
|||||||
if bashio::config.has_value 'CONFIG_LOCATION'; then
|
if bashio::config.has_value 'CONFIG_LOCATION'; then
|
||||||
|
|
||||||
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
||||||
|
if [[ "$CONFIGSOURCE" == *.* ]]; then
|
||||||
|
CONFIGSOURCE=$(dirname "$CONFIGSOURCE")
|
||||||
|
fi
|
||||||
# If does not end by config.yaml, remove trailing slash and add config.yaml
|
# If does not end by config.yaml, remove trailing slash and add config.yaml
|
||||||
if [[ "$CONFIGSOURCE" != *".yaml" ]]; then
|
if [[ "$CONFIGSOURCE" != *".yaml" ]]; then
|
||||||
CONFIGSOURCE="${CONFIGSOURCE%/}"/config.yaml
|
CONFIGSOURCE="${CONFIGSOURCE%/}"/config.yaml
|
||||||
|
|||||||
@@ -1,28 +1,6 @@
|
|||||||
#!/command/with-contenv bashio
|
#!/command/with-contenv bashio
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
# Only trap SIGTERM if the script's PID is 1
|
|
||||||
if [ "$$" -eq 1 ]; then
|
|
||||||
echo "PID is 1, trapping SIGTERM..."
|
|
||||||
set -m
|
|
||||||
terminate() {
|
|
||||||
echo "Termination signal received, forwarding to subprocesses..."
|
|
||||||
|
|
||||||
# Check for available commands to terminate subprocesses
|
|
||||||
if command -v pkill &>/dev/null; then
|
|
||||||
pkill -P $$
|
|
||||||
elif command -v kill &>/dev/null; then
|
|
||||||
kill -TERM -- -$$
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Wait for all child processes to terminate
|
|
||||||
wait
|
|
||||||
echo "All subprocesses terminated. Exiting."
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
trap terminate SIGTERM SIGINT
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Starting..."
|
echo "Starting..."
|
||||||
|
|
||||||
####################
|
####################
|
||||||
@@ -34,7 +12,7 @@ for SCRIPTS in /etc/cont-init.d/*; do
|
|||||||
echo "$SCRIPTS: executing"
|
echo "$SCRIPTS: executing"
|
||||||
|
|
||||||
# Check if run as root
|
# Check if run as root
|
||||||
if test "$(id -u)" == 0 && test "$(id -u)" == 0; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
||||||
chmod a+x "$SCRIPTS"
|
chmod a+x "$SCRIPTS"
|
||||||
else
|
else
|
||||||
@@ -49,20 +27,21 @@ for SCRIPTS in /etc/cont-init.d/*; do
|
|||||||
# Get current shebang, if not available use another
|
# Get current shebang, if not available use another
|
||||||
currentshebang="$(sed -n '1{s/^#![[:blank:]]*//p;q}' "$SCRIPTS")"
|
currentshebang="$(sed -n '1{s/^#![[:blank:]]*//p;q}' "$SCRIPTS")"
|
||||||
if [ ! -f "${currentshebang%% *}" ]; then
|
if [ ! -f "${currentshebang%% *}" ]; then
|
||||||
for shebang in "/command/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/bin/bash" "/bin/sh"; do if [ -f "${shebang%% *}" ]; then break; fi; done
|
for shebang in "/command/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/bin/bash" "/bin/sh"; do
|
||||||
|
if [ -f "${shebang%% *}" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
sed -i "s|$currentshebang|$shebang|g" "$SCRIPTS"
|
sed -i "s|$currentshebang|$shebang|g" "$SCRIPTS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use source to share env variables when requested
|
# Use source to share env variables when requested
|
||||||
if [ "${ha_entry_source:-null}" = true ] && command -v "source" &>/dev/null; then
|
if [ "${ha_entry_source:-null}" = true ] && command -v "source" &>/dev/null; then
|
||||||
# Exit cannot be used with source
|
|
||||||
sed -i "s/(.*\s|^)exit ([0-9]+)/\1 return \2 || exit \2/g" "$SCRIPTS"
|
sed -i "s/(.*\s|^)exit ([0-9]+)/\1 return \2 || exit \2/g" "$SCRIPTS"
|
||||||
sed -i "s/bashio::exit.nok/return 1/g" "$SCRIPTS"
|
sed -i "s/bashio::exit.nok/return 1/g" "$SCRIPTS"
|
||||||
sed -i "s/bashio::exit.ok/return 0/g" "$SCRIPTS"
|
sed -i "s/bashio::exit.ok/return 0/g" "$SCRIPTS"
|
||||||
# shellcheck source=/dev/null
|
|
||||||
source "$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
|
source "$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
|
||||||
else
|
else
|
||||||
# Support for posix only shell
|
|
||||||
"$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
|
"$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -74,9 +53,40 @@ done
|
|||||||
# Starting container #
|
# Starting container #
|
||||||
######################
|
######################
|
||||||
|
|
||||||
echo " "
|
# If PID 1, keep alive and manage sigterm
|
||||||
echo -e "\033[0;32mStarting the upstream container\033[0m"
|
if [ "$$" -eq 1 ]; then
|
||||||
echo " "
|
echo " "
|
||||||
|
echo -e "\033[0;32mEverything started!\033[0m"
|
||||||
# Launch lsio mods
|
terminate() {
|
||||||
if [ -f /docker-mods ]; then exec /docker-mods; fi
|
echo "Termination signal received, forwarding to subprocesses..."
|
||||||
|
# Terminate all subprocesses
|
||||||
|
if command -v pgrep &>/dev/null; then
|
||||||
|
for pid in $(pgrep -P $$); do
|
||||||
|
echo "Terminating child PID $pid"
|
||||||
|
kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
# Fallback to iterating through /proc if pgrep is not available
|
||||||
|
for pid in /proc/[0-9]*/; do
|
||||||
|
pid=${pid#/proc/}
|
||||||
|
pid=${pid%/}
|
||||||
|
if [[ "$pid" -ne 1 ]] && grep -q "^PPid:\s*$$" "/proc/$pid/status" 2>/dev/null; then
|
||||||
|
echo "Terminating child PID $pid"
|
||||||
|
kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
wait
|
||||||
|
echo "All subprocesses terminated. Exiting."
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
trap terminate SIGTERM SIGINT
|
||||||
|
while :; do sleep infinity & wait $!; done
|
||||||
|
else
|
||||||
|
echo " "
|
||||||
|
echo -e "\033[0;32mStarting the upstream container\033[0m"
|
||||||
|
echo " "
|
||||||
|
# Launch lsio mods
|
||||||
|
if [ -f /docker-mods ]; then exec /docker-mods; fi
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
## 1.6-3 (05-12-2024)
|
||||||
|
- Minor bugs fixed
|
||||||
|
## 1.6-2 (05-12-2024)
|
||||||
|
- Minor bugs fixed
|
||||||
|
|
||||||
## 1.6 (30-12-2023)
|
## 1.6 (30-12-2023)
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,6 @@
|
|||||||
"slug": "free_games_claimer",
|
"slug": "free_games_claimer",
|
||||||
"udev": true,
|
"udev": true,
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons",
|
"url": "https://github.com/alexbelgium/hassio-addons",
|
||||||
"version": "1.6",
|
"version": "1.6-3",
|
||||||
"webui": "[PROTO:ssl]://[HOST]:[PORT:6080]"
|
"webui": "[PROTO:ssl]://[HOST]:[PORT:6080]"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,29 +6,35 @@ set -e
|
|||||||
# Initialize #
|
# Initialize #
|
||||||
##############
|
##############
|
||||||
|
|
||||||
# Use new config file
|
|
||||||
CONFIG_HOME="$(bashio::config "CONFIG_LOCATION")"
|
CONFIG_HOME="$(bashio::config "CONFIG_LOCATION")"
|
||||||
CONFIG_HOME="$(dirname "$CONFIG_HOME")"
|
CONFIG_HOME="$(dirname "$CONFIG_HOME")"
|
||||||
if [ ! -f "$CONFIG_HOME"/config.env ]; then
|
|
||||||
|
# Use new config file
|
||||||
|
if [ ! -f "$CONFIG_HOME/config.env" ]; then
|
||||||
# Copy default config.env
|
# Copy default config.env
|
||||||
cp /templates/config.env "$CONFIG_HOME"/config.env
|
cp /templates/config.env "$CONFIG_HOME/"
|
||||||
chmod 777 "$CONFIG_HOME"/config.env
|
chmod 755 "$CONFIG_HOME/config.env"
|
||||||
bashio::log.warning "A default config.env file was copied in $CONFIG_HOME. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on"
|
bashio::log.warning "A default config.env file was copied to $CONFIG_HOME. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on"
|
||||||
else
|
else
|
||||||
bashio::log.warning "The config.env file found in $CONFIG_HOME will be used. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on"
|
bashio::log.info "Using existing config.env file in $CONFIG_HOME. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove erroneous folder named config.env
|
||||||
|
if [ -d "$CONFIG_HOME/config.env" ]; then
|
||||||
|
rm -r "$CONFIG_HOME/config.env"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy new file
|
# Copy new file
|
||||||
mkdir -p /data/data
|
mkdir -p /data/data
|
||||||
\cp "$CONFIG_HOME"/config.env /data/data/
|
cp "$CONFIG_HOME/config.env" /data/data/
|
||||||
|
|
||||||
# Permissions
|
# Permissions
|
||||||
chmod -R 777 "$CONFIG_HOME"
|
chmod -R 755 "$CONFIG_HOME"
|
||||||
|
|
||||||
# Export variables
|
# Export variables
|
||||||
set -a
|
set -a
|
||||||
echo ""
|
echo ""
|
||||||
bashio::log.info "Getting variables from $CONFIG_HOME/config.env"
|
bashio::log.info "Sourcing variables from $CONFIG_HOME/config.env"
|
||||||
cp "$CONFIG_HOME"/config.env /config.env
|
cp "$CONFIG_HOME"/config.env /config.env
|
||||||
# Remove previous instance
|
# Remove previous instance
|
||||||
sed -i "s|export ||g" /config.env
|
sed -i "s|export ||g" /config.env
|
||||||
@@ -67,8 +73,7 @@ trim() {
|
|||||||
|
|
||||||
# Add docker-entrypoint command
|
# Add docker-entrypoint command
|
||||||
# Print each value of the array by using the loop
|
# Print each value of the array by using the loop
|
||||||
for val in "${strarr[@]}";
|
for val in "${strarr[@]}"; do
|
||||||
do
|
|
||||||
#Removes whitespaces
|
#Removes whitespaces
|
||||||
val="$(trim "$val")"
|
val="$(trim "$val")"
|
||||||
echo " "
|
echo " "
|
||||||
@@ -78,6 +83,6 @@ do
|
|||||||
echo "$val" | xargs docker-entrypoint.sh || true
|
echo "$val" | xargs docker-entrypoint.sh || true
|
||||||
done
|
done
|
||||||
|
|
||||||
bashio::log.info "All actions concluded, addon will stop in 10 seconds"
|
bashio::log.info "All actions concluded. Stopping in 10 seconds."
|
||||||
sleep 10
|
sleep 10
|
||||||
bashio::addon.stop
|
bashio::addon.stop
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
## ⚠ Open Issue : [🐛 Nextcloud - upload big size files with desktop client - how to change/edit variables, ie: PHP.ini, www.conf, & nextcloud.conf variables - an avoid error 499 from desktop app (big size file) (opened 2024-11-27)](https://github.com/alexbelgium/hassio-addons/issues/1651) by [@aelg305](https://github.com/aelg305)
|
|
||||||
# Home assistant add-on: Nextcloud
|
# Home assistant add-on: Nextcloud
|
||||||
|
|
||||||
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
|
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## 15.7-3 (04-12-2024)
|
## 15.7-4 (05-12-2024)
|
||||||
- Minor bugs fixed
|
- Fix env error
|
||||||
## 15.7-2 (02-12-2024)
|
|
||||||
- Fix database shutdown
|
- Fix database shutdown
|
||||||
|
- Upgrade postgres to 15.7
|
||||||
- Update pgvector to v0.3.0
|
- Update pgvector to v0.3.0
|
||||||
|
|
||||||
## 15.5-7 (24-02-2024)
|
## 15.5-7 (24-02-2024)
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templat
|
|||||||
RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh
|
RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh
|
||||||
|
|
||||||
RUN chmod 777 /docker-entrypoint-initdb.d/* && \
|
RUN chmod 777 /docker-entrypoint-initdb.d/* && \
|
||||||
# Close gracefully
|
sed -i "/Termination signal received/a gosu postgres pg_ctl -D \"\$PGDATA\" -m fast stop" /ha_entrypoint.sh
|
||||||
cat /etc/cont-init.d/99-run.sh >> /ha_entrypoint.sh && \
|
|
||||||
rm /etc/cont-init.d/99-run.sh
|
|
||||||
|
|
||||||
WORKDIR /config
|
WORKDIR /config
|
||||||
ENTRYPOINT [ "/ha_entrypoint.sh" ]
|
ENTRYPOINT [ "/usr/bin/env" ]
|
||||||
|
CMD [ "/ha_entrypoint.sh" ]
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
############
|
############
|
||||||
# 5 Labels #
|
# 5 Labels #
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## ⚠ Open Issue : [🐛 [PostgresSQL] does not get shutdown properly when stopping the addon (opened 2024-12-01)](https://github.com/alexbelgium/hassio-addons/issues/1652) by [@paviro](https://github.com/paviro)
|
## ⚠ Open Issue : [🐛 [Postgres 15] Password is not specified (opened 2024-12-04)](https://github.com/alexbelgium/hassio-addons/issues/1654) by [@Foshkey](https://github.com/Foshkey)
|
||||||
# Home assistant add-on: Postgres
|
# Home assistant add-on: Postgres
|
||||||
|
|
||||||
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
|
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"PGDATA": "/config/database"
|
"PGDATA": "/config/database"
|
||||||
},
|
},
|
||||||
"image": "ghcr.io/alexbelgium/postgres-{arch}",
|
"image": "ghcr.io/alexbelgium/postgres-{arch}",
|
||||||
|
"init": false,
|
||||||
"map": [
|
"map": [
|
||||||
"addon_config:rw",
|
"addon_config:rw",
|
||||||
"homeassistant_config:rw",
|
"homeassistant_config:rw",
|
||||||
@@ -37,5 +38,5 @@
|
|||||||
"slug": "postgres",
|
"slug": "postgres",
|
||||||
"udev": true,
|
"udev": true,
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres",
|
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres",
|
||||||
"version": "15.7-3"
|
"version": "15.7-4"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ echo "DROP EXTENSION IF EXISTS vectors;
|
|||||||
\q"> setup_postgres.sql
|
\q"> setup_postgres.sql
|
||||||
|
|
||||||
# Enable vectors
|
# Enable vectors
|
||||||
psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT" < setup_postgres.sql || true
|
psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT" < setup_postgres.sql >/dev/null || true
|
||||||
|
|||||||
@@ -34,26 +34,11 @@ cd /config || true
|
|||||||
|
|
||||||
bashio::log.info "Starting the app"
|
bashio::log.info "Starting the app"
|
||||||
|
|
||||||
function shutdown_postgres {
|
|
||||||
echo "Received SIGTERM/SIGINT, shutting down PostgreSQL..."
|
|
||||||
gosu postgres pg_ctl -D "$PGDATA" -m fast stop
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
trap 'shutdown_postgres' SIGTERM SIGINT
|
|
||||||
|
|
||||||
# Start background tasks
|
# Start background tasks
|
||||||
if [ "$(bashio::info.arch)" != "armv7" ]; then
|
if [ "$(bashio::info.arch)" != "armv7" ]; then
|
||||||
/./docker-entrypoint-initdb.d/10-vector.sh &
|
/./docker-entrypoint-initdb.d/10-vector.sh & true
|
||||||
VECTOR_PID=$!
|
docker-entrypoint.sh postgres -c shared_preload_libraries=vectors.so & true
|
||||||
|
|
||||||
docker-entrypoint.sh postgres -c shared_preload_libraries=vectors.so &
|
|
||||||
POSTGRES_PID=$!
|
|
||||||
else
|
else
|
||||||
bashio::log.warning "ARMv7 detected: Starting without vectors.so"
|
bashio::log.warning "ARMv7 detected: Starting without vectors.so"
|
||||||
docker-entrypoint.sh postgres &
|
docker-entrypoint.sh postgres & true
|
||||||
POSTGRES_PID=$!
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wait for processes to finish
|
|
||||||
wait "$VECTOR_PID" "$POSTGRES_PID"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user