diff --git a/README.md b/README.md index 21e85aee..3ecbaf3f 100644 --- a/README.md +++ b/README.md @@ -147,3 +147,7 @@ services: ### 1. Verify your config.json and package.json syntax Many issues appear because of invalid JSON. A good way to verify your config is to use the [jsonlint.com](http://jsonlint.com/) validator. + +### 2. When running on Synology DSM set the `DSM_HOSTNAME` environment variable + +You may need to provide the server name of your Synology NAS using the `DSM_HOSTNAME` environment variable to prevent [hostname conflict errors](https://github.com/oznu/docker-homebridge/issues/35). The value of the `DSM_HOSTNAME` environment should exactly match the server name as shown under `Synology DSM Control Panel` -> `Info Centre` -> `Server name`, it should contain no spaces or special characters. diff --git a/root/etc/avahi/avahi-daemon.conf b/root/defaults/avahi-daemon.conf similarity index 95% rename from root/etc/avahi/avahi-daemon.conf rename to root/defaults/avahi-daemon.conf index 97cad0c0..5486a179 100644 --- a/root/etc/avahi/avahi-daemon.conf +++ b/root/defaults/avahi-daemon.conf @@ -1,4 +1,5 @@ [server] +#host-name= use-ipv4=yes use-ipv6=no enable-dbus=yes diff --git a/root/etc/cont-init.d/40-dbus b/root/etc/cont-init.d/40-dbus-avahi similarity index 55% rename from root/etc/cont-init.d/40-dbus rename to root/etc/cont-init.d/40-dbus-avahi index cd3e9922..611d41ac 100644 --- a/root/etc/cont-init.d/40-dbus +++ b/root/etc/cont-init.d/40-dbus-avahi @@ -13,3 +13,13 @@ chown messagebus:messagebus /var/run/dbus chown avahi:avahi /var/run/avahi-daemon dbus-uuidgen --ensure sleep 1 + +# avahi config +cp /defaults/avahi-daemon.conf /etc/avahi/avahi-daemon.conf + +# fix for synology dsm - see #35 +if [[ ! -z "$DSM_HOSTNAME" ]]; then + sed -i "s/.*host-name.*/host-name=${DSM_HOSTNAME}/" /etc/avahi/avahi-daemon.conf +else + sed -i "s/.*host-name.*/#host-name=/" /etc/avahi/avahi-daemon.conf +fi