diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-02-10 17:50:31 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-02-10 17:50:31 +0200 |
commit | d8ee8a56a3a5ac156f8d840f050b8223fb955636 (patch) | |
tree | 62ac4c1112ea28de5d0b23221db2dcaacbf82ab0 | |
parent | 8a916702efcd22685b02d7dd2760de8e55a2868b (diff) | |
download | syslogck-master.tar.gz syslogck-master.tar.bz2 |
-rw-r--r-- | .gitignore | 10 | ||||
-rw-r--r-- | MANIFEST | 6 | ||||
-rw-r--r-- | Makefile.PL | 20 | ||||
-rw-r--r-- | bootstrap.pl | 61 | ||||
-rw-r--r-- | syslogck | 8 |
5 files changed, 102 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b43081a --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.emacs* +*~ +/MYMETA.json +/MYMETA.yml +Makefile +/syslogck-*.tar.gz +/tmp +/blib +/pm_to_blib +/inc diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..344ac44 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,6 @@ +Changes +LICENSE +Makefile.PL +MANIFEST This list of files +inc/ExtUtils/AutoInstall.pm +syslogck diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..8e9812f --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,20 @@ +# -*- perl -*- +use strict; +use lib 'inc'; +use ExtUtils::AutoInstall ( + -core => { + 'Getopt::Long' => 2.34, + 'File::Basename' => 2.84, + 'Pod::Usage' => 1.51, + 'Pod::Man' => 2.25, + 'Sys::Syslog' => 0.29 + } +); + +WriteMakefile(NAME => 'syslogck', + ABSTRACT_FROM => 'syslogck', + VERSION_FROM => 'syslogck', + AUTHOR => 'Sergey Poznyakoff <gray@gnu.org>', + LICENSE => 'gpl', + EXE_FILES => [ 'syslogck' ] +); diff --git a/bootstrap.pl b/bootstrap.pl new file mode 100644 index 0000000..90db16a --- /dev/null +++ b/bootstrap.pl @@ -0,0 +1,61 @@ +#! /usr/bin/perl +# This file is part of acmeman. +# Copyright (C) 2014, 2017 Sergey Poznyakoff <gray@gnu.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use strict; +use CPAN; +use Cwd qw(getcwd); +use File::Path qw(mkpath); + +#### +my $incdir = "inc/ExtUtils"; +my $topdir = getcwd; + +my $modname = "ExtUtils::AutoInstall"; + +my $mod = CPAN::Shell->expandany($modname) or die "Can't expand $modname"; +my $file = $mod->inst_file; +my $dir; + +if (defined($file)) { + print "$modname installed at $file\n"; + if (-f $file) { + $file =~ s#/[^/]+\.pm$##; + if (-d $file) { + $dir = $file; + } else { + die "Can't find $modname directory"; + } + } +} else { + print "Getting $modname\n"; + my $distro = $mod->get or die "Can't get distribution for $modname"; + $dir = $distro->dir; +} + +$file = "$dir/$incdir/AutoInstall.pm"; +$file = "$dir/AutoInstall.pm" unless (-f $file); +-f $file or die "$file not found"; + +use autodie; +chdir $topdir; +mkpath $incdir unless -d $incdir; +chdir $incdir; +no autodie; +unlink "AutoInstall.pm"; +use autodie; +symlink $file, "AutoInstall.pm"; + @@ -4,12 +4,14 @@ use strict; use Sys::Syslog qw(:standard :macros); use File::Basename; use Pod::Usage; use Pod::Man; use Getopt::Long qw(:config gnu_getopt no_ignore_case); +our $VERSION = '0.99'; + use constant { EX_OK => 0, EX_USAGE => 64, EX_DATAERR => 65, EX_NOINPUT => 66, EX_OSFILE => 72, @@ -36,15 +38,15 @@ examined. By default, syslog configuration is read from file F</etc/syslog.conf>. This can be changed by supplying the name of the file in the command line. Multiple arguments are allowed. The configuration parser is very permissive. It selects only lines that -can reliably be parsed as traditional syslog selector lines. This allows to -use B<syslogck> with any flavor of syslog that allows for traditional -configuration (e.g. B<rsyslogd>). +can reliably be parsed as traditional syslog selector lines, and silently +ignores the rest. This allows to use B<syslogck> with any flavor of syslog +that allows for traditional configuration (e.g. B<rsyslogd>). On success (test message appeared in the log), B<syslogck> silently exits with code B<0>. If the message did not appear in the log within the time out period, the program prints a descriptive diagnostics on the standard error and exits with code 74 if the log file remained unmodified, or with code 65 if some messages did appear in it, but the test message didn't. Code 74 most often |