Debian Codegraph @

debian/tests/multiarch-remove

raw
1 #!/bin/sh
2
3 set -e
4
5 . debian/tests/lib.sh
6
7 primary_arch="$(dpkg --print-architecture)"
8
9 if [ -n "${DEB_HOST_ARCH-}" ] && [ "$DEB_HOST_ARCH" != "$primary_arch" ]; then
10 secondary_arch="$DEB_HOST_ARCH"
11 else
12 case "$primary_arch" in
13 (amd64)
14 secondary_arch=i386
15 ;;
16
17 (aarch64)
18 secondary_arch=armhf
19 ;;
20
21 (*)
22 echo "1..0 # SKIP this test needs a secondary architecture" >&7
23 exit 77
24 ;;
25 esac
26 fi
27
28 require dpkg --add-architecture $secondary_arch
29 require_apt $secondary_arch
30 require_host_getent "$secondary_arch"
31
32 distinctive_hostname="nss-mdns-test-$(dbus-uuidgen)"
33
34 assert_succeeds avahi-set-host-name "$distinctive_hostname"
35 sleep 3
36
37 assert_succeeds apt-get -y purge libnss-mdns:$primary_arch
38 assert_succeeds apt-get -y purge libnss-mdns:$secondary_arch
39 assert_succeeds perl -i -pe 's/^hosts:.*/hosts: files dns/' /etc/nsswitch.conf
40
41 assert_succeeds apt-get -y install libnss-mdns:$primary_arch
42 assert_hosts "hosts: files mdns4_minimal [NOTFOUND=return] dns"
43 assert_succeeds getent hosts "$distinctive_hostname.local"
44
45 if apt-get -y install libnss-mdns:$primary_arch libnss-mdns:$secondary_arch; then
46 ok "apt-get -y install libnss-mdns:$primary_arch libnss-mdns:$secondary_arch"
47 else
48 skip_to_the_end "could not install libnss-mdns:$primary_arch and :$secondary_arch (multiarch skew?)"
49 fi
50
51 assert_hosts "hosts: files mdns4_minimal [NOTFOUND=return] dns"
52 assert_succeeds getent hosts "$distinctive_hostname.local"
53 assert_succeeds "$host_getent" hosts "$distinctive_hostname.local"
54
55 assert_succeeds apt-get -y remove libnss-mdns:$secondary_arch
56 assert_hosts "hosts: files mdns4_minimal [NOTFOUND=return] dns"
57 assert_succeeds getent hosts "$distinctive_hostname.local"
58 assert_status 2 "$host_getent" hosts "$distinctive_hostname.local"
59
60 assert_succeeds apt-get -y remove libnss-mdns:$primary_arch
61 assert_status 2 getent hosts "$distinctive_hostname.local"
62 assert_status 2 "$host_getent" hosts "$distinctive_hostname.local"
63
64 echo "# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782281"
65 assert_succeeds apt-get -y purge libnss-mdns:$primary_arch
66 assert_succeeds apt-get -y purge libnss-mdns:$secondary_arch
67 assert_hosts "hosts: files dns"
68 assert_status 2 getent hosts "$distinctive_hostname.local"
69 assert_status 2 "$host_getent" hosts "$distinctive_hostname.local"
70
71 finish
72
73 # vim:set sw=4 sts=4 et: