From 35ef070725f5779923bf3ad428b44accddf22dbe Mon Sep 17 00:00:00 2001 From: fabio286 Date: Sat, 1 May 2021 12:16:57 +0200 Subject: [PATCH] fix: support to mDNS/zeroconf in snap build, closes #58 --- snap/snapcraft.yaml | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 20b86875..c5171446 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -14,6 +14,9 @@ confinement: strict architectures: - build-on: amd64 compression: lzo +layout: + /etc/nsswitch.conf: + bind-file: $SNAP/etc/nsswitch.conf parts: antares: @@ -71,11 +74,28 @@ parts: cleanup: after: [antares] plugin: nil - build-snaps: [ gnome-3-28-1804 ] + build-snaps: [gnome-3-28-1804] override-prime: | - set -eux - cd /snap/gnome-3-28-1804/current - find . -type f,l -exec rm -f $SNAPCRAFT_PRIME/{} \; + set -eux + cd /snap/gnome-3-28-1804/current + find . -type f,l -exec rm -f $SNAPCRAFT_PRIME/{} \; + + mdns-lookup: + # Make resolution of ".local" host names (Zero-Conf/mDNS/DNS-SD) + # working: Take the original nsswitch.conf file from the base + # Snap and add "mdns4_minimal [NOTFOUND=return]" to its "hosts:" line + # Also install corresponding mdns4_minimal plug-in + # See: https://forum.snapcraft.io/t/no-mdns-support-in-snaps-should-core-have-a-modified-nsswitch-conf/ + plugin: nil + stage-packages: + - libnss-mdns + override-prime: | + set -eux + sed -Ee 's/^\s*hosts:(\s+)files/hosts:\1files mdns4_minimal \[NOTFOUND=return\]/' /snap/core18/current/etc/nsswitch.conf > $SNAPCRAFT_STAGE/etc/nsswitch.conf + snapcraftctl prime + prime: + - lib/$SNAPCRAFT_ARCH_TRIPLET/libnss_mdns4_minimal* + - etc/nsswitch.conf apps: antares: @@ -93,4 +113,4 @@ apps: - opengl - pulseaudio - removable-media - - unity7 \ No newline at end of file + - unity7