17 lines
506 B
Bash
Executable File
17 lines
506 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
readonly SCRIPT_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
|
|
readonly REPO_DIR=$(cd $(dirname $SCRIPT_DIR) && pwd)
|
|
|
|
echo "Please input the mosquitto password:"
|
|
read -s MOSQUITTO_PASSWORD
|
|
|
|
docker compose run -it --rm mqtt mosquitto_passwd -b -c /mosquitto/config/pwfile homeassistant $MOSQUITTO_PASSWORD
|
|
|
|
chown root:root $REPO_DIR/mosquitto/config/pwfile
|
|
|
|
echo "password: $MOSQUITTO_PASSWORD" > $REPO_DIR/zigbee2mqtt/secret.yaml
|
|
chmod 600 $REPO_DIR/zigbee2mqtt/secret.yaml
|