You are not logged in.
Hi,
I was trying to do mac address spoofing using the method for systemd unit and macchanger described in this tutorial https://wiki.archlinux.org/index.php/MA … s_spoofing.
My operating system is ran on different computers. Therefore, wlan0 might not exist on the other computer.
On boot time, systemd still run macspoof@.service unit. It is basically timing out because wlan0 doesn't exist. I don't want to wait for 2 minutes for the timeout.
Is there a way to tell systemd to not run the unit if interface wlan0 doesn't exist?
I tried with
ConditionPathIsSymbolicLink=/sys/class/net/%i
but it doesn't do as described in the manpage (http://www.freedesktop.org/software/sys … .unit.html).
Here is my macspoof@.service unit:
[Unit]
Description=Run macchanger on %i
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
ConditionPathIsSymbolicLink=/sys/class/net/%i
[Service]
Type=oneshot
ExecStart=/usr/bin/macchanger -e %i
[Install]
WantedBy=multi-user.target
thx for your help!
Last edited by xn2015 (2015-08-31 20:43:54)
Offline
What do you mean "my operating system is ran on different computers"? Are you just copying everything including system-specific configuration files from one computer to another? Why can't you just enable the service for each interface on each computer?
If you're plugging and unplugging an external wi-fi adapter then you should probably use a udev hook to do this.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
What do you mean "my operating system is ran on different computers"? Are you just copying everything including system-specific configuration files from one computer to another? Why can't you just enable the service for each interface on each computer?
It means that my operating system is ran from a USB key. I plug the USB key on different computers to boot up. It is a live system, running from memory.
Offline
Why don't you run the service manually, whenever wlan0 exists.
Offline
It is basically timing out because wlan0 doesn't exist.
[snip]
but it doesn't do as described in the manpage (http://www.freedesktop.org/software/sys … .unit.html).
Could you show the exact messages systemd generates? Did they change after adding that Condition?
The man page describes BindsTo as "very similar in style to Requires=" without going into further details. Perhaps that is part of the problem.
Last edited by Raynman (2015-09-02 09:31:39)
Offline