aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-09-27 00:23:24 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-09-28 21:44:03 +0200
commit5303c034b9ef1bd0fd543b2221d8046e257eaf6d (patch)
treee5588c61d43d8cbd248cc1ddeef3a392f3dda131
parentbe673737d3ddacd93656a2c287596381aedb86c4 (diff)
script-updates: make sure new script starts with magic
-rw-r--r--script-updates14
1 files 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);