From 6a291f4c34122e49e60fb7110394df8832893fbb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Mar 2015 09:08:49 +0100 Subject: retiolum/bin/hosts: allow "Aliases = ..." in tinc hosts files --- retiolum/bin/hosts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'retiolum/bin/hosts') diff --git a/retiolum/bin/hosts b/retiolum/bin/hosts index 44dbd88d..3a8dbcc9 100755 --- a/retiolum/bin/hosts +++ b/retiolum/bin/hosts @@ -6,8 +6,11 @@ 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 '$i'.'$netname' '$i'|p + s|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1 '"$hname"'|p ' $i done | sort - -- cgit v1.2.3