diff options
author | Christian Hesse <mail@eworm.de> | 2018-07-09 22:59:16 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2018-07-10 00:05:30 +0200 |
commit | a80591f51077130ddbaf88618b4c151c7a195e0f (patch) | |
tree | e41558aba99fae8682df65b6d1147127251b603f /script-updates | |
parent | 8593c7a2f218e9a5cadb2a38077e053cd1346373 (diff) |
script-updates: always accept updates from file
Diffstat (limited to 'script-updates')
-rw-r--r-- | script-updates | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/script-updates b/script-updates index 1f71278..3139274 100644 --- a/script-updates +++ b/script-updates @@ -6,49 +6,41 @@ :global "script-updates-fetch"; :global "script-updates-baseurl"; :global "script-updates-ignore"; -:global "script-updates-fetch-ignore"; :foreach script in=[ / system script find ] do={ :local ignore 0; :local scriptname [ / system script get $script name ]; + :local scriptfile [ / file find where name=("script-updates/" . $scriptname) ]; - :foreach "ignore-loop" in=$"script-updates-ignore" do={ - :if ($"ignore-loop" = $scriptname) do={ :set ignore 1; } - } - - :if ($ignore = 0) do={ - :local scriptfile [ / file find where name=("script-updates/" . $scriptname) ]; - - :if ([ :len $scriptfile ] = 0 && $"script-updates-fetch" = true) do={ - :foreach "ignore-loop" in=$"script-updates-fetch-ignore" do={ - :if ($"ignore-loop" = $scriptname) do={ :set ignore 1; } - } + :if ([ :len $scriptfile ] = 0 && $"script-updates-fetch" = true) do={ + :foreach "ignore-loop" in=$"script-updates-ignore" do={ + :if ($"ignore-loop" = $scriptname) do={ :set ignore 1; } + } - :if ($ignore = 0) do={ - :log debug ("Fetching script from url: " . $scriptname); - :do { - / tool fetch check-certificate=yes-without-crl \ - dst-path=("script-updates/" . $scriptname) \ - ($"script-updates-baseurl" . $scriptname); - :set scriptfile [ / file find where name=("script-updates/" . $scriptname) ]; - } on-error={ - :log debug ("Failed fetching " . $scriptname); - } + :if ($ignore = 0) do={ + :log debug ("Fetching script from url: " . $scriptname); + :do { + / tool fetch check-certificate=yes-without-crl \ + dst-path=("script-updates/" . $scriptname) \ + ($"script-updates-baseurl" . $scriptname); + :set scriptfile [ / file find where name=("script-updates/" . $scriptname) ]; + } on-error={ + :log debug ("Failed fetching " . $scriptname); } } + } - :if ([ :len $scriptfile ] > 0) do={ - :local filecontent [ / file get $scriptfile content ]; - :local scriptsource [ / system script get $script source ]; - :if ($filecontent = $scriptsource) do={ - :log debug ("Script " . $scriptname . " did not change"); - } else={ - :log info ("Updating script: " . $scriptname); - / system script set owner=$scriptname source=$filecontent $script; - } - / file remove $scriptfile; + :if ([ :len $scriptfile ] > 0) do={ + :local filecontent [ / file get $scriptfile content ]; + :local scriptsource [ / system script get $script source ]; + :if ($filecontent = $scriptsource) do={ + :log debug ("Script " . $scriptname . " did not change"); } else={ - :log debug ("No update for script " . $scriptname); + :log info ("Updating script: " . $scriptname); + / system script set owner=$scriptname source=$filecontent $script; } + / file remove $scriptfile; + } else={ + :log debug ("No update for script " . $scriptname); } } |