Last Update: March 21, 2015

WiFi Radar HOWTO

Interpolation Strings in the Configuration File

by Sean Robinson

These interpolated strings can be safely entered into preferences dialog text areas or entered into the config file with a text editor. It is not safe to use interpolated strings in the profile sections.

It is possible to use configuration file options in the value of other options. An example:

[DEFAULT] interface = wlan1 [DHCP] pidfile = /etc/dhcpc/dhcpcd-%(interface)s.pid means that WiFi Radar will use the file /etc/dhcpc/dhcpcd-wlan1.pid for the DHCP PID file.

This is used most heavily in the DHCP and WPA sections of the config file. In fact, the default values for those sections are:

[DHCP] args = -D -o -i dhcp_client -t %(timeout)s command = dhcpcd kill_args = -k pidfile = /etc/dhcpc/dhcpcd-%(interface)s.pid timeout = 20 [WPA] args = -B -i %(interface)s -c %(configuration)s -D %(driver)s -P %(pidfile)s command = /usr/sbin/wpa_supplicant configuration = /etc/wpa_supplicant.conf driver = wext kill_command = pidfile = /var/run/wpa_supplicant.pid

To use interpolated strings, surround any option from the config file with %( and )s. So, to use the interface option from the DEFAULT section in the value of any other option, use %(interface)s in the options value.