mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
update template system
This commit is contained in:
parent
a964e8ad0c
commit
c66bb89be2
12
Makefile
12
Makefile
|
@ -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 $@).in > $@
|
||||
%.local: *.template Makefile
|
||||
sed -e '/\/ caps-man/d' -e 's|%PATH%|interface wireless|' -e 's|%TEMPL%|$(suffix $@)|' \
|
||||
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
|
||||
< $(basename $@).template > $@
|
||||
|
||||
%.capsman: *.in Makefile
|
||||
sed -e 's/%PATH%/caps-man/' -e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' < $(basename $@).in > $@
|
||||
%.capsman: *.template Makefile
|
||||
sed -e '/\/ interface wireless/d' -e 's/%PATH%/caps-man/' -e 's/%TEMPL%/$(suffix $@)/' \
|
||||
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
|
||||
< $(basename $@).template > $@
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RouterOS script: collect-wireless-mac
|
||||
# RouterOS script: collect-wireless-mac.capsman
|
||||
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# 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);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RouterOS script: collect-wireless-mac
|
||||
# RouterOS script: collect-wireless-mac.local
|
||||
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# 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);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# RouterOS script: collect-wireless-mac
|
||||
# RouterOS script: collect-wireless-mac%TEMPL%
|
||||
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# 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);
|
|
@ -1,4 +1,4 @@
|
|||
# RouterOS script: dhcp-lease-comment
|
||||
# RouterOS script: dhcp-lease-comment.capsman
|
||||
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# update dhcp-server lease comment with infos from access-list
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RouterOS script: dhcp-lease-comment
|
||||
# RouterOS script: dhcp-lease-comment.local
|
||||
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# update dhcp-server lease comment with infos from access-list
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# RouterOS script: dhcp-lease-comment
|
||||
# RouterOS script: dhcp-lease-comment%TEMPL%
|
||||
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# 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={
|
Loading…
Reference in a new issue