2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-07 16:59:18 +00:00

version: add support for controls_fhem.txt update via "svn update" (Forum: #74372)

git-svn-id: https://svn.fhem.de/fhem/trunk@14745 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2017-07-18 20:56:01 +00:00
parent bfb64f545e
commit ab18f6c3a6

View File

@ -98,19 +98,20 @@ sub version_sortModules($$)
sub version_getRevFromControls(;$) sub version_getRevFromControls(;$)
{ {
my ($name) = @_; my ($name) = @_;
$name = "fhem" unless(defined($name)); $name //= "fhem";
my $control_file = AttrVal("global","modpath",".")."/FHEM/controls_$name.txt"; my $cf = "controls_$name.txt";
my $filename = (-e "./$cf") ? "./$cf" : AttrVal("global","modpath",".")."/FHEM/$cf";
my ($err, @content) = FileRead({FileName => $filename, ForceType => "file"});
if ($err) {
Log 3, "version: unable to open $filename: $err";
return undef;
}
my $revision; my $revision;
foreach my $l (@content) {
if(open(FH, $control_file)) { if($l =~ /^REV\s+(\S+.*)$/) {
while(<FH>) { $revision = $1;
chomp; last;
if(/^REV\s+(\S+.*)$/) {
$revision = $1;
last;
}
} }
close(FH);
} }
return $revision; return $revision;
} }