2 VERSION
=$
(sed -rn 's/^VERSION[[:space:]]*= *([0-9]+\.[0-9]+\.[0-9a-z]+).*/\1/p' < Makefile
)
4 # figlet -f small macht einen kleinen Font
7 echo '+------------------------------------------------------------------+'
9 figlet
-w 66 -c "Check_MK" |
tr ' ' @ |
sed '$d' | \
12 printf "|%-66s|\n" "${line//@/ }"
15 echo '| Copyright Mathias Kettner 2014 mk@mathias-kettner.de |'
16 echo '+------------------------------------------------------------------+'
20 This file is part of Check_MK.
21 The official homepage is at http://mathias-kettner.de/check_mk.
23 check_mk is free software; you can redistribute it and/or modify it
24 under the terms of the GNU General Public License as published by
25 the Free Software Foundation in version 2. check_mk is distributed
26 in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
27 out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
28 PARTICULAR PURPOSE. See the GNU General Public License for more de-
29 tails. You should have received a copy of the GNU General Public
30 License along with GNU Make; see the file COPYING. If not, write
31 to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
32 Boston, MA 02110-1301 USA.
34 if [ -n "$lastline" ] ; then
42 if [ ! -f "$file" ] ; then
43 echo "Skipping $file. It's not a file."
47 if [[ "${file##*/}" =~ ^
[A-Z
]+$
]]; then
48 echo "skipping $file. It's a documentation file."
53 PERMISSIONS
=$
(stat
-c %a
"$file")
54 TMP
=$
(mktemp .headrify.new.XXXXXX
)
56 suffix
="${suffix##*/}"
57 headline
="$(head -n1 $file)"
58 if [ "${headline:0:9}" = "#!/bin/sh" ] ; then
61 elif [ "${headline:0:16}" = "#!/usr/bin/ksh93" ] ; then
63 bangpath
="#!/usr/bin/ksh93"
64 elif [ "${headline:0:14}" = "#!/usr/bin/ksh" ] ; then
66 bangpath
="#!/usr/bin/ksh"
67 elif [ "${headline:0:11}" = "#!/bin/bash" ] ; then
69 bangpath
="#!/bin/bash"
70 elif [ "${headline:0:15}" = "#!/usr/bin/bash" ] ; then
72 bangpath
="#!/usr/bin/bash"
73 elif [ "${headline:0:14}" = "#!/usr/bin/php" ] ; then
75 bangpath
="#!/usr/bin/pnp"
79 *.openvms
) comment
='$!# ' ;;
80 *.php
) comment
="# " ; bangpath
="<?php"; ;;
81 *.css
) comment
="" ; bangpath
="/*"; lastline
="*/" ;;
82 *.h|
*.c|
*.cc|
*.h.
in|
*.js
) comment
="// " ;;
83 *.conf|
*.cfg
) comment
="# " ;;
84 *.spec|Makefile
*) comment
="# " ;;
85 *.py|
*) comment
="# " ; bangpath
="#!/usr/bin/env python
86 # -*- encoding: utf-8; py-indent-offset: 4 -*-"; ;;
91 if [ -n "$bangpath" ] ; then echo "$bangpath" > $TMP ; fi
92 header |
sed "s@^@$comment@" |
sed 's/ *$//' >> $TMP
94 firstline
="$(head -n1 < $file)"
95 secondline
="$(sed -n 2p < $file)"
96 thirdline
="$(sed -n 3p < $file)"
97 shouldbe
="$comment+---------------------------------------------------"
98 endline
='.*(Boston, MA 02110-1301 USA.|address provided at www.mathias-kettner.de)'
100 if [ -n "$lastline" ] ; then endline
="${lastline//\//\/}" ; fi
101 if [ "${firstline:0:20}" = "${shouldbe:0:20}" \
102 -o "${secondline:0:20}" = "${shouldbe:0:20}" \
103 -o "${thirdline:0:20}" = "${shouldbe:0:20}" ] ; then
104 sed -r '0,/^'"$endline"'$/d' $file |
sed 1d
>> $TMP
108 mv $TMP $file ||
rm -f $TMP
109 chmod $PERMISSIONS "$file"
112 echo "Headrifying to version $VERSION"
114 if [ "$#" -gt 0 ] ; then
120 { find -not -type l
-and \
121 -not -name "jquery*" \
123 -not -name "*.rc.in" \
124 -not -name "ltmain.sh" \
127 -name "Makefile" -or \
129 -name "Makefile.am" -or \
130 -name "configure.ac" -or \
139 -name "*.spec" \
) ; \
140 rm -f checks
/*~
; ls checks
/* ; \
141 echo agents
/plugins
/* agents
/special
/* agents
/* \
143 |
grep -vx agents
/waitmax \
148 | fgrep
-v windows
/plugins
; \
149 ls agents
/windows
/*.cc
;
150 echo agents
/windows
/Makefile
;
152 |
egrep -v 'livestatus/nagios4?/' \
153 |
grep -v 'agents/cfg_examples' \