From 1e2387474a449452b78520b9ad96a8b4b5e99722 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Wed, 17 Apr 2019 19:07:19 +0200 Subject: initial commit of source fetch --- .../check_checksums/update_checksums | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_checksums/update_checksums (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/check_checksums/update_checksums') diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_checksums/update_checksums b/nagios-plugins-contrib-24.20190301~bpo9+1/check_checksums/update_checksums new file mode 100755 index 0000000..2ef376b --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_checksums/update_checksums @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Tool to rebuild all checksums for check_checksums +# +# +# Copyright (C) 2013 Bernd Zeimetz +# +# 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 of the License, 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 . + +set -e +umask 027 + +for t in md5 sha1 sha224 sha256 sha384 sha512; do + fname="/etc/nagios/check_checksums.${t}" + tool="${t}sum" + if [ -f ${fname} ]; then + tmp=`mktemp` + chown root:nagios ${tmp} + chmod 640 ${tmp} + + trap "rm -f ${tmp}" EXIT + + sed 's,^[^ ]* ,,' ${fname} | while read f; do + if [ -f "${f}" ]; then + ${tool} "${f}" >> ${tmp} + else + echo "${f} went missing, ignoring!" + fi + done + + ln "${fname}" "${fname}_`date '+%s'`" + mv "${tmp}" "${fname}" + fi +done + + -- cgit v1.2.3