add support für fhem update command

This commit is contained in:
Marko Oldenburg 2021-11-26 19:45:29 +01:00
parent 4694030cd5
commit 3755e1b236
6 changed files with 57 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

4
controls_NukiSmart.txt Normal file
View File

@ -0,0 +1,4 @@
UPD 2021-11-26_17:16:05 9207 FHEM/73_NUKIBridge.pm
UPD 2021-11-26_18:16:04 7548 FHEM/74_NUKIDevice.pm
UPD 2021-11-26_19:31:40 35495 lib/FHEM/Devices/Nuki/Bridge.pm
UPD 2021-11-26_18:46:30 15635 lib/FHEM/Devices/Nuki/Device.pm

53
hooks/pre-commit Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/perl -w
use File::Basename;
use POSIX qw(strftime);
use strict;
my @filenames = ( 'FHEM/73_AutoShuttersControl.pm',
'lib/FHEM/Automation/ShuttersControl.pm',
'lib/FHEM/Automation/ShuttersControl/Dev.pm',
'lib/FHEM/Automation/ShuttersControl/Roommate.pm',
'lib/FHEM/Automation/ShuttersControl/Shutters.pm',
'lib/FHEM/Automation/ShuttersControl/Shading.pm',
'lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm',
'lib/FHEM/Automation/ShuttersControl/Helper.pm',
'lib/FHEM/Automation/ShuttersControl/Window.pm',
'lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm',
'lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm',
'lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm',
'lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm',
'lib/FHEM/Automation/ShuttersControl/Window/Attr.pm',
'lib/FHEM/Automation/ShuttersControl/Window/Readings.pm',
'lib/FHEM/Automation/ShuttersControl/Rainprotection.pm'
);
my $controlsfile = 'controls_AutoShuttersControl.txt';
open(FH, ">$controlsfile") || return("Can't open $controlsfile: $!");
for my $filename (@filenames) {
my @statOutput = stat($filename);
if (scalar @statOutput != 13) {
printf 'error: stat has unexpected return value for ' . $filename . "\n";
next;
}
my $mtime = $statOutput[9];
my $date = POSIX::strftime("%Y-%m-%d", localtime($mtime));
my $time = POSIX::strftime("%H:%M:%S", localtime($mtime));
my $filetime = $date."_".$time;
my $filesize = $statOutput[7];
printf FH 'UPD ' . $filetime . ' ' . $filesize . ' ' .$filename . "\n";
}
close(FH);
system("git add $controlsfile");
print 'Create controls File succesfully' . "\n";
exit 0;