calibre: Fix freedombox.local inaccessible after enabling app

After enabling the calibre app, the app uses IP 127.0.0.1 to advertise
ODPS feeds via BonJour/mDNS. It breaks accessing freedombox.local as it now
points to 127.0.0.1.

This MR disables the BonJour in Calibre.

Fixes #2027.

Tests performed on both Debian stable and testing containers:
- Check the accessability of freedombox.local:
1) Before applying patch:
   - Start the container, check on the host that freedombox.local points to
   correct IP address of the container:
   ```
   host$ avahi-resolve -4 --name freedombox.local
   freedombox.local        10.42.1.166
   ```

   - Enable the calibre app. Check on the host that freedombox.local
   points to wrong ip address 127.0.0.1:
   ```
   host$ avahi-resolve -4 --name freedombox.local
   freedombox.local        127.0.0.1
   ```

2) Stop the calibre app, apply patch (update the calibre systemd service file,
reload systemd), restart the Service Discovery app, check on the host that
freedombox.local points to correct address.

3) Start the calibre app, check on the host that freedombox.local points to
correct address.

- All the calibre functional tests pass.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa 2021-01-30 10:38:42 +02:00 committed by Sunil Mohan Adapa
parent bba1ed618a
commit 11801de288
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -10,7 +10,7 @@ CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SETUID CAP_SETGID CAP_SE
DevicePolicy=closed
Environment=HOME="/var/lib/calibre-server-freedombox"
Environment=DEFAULT_LIBRARY="/var/lib/calibre-server-freedombox/libraries/Library"
Environment=ARGS="--listen-on 127.0.0.1 --url-prefix /calibre --port 8844 --enable-local-write --disable-auth"
Environment=ARGS="--listen-on 127.0.0.1 --url-prefix /calibre --port 8844 --enable-local-write --disable-auth --disable-use-bonjour"
ExecStartPre=sh -e -c "files=$$(ls ${HOME}/libraries/*/metadata.db 2>/dev/null || true); [ \"x$${files}\" = \"x\" ] && (mkdir -p \"${DEFAULT_LIBRARY}\" && calibredb --with-library=\"${DEFAULT_LIBRARY}\" list_categories > /dev/null) || true"
ExecStart=sh -e -c "files=${HOME}/libraries/*/metadata.db; libraries=$$(dirname $${files}) ; exec /usr/bin/calibre-server $ARGS $${libraries}"
Restart=on-failure