global-functions: $ScriptInstallUpdate: remove script on failure when installing

This commit is contained in:
Christian Hesse 2022-06-28 21:05:50 +02:00
parent 8b6f830fe8
commit fcd6e61849

View file

@ -808,7 +808,13 @@
:set SourceNew ($Result->"data");
}
} on-error={
$LogPrintExit2 warning $0 ("Failed fetching script '" . $ScriptVal->"name" . "'!") false;
:if ($ScriptVal->"source" = "#!rsc by RouterOS\n") do={
$LogPrintExit2 warning $0 ("Failed fetching script '" . $ScriptVal->"name" . \
"', removing dummy. Typo on installation?") false;
/system/script/remove $Script;
} else={
$LogPrintExit2 warning $0 ("Failed fetching script '" . $ScriptVal->"name" . "'!") false;
}
}
}
}