summaryrefslogtreecommitdiffstats
path: root/debian/wireless-regdb.postinst
blob: 8432e70f05f9c04d0e40f056a39355d1a94d959e (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
#!/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

    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#