2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 01:14:19 +00:00

98_update.pm: add -noSSL (Forum #105944)

git-svn-id: https://svn.fhem.de/fhem/trunk@20778 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-12-18 17:46:44 +00:00
parent 8d416232af
commit 0d12c8889c

View File

@ -28,6 +28,7 @@ my $upd_running;
eval "require IO::Socket::SSL"; # Forum #74387 eval "require IO::Socket::SSL"; # Forum #74387
my $upd_hasSSL = $@ ? 0 : 1; my $upd_hasSSL = $@ ? 0 : 1;
my $upd_wantSSL;
######################################## ########################################
sub sub
@ -35,8 +36,8 @@ update_Initialize($$)
{ {
my %hash = ( my %hash = (
Fn => "CommandUpdate", Fn => "CommandUpdate",
Hlp => "[<fileName>|all|check|checktime|force] [http://.../controlfile],". Hlp => "[-noSSL] [<fileName>|all|check|checktime|force] ".
"update FHEM", "[http://.../controlfile],update FHEM",
); );
$cmds{update} = \%hash; $cmds{update} = \%hash;
} }
@ -51,6 +52,13 @@ CommandUpdate($$)
my $err = upd_metainit(0); my $err = upd_metainit(0);
return $err if($err); return $err if($err);
if($args[0] && $args[0] eq "-noSSL") {
shift @args;
$upd_wantSSL = 0;
} else {
$upd_wantSSL = 1;
}
if($args[0] && if($args[0] &&
($args[0] eq "list" || ($args[0] eq "list" ||
$args[0] eq "add" || $args[0] eq "add" ||
@ -240,6 +248,8 @@ doUpdate($$$$)
my ($curr, $max, $src, $arg) = @_; my ($curr, $max, $src, $arg) = @_;
my ($basePath, $ctrlFileName); my ($basePath, $ctrlFileName);
$src =~ s'^http://fhem\.de'https://fhem.de' if($upd_hasSSL); $src =~ s'^http://fhem\.de'https://fhem.de' if($upd_hasSSL);
$src =~ s'^https://'http://' if(!$upd_wantSSL);
uLog 1, "Downloading $src";
if($src !~ m,^(.*)/([^/]*)$,) { if($src !~ m,^(.*)/([^/]*)$,) {
uLog 1, "Cannot parse $src, probably not a valid http control file"; uLog 1, "Cannot parse $src, probably not a valid http control file";
return; return;
@ -585,7 +595,7 @@ upd_writeFile($$$$)
<a name="update"></a> <a name="update"></a>
<h3>update</h3> <h3>update</h3>
<ul> <ul>
<code>update [&lt;fileName&gt;|all|check|checktime|force] <code>update [-noSSL] [&lt;fileName&gt;|all|check|checktime|force]
[http://.../controlfile]</code> [http://.../controlfile]</code>
<br>or<br> <br>or<br>
<code>update [add source|delete source|list|reset]</code> <code>update [add source|delete source|list|reset]</code>
@ -597,6 +607,9 @@ upd_writeFile($$$$)
and filelength) are different. Upon completion it triggers the global:UPDATE and filelength) are different. Upon completion it triggers the global:UPDATE
event. event.
<br> <br>
-noSSL will use the http protocol instead of https, which might be necessary
for some older distributions with outdated ciphers.
<br>
With the commands add/delete/list/reset you can manage the list of With the commands add/delete/list/reset you can manage the list of
controlfiles, e.g. for thirdparty packages. controlfiles, e.g. for thirdparty packages.
Notes: Notes:
@ -679,7 +692,7 @@ upd_writeFile($$$$)
<a name="update"></a> <a name="update"></a>
<h3>update</h3> <h3>update</h3>
<ul> <ul>
<code>update [&lt;fileName&gt;|all|check|checktime|force] <code>update [-noSSL] [&lt;fileName&gt;|all|check|checktime|force]
[http://.../controlfile]</code> [http://.../controlfile]</code>
<br>oder<br> <br>oder<br>
<code>update [add source|delete source|list|reset]</code> <code>update [add source|delete source|list|reset]</code>
@ -692,6 +705,9 @@ upd_writeFile($$$$)
Zeitstempel sich unterscheiden. Wenn dieser Ablauf abgeschlossen ist, wird Zeitstempel sich unterscheiden. Wenn dieser Ablauf abgeschlossen ist, wird
das globale UPDATE Ereignis ausgel&ouml;st. das globale UPDATE Ereignis ausgel&ouml;st.
<br> <br>
Mit -noSSL wird das http Protocol statt https verwendet, was bei bestimmten
veralteten Distributionen notwendig sein kann.
<br>
Mit den Befehlen add/delete/list/reset kann man die Liste der Kontrolldateien Mit den Befehlen add/delete/list/reset kann man die Liste der Kontrolldateien
pflegen. pflegen.
<br> <br>