Commit c66bb89b authored by Christian Hesse's avatar Christian Hesse

update template system

parent a964e8ad
......@@ -2,8 +2,12 @@ GENERATE = collect-wireless-mac.capsman collect-wireless-mac.local dhcp-lease-co
all: $(GENERATE)
%.local: *.in Makefile
sed -e 's/%PATH%/interface wireless/' -e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' < $(basename [email protected]).in > [email protected]
%.local: *.template Makefile
sed -e '/\/ caps-man/d' -e 's|%PATH%|interface wireless|' -e 's|%TEMPL%|$(suffix [email protected])|' \
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
< $(basename [email protected]).template > [email protected]
%.capsman: *.in Makefile
sed -e 's/%PATH%/caps-man/' -e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' < $(basename [email protected]).in > [email protected]
%.capsman: *.template Makefile
sed -e '/\/ interface wireless/d' -e 's/%PATH%/caps-man/' -e 's/%TEMPL%/$(suffix [email protected])/' \
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
< $(basename [email protected]).template > [email protected]
# RouterOS script: collect-wireless-mac
# RouterOS script: collect-wireless-mac.capsman
# Copyright (c) 2013-2018 Christian Hesse <[email protected]>
#
# collect wireless mac adresses in access list
......@@ -33,13 +33,7 @@
}
:local regentry [ / caps-man registration-table find where mac-address=$mac ];
:local interface [ / caps-man registration-table get $regentry interface ];
:local ssid;
:if ("caps-man" = ("caps" . "-man")) do={
:set ssid [ / caps-man registration-table get $regentry ssid ];
} else={
# keep two spaces here to protect against replace!
:set ssid [ / interface wireless get [ find where name=$interface ] ssid ];
}
:local ssid [ / caps-man registration-table get $regentry ssid ];
:local datetime ([ / system clock get date ] . " " . [ / system clock get time ]);
:local message ("unknown MAC address " . $mac . " (" . $hostname . ") first seen on " . \
$datetime . " connected to SSID " . $ssid . ", interface " . $interface);
......
# RouterOS script: collect-wireless-mac
# RouterOS script: collect-wireless-mac.local
# Copyright (c) 2013-2018 Christian Hesse <[email protected]>
#
# collect wireless mac adresses in access list
......@@ -33,13 +33,7 @@
}
:local regentry [ / interface wireless registration-table find where mac-address=$mac ];
:local interface [ / interface wireless registration-table get $regentry interface ];
:local ssid;
:if ("interface wireless" = ("caps" . "-man")) do={
:set ssid [ / interface wireless registration-table get $regentry ssid ];
} else={
# keep two spaces here to protect against replace!
:set ssid [ / interface wireless get [ find where name=$interface ] ssid ];
}
:local ssid [ / interface wireless get [ find where name=$interface ] ssid ];
:local datetime ([ / system clock get date ] . " " . [ / system clock get time ]);
:local message ("unknown MAC address " . $mac . " (" . $hostname . ") first seen on " . \
$datetime . " connected to SSID " . $ssid . ", interface " . $interface);
......
# RouterOS script: collect-wireless-mac
# RouterOS script: collect-wireless-mac%TEMPL%
# Copyright (c) 2013-2018 Christian Hesse <[email protected]>
#
# collect wireless mac adresses in access list
#
# !! This is just a template! Replace '%PATH%' with 'capsman'
# !! This is just a template! Replace '%PATH%' with 'caps-man'
# !! or 'interface wireless'!
:global "identity";
......@@ -34,13 +34,8 @@
}
:local regentry [ / %PATH% registration-table find where mac-address=$mac ];
:local interface [ / %PATH% registration-table get $regentry interface ];
:local ssid;
:if ("%PATH%" = ("caps" . "-man")) do={
:set ssid [ / %PATH% registration-table get $regentry ssid ];
} else={
# keep two spaces here to protect against replace!
:set ssid [ / interface wireless get [ find where name=$interface ] ssid ];
}
:local ssid [ / caps-man registration-table get $regentry ssid ];
:local ssid [ / interface wireless get [ find where name=$interface ] ssid ];
:local datetime ([ / system clock get date ] . " " . [ / system clock get time ]);
:local message ("unknown MAC address " . $mac . " (" . $hostname . ") first seen on " . \
$datetime . " connected to SSID " . $ssid . ", interface " . $interface);
......
# RouterOS script: dhcp-lease-comment
# RouterOS script: dhcp-lease-comment.capsman
# Copyright (c) 2013-2018 Christian Hesse <[email protected]>
#
# update dhcp-server lease comment with infos from access-list
......
# RouterOS script: dhcp-lease-comment
# RouterOS script: dhcp-lease-comment.local
# Copyright (c) 2013-2018 Christian Hesse <[email protected]>
#
# update dhcp-server lease comment with infos from access-list
......
# RouterOS script: dhcp-lease-comment
# RouterOS script: dhcp-lease-comment%TEMPL%
# Copyright (c) 2013-2018 Christian Hesse <[email protected]>
#
# update dhcp-server lease comment with infos from access-list
#
# !! This is just a template! Replace '%PATH%' with 'capsman'
# !! This is just a template! Replace '%PATH%' with 'caps-man'
# !! or 'interface wireless'!
:foreach lease in=[ / ip dhcp-server lease find where dynamic=yes ] do={
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment