mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +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:
parent
bfb64f545e
commit
ab18f6c3a6
@ -98,19 +98,20 @@ sub version_sortModules($$)
|
||||
sub version_getRevFromControls(;$)
|
||||
{
|
||||
my ($name) = @_;
|
||||
$name = "fhem" unless(defined($name));
|
||||
my $control_file = AttrVal("global","modpath",".")."/FHEM/controls_$name.txt";
|
||||
$name //= "fhem";
|
||||
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;
|
||||
|
||||
if(open(FH, $control_file)) {
|
||||
while(<FH>) {
|
||||
chomp;
|
||||
if(/^REV\s+(\S+.*)$/) {
|
||||
$revision = $1;
|
||||
last;
|
||||
}
|
||||
foreach my $l (@content) {
|
||||
if($l =~ /^REV\s+(\S+.*)$/) {
|
||||
$revision = $1;
|
||||
last;
|
||||
}
|
||||
close(FH);
|
||||
}
|
||||
return $revision;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user