Fix NetAlertX startup directories

This commit is contained in:
Alexandre
2025-12-01 08:22:47 +01:00
parent 18e98f0417
commit c027a947d1
3 changed files with 18 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
## 25.10.1-4 (02-12-2025)
- Fix addon initialization by creating missing runtime directories and seeding default NetAlertX config/database files for new installs.
## 25.10.1-3 (29-11-2025)
- Breaking change: data directories now use /data symlinks to /config; back up your installation before updating. Migration is supported only from version v25.5.24.
- Added tmpfs support for temporary storage.

View File

@@ -46,4 +46,4 @@ slug: netalertx
tmpfs: true
udev: true
url: https://github.com/alexbelgium/hassio-addons
version: 25.10.1-3
version: 25.10.1-4

View File

@@ -8,6 +8,11 @@ set -e
bashio::log.info "Update structure"
# Ensure required runtime directories exist before any migration
for dir in /data/config /data/db /tmp/api /tmp/log /tmp/run; do
mkdir -p "$dir"
done
# In the addon script, make symlinks on the fly
echo "Creating symlinks"
for folder in config db; do
@@ -30,6 +35,15 @@ for folder in config db; do
ln -sf "$target" /data/"$folder"
done
# Populate missing default files from the application image when available
if [ -f /app/config/app.conf ] && [ ! -f /config/config/app.conf ]; then
cp -n /app/config/app.conf /config/config/app.conf
fi
if [ -f /app/db/app.db ] && [ ! -f /config/db/app.db ]; then
cp -n /app/db/app.db /config/db/app.db
fi
sudo chown -R nginx:www-data /config/db/
sudo chown -R nginx:www-data /config/config/
if [ -f /config/db/app.db ]; then