Skip to content

Commit ab3c3f2

Browse files
committed
raspbiantools: pin Bluez to the RP repos for Buster
Upgrading via 'apt' the Bluez package with a the version from Debian updates will overwrite the RP package. This breaks pairing for some gamepads, thus try to always have installed the RP package. Pin the package so it's always installed/updated from archive.raspberrypi.org on RaspiOS 10 'Buster'. Added a related change to how 'apt' is run when updating from `raspbiantoolsz: * add '--allow-downgrades' to make sure that 'bluez' is retrieved from the RP repos if it was already upgraded by an upstream update.
1 parent a6929be commit ab3c3f2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

scriptmodules/supplementary/raspbiantools.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ function apt_upgrade_raspbiantools() {
1818
# install an older kernel/firmware for stretch to resolve newer kernel issues or unhold if updating to a newer release
1919
stretch_fix_raspbiantools
2020

21+
# on Buster, always install the Bluez package from the RPI repos
22+
buster_bluez_pin_raspbiantools
23+
2124
aptUpdate
22-
apt-get -y dist-upgrade
25+
apt-get -y dist-upgrade --allow-downgrades
2326
}
2427

2528
function lxde_raspbiantools() {
@@ -73,6 +76,19 @@ function stretch_fix_raspbiantools() {
7376
fi
7477
}
7578

79+
function buster_bluez_pin_raspbiantools() {
80+
# pin the 'bluez' package to the RPI repos to prevent any Debian updates overwriting it
81+
# use Priority 1001 to force the the installation even when the Debian package is installed
82+
local pin_file="/etc/apt/preferences.d/01-bluez-pin"
83+
if isPlatform "rpi" && [[ "$__os_debian_ver" -eq 10 && ! -f "$pin_file" ]] ; then
84+
cat << PIN_EOF > "$pin_file"
85+
Package: bluez
86+
Pin: origin archive.raspberrypi.org
87+
Pin-Priority: 1001
88+
PIN_EOF
89+
fi
90+
}
91+
7692
function install_firmware_raspbiantools() {
7793
local ver="$1"
7894
local state="$2"

0 commit comments

Comments
 (0)