summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/hosts
blob: 1c9f1182bd469dda229c04f4e8ac1a4351cefa14 (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.$netname $j"
  done
  sed -En '
            s|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1   '"$hname"'|p
  ' $i
done | sort