2023-01-05 08:18:05 +01:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
use File::Basename;
|
|
|
|
use POSIX qw(strftime);
|
|
|
|
use strict;
|
|
|
|
|
2025-02-05 07:07:52 +01:00
|
|
|
my @filenames = (
|
|
|
|
'FHEM/59_Weather.pm',
|
|
|
|
'lib/FHEM/Core/Weather.pm',
|
|
|
|
'lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm',
|
|
|
|
'lib/FHEM/APIs/Weather/wundergroundAPI.pm',
|
|
|
|
);
|
2023-01-05 08:18:05 +01:00
|
|
|
|
2025-02-05 07:07:52 +01:00
|
|
|
my $controlsfile = 'controls_Weather.txt';
|
2023-01-05 08:18:05 +01:00
|
|
|
|
2025-02-05 07:07:52 +01:00
|
|
|
open( FH, ">$controlsfile" ) || return ("Can't open $controlsfile: $!");
|
2023-01-05 08:18:05 +01:00
|
|
|
|
2025-02-05 07:07:52 +01:00
|
|
|
for my $filename (@filenames) {
|
2023-01-05 08:18:05 +01:00
|
|
|
my @statOutput = stat($filename);
|
2025-02-05 07:07:52 +01:00
|
|
|
|
|
|
|
if ( scalar @statOutput != 13 ) {
|
|
|
|
printf 'error: stat has unexpected return value for '
|
|
|
|
. $filename . "\n";
|
2023-01-05 08:18:05 +01:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2025-02-05 07:07:52 +01:00
|
|
|
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;
|
2023-01-05 08:18:05 +01:00
|
|
|
|
|
|
|
my $filesize = $statOutput[7];
|
|
|
|
|
2025-02-05 07:07:52 +01:00
|
|
|
printf FH 'UPD ' . $filetime . ' ' . $filesize . ' ' . $filename . "\n";
|
2023-01-05 08:18:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
close(FH);
|
|
|
|
|
|
|
|
system("git add $controlsfile");
|
|
|
|
|
|
|
|
print 'Create controls File succesfully' . "\n";
|
|
|
|
|
|
|
|
exit 0;
|