summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/hosts
blob: 3a8dbcc900b38df4d53ec4dbe6b4eca5a9b8d77a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#! /bin/sh
set -euf

netname=${1-retiolum}

cd /etc/tinc/$netname/hosts

for i in `ls`; do
  hname="$i $i.retiolum"
  for j in `sed -En 's|^ *Aliases *= *(.+)|\1|p' $i`;do
    hname="${hname} $j.retiolum $j"
  done
  sed -En '
            s|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1   '"$hname"'|p
  ' $i
done | sort