zigbee2mqtt/docker/docker-entrypoint.sh
Gabriele Besta e0a6b7d348
Add possibility to override execution command at runtime (#3722)
* Add possibility to override execution command at runtime

The entrypoint script initialize container data at runtime.
CMD defines the default executable and can be overridden at runtime.

* Set execution permission to entrypoint script

Necessary to prevent run errors, for example in windows env
2020-06-13 13:20:41 +02:00

18 lines
314 B
Bash

#!/bin/sh
set -e
if [ ! -z "$ZIGBEE2MQTT_DATA" ]; then
DATA="$ZIGBEE2MQTT_DATA"
else
DATA="/app/data"
fi
echo "Using '$DATA' as data directory"
if [ ! -f "$DATA/configuration.yaml" ]; then
echo "Creating configuration file..."
cp /app/configuration.yaml "$DATA/configuration.yaml"
fi
exec "$@"