Unlocking radios on RPI with a dedicated service

This commit is contained in:
Igor Pecovnik 2025-05-20 13:12:05 +02:00 committed by Igor
parent 4ad0fe50b4
commit a160029eb0

View File

@ -255,6 +255,26 @@ function pre_install_distribution_specific__add_rpi_packages() {
fi
}
function pre_install_distribution_specific__unblock_rfkill() {
# Create a systemd service to unblock rfkill
cat > "${SDCARD}/etc/systemd/system/unblock-rfkill.service" <<- EOT
[Unit]
Description=Unblock rfkill manually (no rfkill binary)
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'for f in /sys/class/rfkill/*/state; do echo 1 > "\$f"; done'
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
EOT
# Enable the service to run at boot
display_alert "Enabling unblock-rfkill service" "bcm2711" "info"
chroot_sdcard systemctl enable unblock-rfkill.service
}
# Our default paritioning system is leaving esp on. Rpi3 is the only board that have issues with this.
# Removing the ESP flag from the boot partition should allow the image to boot on both the RPi3 and RPi4.
function pre_umount_final_image__remove_esp() {