diff options
author | mail_redacted_for_web | 2019-04-17 19:07:19 +0200 |
---|---|---|
committer | mail_redacted_for_web | 2019-04-17 19:07:19 +0200 |
commit | 1e2387474a449452b78520b9ad96a8b4b5e99722 (patch) | |
tree | 836889471eec7d2aac177405068e2a8f1e2b1978 /nagios-plugins-contrib-24.20190301~bpo9+1/check_checksums/update_checksums | |
download | nagios-plugins-contrib-1e2387474a449452b78520b9ad96a8b4b5e99722.tar.bz2 |
initial commit of source fetch
Diffstat (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/check_checksums/update_checksums')
-rwxr-xr-x | nagios-plugins-contrib-24.20190301~bpo9+1/check_checksums/update_checksums | 47 |
1 files changed, 47 insertions, 0 deletions
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 <b.zeimetz@conova.com> +# +# 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 <http://www.gnu.org/licenses/>. + +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 + + |