mod-LGTV_WebOS/hooks/pre-commit
Marko Oldenburg f2d5e9ddca full perl packages support
full perl packages support and BPB module directory structure

[Ticket: no]
2022-02-02 12:30:42 +01:00

40 lines
940 B
Perl
Executable File

#!/usr/bin/perl -w
use File::Basename;
use POSIX qw(strftime);
use strict;
my @filenames =
( 'FHEM/82_LGTV_WebOS.pm', 'lib/FHEM/Devices/LGTV/LGTVWebOS.pm' );
my $controlsfile = 'controls_LGTV_WebOS.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;