push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
{
fetchFromGitHub,
lib,
makeWrapper,
monitoring-plugins,
perlPackages,
stdenv,
txt2man,
wmic-bin ? null,
}:
stdenv.mkDerivation rec {
pname = "check-wmi-plus";
version = "1.65";
# Upstream has been moved from Github to tarballs on the author's website.
# See https://edcint.co.nz/checkwmiplus/releases/
src = fetchFromGitHub {
owner = "speartail";
repo = "checkwmiplus";
tag = "v${version}";
sha256 = "1as0iyhy4flpm37mb7lvah7rnd6ax88appjm1icwhy7iq03wi8pl";
};
patches = [ ./wmiplus_fix_manpage.patch ];
propagatedBuildInputs = with perlPackages; [
BHooksEndOfScope
ClassDataInheritable
ClassInspector
ClassSingleton
ConfigIniFiles
DateTime
DateTimeLocale
DateTimeTimeZone
DevelStackTrace
EvalClosure
ExceptionClass
FileShareDir
ModuleImplementation
ModuleRuntime
MROCompat
namespaceautoclean
namespaceclean
NumberFormat
PackageStash
ParamsValidate
ParamsValidationCompiler
RoleTiny
Specio
SubExporterProgressive
SubIdentify
TryTiny
];
nativeBuildInputs = [
makeWrapper
txt2man
];
dontConfigure = true;
dontBuild = true;
doCheck = false; # no checks
postPatch = ''
substituteInPlace check_wmi_plus.pl \
--replace-fail /usr/bin/wmic ${wmic-bin}/bin/wmic \
--replace-fail /etc/check_wmi_plus $out/etc/check_wmi_plus \
--replace-fail /opt/nagios/bin/plugins $out/etc/check_wmi_plus \
--replace-fail /usr/lib/nagios/plugins ${monitoring-plugins}/libexec \
--replace-fail '$base_dir/check_wmi_plus_help.pl' "$out/bin/check_wmi_plus_help.pl"
for f in *.pl ; do
substituteInPlace $f --replace /usr/bin/perl ${perlPackages.perl}/bin/perl
done
'';
installPhase = ''
runHook preInstall
install -Dm755 -t $out/bin *.pl
install -Dm644 -t $out/share/doc/${pname} *.txt
cp -r etc $out/
runHook postInstall
'';
# 1. we need to wait until the main binary has been fixed up with proper perl paths before we can run it to generate the man page
# 2. txt2man returns exit code 3 even if it works, so we add the || true bit
postFixup = ''
wrapProgram $out/bin/check_wmi_plus.pl \
--set PERL5LIB "${perlPackages.makePerlPath propagatedBuildInputs}"
mkdir -p $out/share/man/man1
$out/bin/check_wmi_plus.pl --help | txt2man -d 1970-01-01 -s 1 -t check_wmi_plus -r "Check WMI Plus ${version}" > $out/share/man/man1/check_wmi_plus.1 || true
gzip $out/share/man/man1/check_wmi_plus.1
'';
meta = with lib; {
description = "Sensu/nagios plugin using WMI to query Windows hosts";
homepage = "https://edcint.co.nz/checkwmiplus/";
license = licenses.gpl2Plus;
mainProgram = "check_wmi_plus";
maintainers = with maintainers; [ peterhoeg ];
};
}

View File

@@ -0,0 +1,40 @@
diff --git a/check_wmi_plus.makeman.sh b/check_wmi_plus.makeman.sh
index 38dc7a4..3fe4369 100755
--- a/check_wmi_plus.makeman.sh
+++ b/check_wmi_plus.makeman.sh
@@ -19,15 +19,6 @@ mkdir -p "$manpage_dir/man1"
# the full path to the manpage file
manfile="$manpage_dir/man1/check_wmi_plus.1"
-# if we are not running in a terminal then only show the text-based help
-if [ ! -t 0 ]; then
- # we are not running in a terminal
- echo "Not running in a terminal - showing text-based help"
- echo
- exec $check_wmi_plus_text_help
-fi
-
-
usage()
{
cat << EOT
diff --git a/check_wmi_plus_help.pl b/check_wmi_plus_help.pl
index 3440db2..2982da2 100755
--- a/check_wmi_plus_help.pl
+++ b/check_wmi_plus_help.pl
@@ -24,7 +24,7 @@ if ($opt_help) {
# we have the script to make the manpage and have not been asked to show text only help
exec ("$make_manpage_script \"$0 --itexthelp\" \"$manpage_dir\"") or print STDERR "couldn't exec $make_manpage_script: $!";
} else {
- print "Warning: Can not access/execute Manpage script ($make_manpage_script).\nShowing help in text-only format.\n\n";
+ # print "Warning: Can not access/execute Manpage script ($make_manpage_script).\nShowing help in text-only format.\n\n";
}
}
@@ -692,4 +692,4 @@ show_ini_help_overview(1);
finish_program($ERRORS{'UNKNOWN'});
}
-1;
\ No newline at end of file
+1;