summaryrefslogtreecommitdiffstats
path: root/debian/wireless-regdb.postinst
blob: ddbab2194769ed8e4fa8e44c1c997f6f93dfd404 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

set -e

if [ "$1" = "configure" ]; then
    # d-i currently installs its copies of regulatory.db{,.p7s} as
    # regular files, which we need to remove before running
    # update-alternatives
    if dpkg --compare-versions "$2" lt 2022.04.08-2~; then
	for file in regulatory.db regulatory.db.p7s; do
	    if [ ! -L /lib/firmware/"$file" ] || \
	       [ "$(readlink /lib/firmware/"$file")" != \
		 /etc/alternatives/"$file" ]; then
		rm -f /lib/firmware/"$file"
	    fi
	done
    fi

    # Alternative paths should *not* be moved under /usr/lib
    update-alternatives --install \
	/lib/firmware/regulatory.db regulatory.db /lib/firmware/regulatory.db-debian 100 \
	--slave /lib/firmware/regulatory.db.p7s regulatory.db.p7s /lib/firmware/regulatory.db.p7s-debian
    update-alternatives --install \
	/lib/firmware/regulatory.db regulatory.db /lib/firmware/regulatory.db-upstream 50 \
	--slave /lib/firmware/regulatory.db.p7s regulatory.db.p7s /lib/firmware/regulatory.db.p7s-upstream
fi

#DEBHELPER#