Skip to content
Snippets Groups Projects
Commit 9ab9ff59 authored by Arnaud Ferraris's avatar Arnaud Ferraris
Browse files

Add separate udev rules for systemd installs, rework service

On systemd-based systemd, running `bootmac` directly from the `udev`
rules doesn't work very well for bluetooth. As previously noted, using
a systemd service instead fixes those problems, although it requires
finding an appropriate "reverse dependency" (such as e.g.
`bluetooth.target`).

Using unit activation from `udev` makes it easier, at it will be
triggered once the interface exists. Moreover, in order to avoid
creating service files for both wlan and bluetooth, we can make it a
template and use the instance parameter as bootmac's main command-line
argument.
parent f699dbac
No related branches found
No related tags found
1 merge request!12Add separate udev rules for systemd installs, rework service
[Unit]
Description=Set Bluetooth Mac Address
PartOf=bluetooth.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/bootmac --bluetooth
[Install]
WantedBy=bluetooth.target
#
# Configure the MAC addresses of the Bluetooth interface when it appears.
# Copyright (c) Dylan Van Assche (2022)
# SPDX-License-Identifier: GPL-3.0-or-later
#
ACTION=="add", SUBSYSTEM=="bluetooth", KERNEL=="hci0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="bootmac@bluetooth.service"
[Unit]
Description=Set %i MAC address
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/bootmac --%i
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment