diff --git a/Makefile b/Makefile index 89517410..0265a51a 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ HTML = $(MARKDOWN:.md=.html) all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML) checksums.json -%.html: %.md Makefile - markdown $< | sed 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' > $@ +%.html: %.md contrib/html.sh contrib/html.sh.d/head.html + contrib/html.sh $< > $@ %.capsman.rsc: %.template.rsc Makefile sed -e '/\/interface\/wifi\//d' -e '/\/interface\/wireless\//d' -e 's|%TEMPL%|.capsman|' \ diff --git a/contrib/html.sh b/contrib/html.sh new file mode 100755 index 00000000..bbd8ba86 --- /dev/null +++ b/contrib/html.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +sed "s|__TITLE__|$(head -n1 "${1}")|" < "${0}.d/head.html" +markdown -f toc,idanchor "${1}" | sed \ + -e 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' \ + -e '/| id="\L\1">|' +printf '' diff --git a/contrib/html.sh.d/head.html b/contrib/html.sh.d/head.html new file mode 100644 index 00000000..1b1dd03a --- /dev/null +++ b/contrib/html.sh.d/head.html @@ -0,0 +1,15 @@ + +RouterOS Scripts :: __TITLE__ + + + + diff --git a/global-functions.rsc b/global-functions.rsc index 10d1b412..98bc306c 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -1787,14 +1787,11 @@ :local Delay ([ $MAX [ $EitherOr $WaitTime 2s ] 100ms ] / 9); :do { - :retry { - :if ([ :len [ /file/find where name=$FileName ] ] = 0) do={ - :error false; - } + :retry { + /file/get $FileName; + :return true; } delay=$Delay max=10; - } on-error={ - :return false; - } + } on-error={ } :while ([ :len [ /file/find where name=$FileName ] ] > 0) do={ :do { diff --git a/mod/ssh-keys-import.rsc b/mod/ssh-keys-import.rsc index 7bdc95da..dd32fd6b 100644 --- a/mod/ssh-keys-import.rsc +++ b/mod/ssh-keys-import.rsc @@ -85,7 +85,7 @@ :return false; } - :if ([ $FileExists $FileName ] = true) do={ + :if ([ $FileExists $FileName ] = false) do={ $LogPrint warning $0 ("File '" . $FileName . "' does not exist."); :return false; }