base-files: generate /etc/config/wireless, if it doesn't exist
authorMathias Kresin <dev@kresin.me>
Mon, 17 Oct 2016 13:59:12 +0000 (15:59 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 3 Nov 2016 10:08:01 +0000 (11:08 +0100)
This patch adds a check in "wifi detect" to test if the wireless
configuration file does exist. If it doesn't exist, an empty
/etc/config/wireless file will be created.

This is necessary because uci doesn't create new files,
instead the tool just exits with "uci: Entry not found".

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
package/base-files/files/sbin/wifi

index 6bd3544fcbd5bc0a8598cf60c22784874cadfdec..2ef333a78259b87df31305044de445caa5399070 100755 (executable)
@@ -146,6 +146,8 @@ wifi_reload() {
 }
 
 wifi_detect() {
+       [ ! -f /etc/config/wireless ] && touch /etc/config/wireless
+
        for driver in $DRIVERS; do (
                if eval "type detect_$driver" 2>/dev/null >/dev/null; then
                        eval "detect_$driver" || echo "$driver: Detect failed" >&2