mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-09 17:31:03 +01:00
34 lines
1.2 KiB
Bash
Executable File
34 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bashio
|
|
# shellcheck shell=bash
|
|
set -e
|
|
|
|
#CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
|
#CONFIGSOURCE=$(dirname "$CONFIGSOURCE")
|
|
CONFIGSOURCE="/config/addons_config/zoneminder"
|
|
|
|
# Set image location
|
|
if bashio::config.has_value "Images_location"; then
|
|
IMAGESOURCE=$(bashio::config "Images_location")
|
|
else
|
|
IMAGESOURCE="$CONFIGSOURCE"/images
|
|
fi
|
|
|
|
# Create directory
|
|
echo "... making sure $CONFIGSOURCE exists"
|
|
if [ ! -d "$CONFIGSOURCE" ]; then mkdir "$CONFIGSOURCE"; fi
|
|
if [ ! -d "$CONFIGSOURCE"/events ]; then mkdir "$CONFIGSOURCE"/events; fi
|
|
if [ ! -d "$CONFIGSOURCE"/sounds ]; then mkdir "$CONFIGSOURCE"/sounds; fi
|
|
if [ ! -d "$IMAGESOURCE" ]; then mkdir "$IMAGESOURCE"; fi
|
|
if [ ! -d "$CONFIGSOURCE"/mysql ]; then mkdir "$CONFIGSOURCE"/mysql; fi
|
|
|
|
# Make sure permissions are right
|
|
echo "... checking permissions"
|
|
chown -R "$(id -u):$(id -g)" "$CONFIGSOURCE"/events "$CONFIGSOURCE"/sounds "$IMAGESOURCE"
|
|
chown -R mysql:mysql "$CONFIGSOURCE"/mysql
|
|
|
|
# Make symlinks
|
|
echo "... making symlinks"
|
|
ln -s "$CONFIGSOURCE"/events /var/cache/zoneminder/events2
|
|
ln -s "$CONFIGSOURCE"/sounds /var/cache/zoneminder/sounds2
|
|
ln -s "$IMAGESOURCE" /var/cache/zoneminder/images2
|