add nodes2bathosts script
This commit is contained in:
parent
ec7b89c670
commit
2ebf716ca9
1
mkmap.sh
1
mkmap.sh
|
@ -21,3 +21,4 @@ batctl vd json | "$(dirname "$0")"/bat2nodes.py -a "$(dirname "$0")"/aliases.jso
|
||||||
|
|
||||||
mv $DEST/nodes.json.new $DEST/nodes.json
|
mv $DEST/nodes.json.new $DEST/nodes.json
|
||||||
|
|
||||||
|
"$(dirname "$0")"/nodes2bathosts.py < $DEST/nodes.json > /etc/bat-hosts
|
||||||
|
|
11
nodes2bathosts.py
Executable file
11
nodes2bathosts.py
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
nodes = json.load(sys.stdin)
|
||||||
|
|
||||||
|
for node in nodes['nodes']:
|
||||||
|
if node['name']:
|
||||||
|
for mac in node['macs'].split(','):
|
||||||
|
print("%s %s" % (mac.strip(), node['name']))
|
Loading…
Reference in a new issue