From 5303c034b9ef1bd0fd543b2221d8046e257eaf6d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 27 Sep 2018 00:23:24 +0200 Subject: [PATCH] script-updates: make sure new script starts with magic --- script-updates | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/script-updates b/script-updates index f38e46a..cae182d 100644 --- a/script-updates +++ b/script-updates @@ -50,12 +50,16 @@ } :if ([ :len $sourcenew ] > 0) do={ - :local sourcecurrent [ / system script get $script source ]; - :if ($sourcenew = $sourcecurrent) do={ - :log debug ("Script " . $scriptname . " did not change"); + :if ([ :pick $sourcenew 0 5 ] = "#!rsc") do={ + :local sourcecurrent [ / system script get $script source ]; + :if ($sourcenew != $sourcecurrent) do={ + :log info ("Updating script: " . $scriptname); + / system script set owner=$scriptname source=$sourcenew $script; + } else={ + :log debug ("Script " . $scriptname . " did not change"); + } } else={ - :log info ("Updating script: " . $scriptname); - / system script set owner=$scriptname source=$sourcenew $script; + :log warning ("Looks like new script " . $scriptname . " is not valid. Ignoring!"); } } else={ :log debug ("No update for script " . $scriptname);