Browse Source

lease-script: drop differentiation of assign / deassign...

... not that we have early locking.
main
Christian Hesse 2 months ago
parent
commit
8e2c783068
  1. 2
      collect-wireless-mac.capsman
  2. 2
      collect-wireless-mac.local
  3. 2
      collect-wireless-mac.template
  4. 2
      dhcp-lease-comment.capsman
  5. 2
      dhcp-lease-comment.local
  6. 2
      dhcp-lease-comment.template
  7. 2
      dhcp-to-dns
  8. 2
      hotspot-to-wpa-cleanup
  9. 11
      lease-script

2
collect-wireless-mac.capsman

@ -6,7 +6,7 @@
# collect wireless mac adresses in access list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
#
# provides: lease-script, assign, order=40
# provides: lease-script, order=40
#
# !! Do not edit this file, it is generated from template!

2
collect-wireless-mac.local

@ -6,7 +6,7 @@
# collect wireless mac adresses in access list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
#
# provides: lease-script, assign, order=40
# provides: lease-script, order=40
#
# !! Do not edit this file, it is generated from template!

2
collect-wireless-mac.template

@ -6,7 +6,7 @@
# collect wireless mac adresses in access list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
#
# provides: lease-script, assign, order=40
# provides: lease-script, order=40
#
# !! This is just a template! Replace '%PATH%' with 'caps-man'
# !! or 'interface wireless'!

2
dhcp-lease-comment.capsman

@ -3,7 +3,7 @@
# Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
#
# provides: lease-script, assign, order=60
# provides: lease-script, order=60
#
# update dhcp-server lease comment with infos from access-list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md

2
dhcp-lease-comment.local

@ -3,7 +3,7 @@
# Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
#
# provides: lease-script, assign, order=60
# provides: lease-script, order=60
#
# update dhcp-server lease comment with infos from access-list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md

2
dhcp-lease-comment.template

@ -3,7 +3,7 @@
# Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
#
# provides: lease-script, assign, order=60
# provides: lease-script, order=60
#
# update dhcp-server lease comment with infos from access-list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md

2
dhcp-to-dns

@ -3,7 +3,7 @@
# Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
#
# provides: lease-script, assign, deassign, order=20
# provides: lease-script, order=20
#
# check DHCP leases and add/remove/update DNS entries
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-to-dns.md

2
hotspot-to-wpa-cleanup

@ -3,7 +3,7 @@
# Copyright (c) 2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
#
# provides: lease-script, assign, order=80
# provides: lease-script, order=80
#
# manage and clean up private WPA passphrase after hotspot login
# https://git.eworm.de/cgit/routeros-scripts/about/doc/hotspot-to-wpa.md

11
lease-script

@ -28,11 +28,10 @@ $ScriptLock $0 false 10;
$LogPrintExit2 debug $0 ("More invocations are waiting, exiting early.") true;
}
:local State ([ $IfThenElse ($leaseBound = 0) "de" "" ] . "assign");
:local RunOrder [ :toarray "" ];
$LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . [ $IfThenElse ($leaseBound = 0) \
"de" "" ] . "assigned lease " . $leaseActIP . " to " . $leaseActMAC) false;
$LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . \
$State . "ed lease " . $leaseActIP . " to " . $leaseActMAC) false;
:local RunOrder [ :toarray "" ];
:foreach Script in=[ / system script find where source~("\n# provides: lease-script, ") ] do={
:local Name [ / system script get $Script name ];
@ -42,9 +41,7 @@ $LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . \
:set Store [ :pick $Store 0 [ :find $Store "\n" ] ];
:set Store [ $ParseKeyValueStore $Store ];
:if (($Store->$State) = true) do={
:set ($RunOrder->($Store->"order")) $Name;
}
:set ($RunOrder->($Store->"order")) $Name;
}
:foreach Order,Script in=$RunOrder do={

Loading…
Cancel
Save