1

I use for some testing Raspberry Pis (Stretch) working as WiFi access points. Because i want to work with one global config file on many RPis i split hostapd.conf in 2 parts:

  1. hostapd.conf.global - that describes almost all parameters of my wifi access point.
  2. hostpad.conf.local - where SSID for particular RPi is saved.

Is it possible to join these 2 config files and send it as one to hostapd?
What i've tried, is to send:

cat hostapd.conf.global hostapd.conf.local | hostapd -dd (pipeline command)

but as a result i get then help for hostapd.

I've tried also

cat hostapd.conf.global hostapd.conf.local > hostapd.conf && sudo hostapd -dd hostapd.conf

and this works but isn't the pipeline command equivalent of this?
Is my understanding of pipelining totally wrong?

2 Answers 2

2

The | operator connects the STDOUT from one command to the STDIN of the next command. This will only work with downstream commands that take STDIN as an input.

hostapd doesn't appear to have a parameter for this (many commands allow you to provide - as a filename to indicate that you want it to read from STDIN). Thus, you can't pipe configuration to it because it doesn't know how to consume that.

You could try:

cat hostapd.conf.global hostapd.conf.local | hostapd -dd /dev/stdin

and see if that works.

This is telling hostapd to use /dev/stdin as its configuration file... since you've piped your config files to STDIN, this should have the desired effect.

0
1

Another option is to use configuration management of some sort; this could be as simple as a Makefile

hostapd.conf: hostapd.conf.global hostapd.conf.local
        @cat hostapd.conf.global hostapd.conf.local > hostapd.conf

and then you type make hostapd.conf in that directory before running hostapd. On the more complicated side of things there's Ansible and other such softwares that scale up to larger number of hosts perhaps better than a Makefile does (with a correspondingly larger scale of things you have to learn about and deal with).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .