#!/bin/sh

. /lib/functions.sh

UCI_CONFIG_DIR="${UCI_CONFIG_DIR:-/etc/config}"
[ -f "$UCI_CONFIG_DIR/tinc" ] || exit 0

add_name_option() {
	local section="$1"
	local name

	config_get name "$section" "name"

	[ -z "$name" ] && uci_set "tinc" "$section" "name" "$section"
}

config_load tinc

config_foreach add_name_option

uci_commit tinc

