diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/build_perl_modules | 24 | ||||
-rwxr-xr-x | tools/np_build_from_sf | 11 | ||||
-rwxr-xr-x | tools/sfwebcron | 34 | ||||
-rwxr-xr-x | tools/snapshot | 69 | ||||
-rwxr-xr-x | tools/update_man_pages | 34 |
5 files changed, 82 insertions, 90 deletions
diff --git a/tools/build_perl_modules b/tools/build_perl_modules index 4bdb81b..9a880ff 100755 --- a/tools/build_perl_modules +++ b/tools/build_perl_modules | |||
@@ -62,11 +62,19 @@ foreach my $tarball (@tarballs) { | |||
62 | if ($opts->{m}) { | 62 | if ($opts->{m}) { |
63 | # Don't compile if already done - this is because of invocating this | 63 | # Don't compile if already done - this is because of invocating this |
64 | # script at different stages | 64 | # script at different stages |
65 | print "******************** $tarball\n"; | ||
65 | unless (-e $dir) { | 66 | unless (-e $dir) { |
66 | system("gunzip -c $tarball | tar -xf -") == 0 or die "Cannot extract $tarball"; | 67 | system("gunzip -c $tarball | tar -xf -") == 0 or die "Cannot extract $tarball"; |
67 | chdir $dir or die "Can't chdir into $dir"; | 68 | chdir $dir or die "Can't chdir into $dir"; |
68 | system("perl Makefile.PL PREFIX=$destdir INSTALLDIRS=site LIB=$destdir/lib") == 0 or die "Can't run perl Makefile.PL"; | 69 | if (-e "Makefile.PL") { |
69 | system("make") == 0 or die "Can't run make"; | 70 | system("perl Makefile.PL PREFIX=$destdir INSTALLDIRS=site LIB=$destdir/lib") == 0 |
71 | or die "Can't run perl Makefile.PL"; | ||
72 | system("make") == 0 or die "Can't run make"; | ||
73 | } else { | ||
74 | system("perl Build.PL --prefix $destdir --installdirs site --install_path lib=$destdir/lib") == 0 | ||
75 | or die "Can't run perl Build.PL"; | ||
76 | system("./Build") == 0 or die "Can't run ./Build"; | ||
77 | } | ||
70 | chdir $topdir or die "Can't chdir to top";; | 78 | chdir $topdir or die "Can't chdir to top";; |
71 | } | 79 | } |
72 | } | 80 | } |
@@ -79,10 +87,18 @@ foreach my $tarball (@tarballs) { | |||
79 | $ENV{PERL5LIB}=join(":", @dirs); | 87 | $ENV{PERL5LIB}=join(":", @dirs); |
80 | 88 | ||
81 | if ($opts->{t}) { | 89 | if ($opts->{t}) { |
82 | system("make test") == 0 or die "Can't run make test failed"; | 90 | if (-e "Makefile") { |
91 | system("make test") == 0 or die "Can't run make test failed"; | ||
92 | } else { | ||
93 | system("./Build test") == 0 or die "./Build test failed"; | ||
94 | } | ||
83 | } | 95 | } |
84 | if ($opts->{i}) { | 96 | if ($opts->{i}) { |
85 | system("make install SITEPREFIX=$destdir") == 0 or die "Can't run make install"; | 97 | if (-e "Makefile") { |
98 | system("make install SITEPREFIX=$destdir") == 0 or die "Can't run make install"; | ||
99 | } else { | ||
100 | system("./Build install") == 0 or die "Can't run ./Build install"; | ||
101 | } | ||
86 | } | 102 | } |
87 | chdir $topdir or die "Can't go back to $topdir"; | 103 | chdir $topdir or die "Can't go back to $topdir"; |
88 | } | 104 | } |
diff --git a/tools/np_build_from_sf b/tools/np_build_from_sf new file mode 100755 index 0000000..7ba349a --- /dev/null +++ b/tools/np_build_from_sf | |||
@@ -0,0 +1,11 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | set -xeu | ||
4 | |||
5 | temp=$(mktemp -d) | ||
6 | trap "cd $HOME; rm -rf $temp; exit 1" EXIT | ||
7 | curl -sS http://nagiosplug.sourceforge.net/snapshot/nagios-plugins-HEAD.tar.gz|tar -C "$temp" --strip-components=1 -xzf - | ||
8 | cd $temp | ||
9 | ./configure && make | ||
10 | $HOME/bin/update_man_pages | ||
11 | |||
diff --git a/tools/sfwebcron b/tools/sfwebcron index d836a0f..0f31fcf 100755 --- a/tools/sfwebcron +++ b/tools/sfwebcron | |||
@@ -4,32 +4,32 @@ | |||
4 | # To update the developers-guidelines.html and put in html area | 4 | # To update the developers-guidelines.html and put in html area |
5 | # | 5 | # |
6 | # Install in cron with something like: | 6 | # Install in cron with something like: |
7 | # 47 7 * * * $HOME/bin/sfwebcron | 7 | # 47 7 * * * $HOME/bin/sfwebcron >/tmp/sfwebcron.log 2>&1 || cat /tmp/sfwebcron.log |
8 | 8 | ||
9 | function die { echo $1; exit 1; } | 9 | set -eu |
10 | trap 'echo "Command failed at line $LINENO"' ERR | ||
10 | 11 | ||
11 | # Set working variables | 12 | # Set working variables |
12 | PROJECT=nagiosplug | 13 | PROJECT=nagiosplug |
13 | IN=${HOME}/tmp_sfwebcron | 14 | IN=${HOME}/sfwebcron |
14 | OUT_SERVER="tonvoon@shell.sf.net" | 15 | PROBE="developer-guidelines.html.last" |
15 | OUT="/home/groups/n/na/nagiosplug/htdocs" | 16 | OUT_SERVER="tonvoon@frs.sourceforge.net" |
16 | 17 | OUT_PATH="/home/groups/n/na/nagiosplug/htdocs" | |
17 | if [[ ! -e developer-guidelines.html.last ]] ; then | ||
18 | touch developer-guidelines.html.last | ||
19 | fi | ||
20 | 18 | ||
21 | # Get latest dev guildelines | 19 | # Get latest dev guildelines |
22 | [[ ! -d $IN ]] && mkdir $IN | 20 | [[ ! -d $IN ]] && mkdir $IN |
23 | cd $IN | 21 | cd $IN |
24 | if [[ ! -d doc ]] ; then | 22 | if [[ ! -d nagios-plugins ]] |
25 | #cvs -z3 -d:pserver:anonymous@cvs1:/cvsroot/nagiosplug co nagiosplug || die "Cannot cvs" | 23 | then |
26 | svn checkout http://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk/doc doc | 24 | git clone https://github.com/nagios-plugins/nagios-plugins.git nagios-plugins |
27 | fi | 25 | fi |
28 | cd doc | 26 | cd nagios-plugins/doc |
29 | svn update | 27 | git pull |
30 | 28 | ||
31 | make | 29 | make |
32 | if [[ developer-guidelines.html -nt developer-guidelines.html.last ]] ; then | 30 | if [[ ! -e $PROBE || developer-guidelines.html -nt $PROBE ]] |
33 | scp developer-guidelines.{html,sgml} $OUT_SERVER:$OUT | 31 | then |
34 | touch developer-guidelines.html.last | 32 | rsync -av developer-guidelines.{html,sgml} $OUT_SERVER:$OUT_PATH/ |
33 | touch $PROBE | ||
35 | fi | 34 | fi |
35 | |||
diff --git a/tools/snapshot b/tools/snapshot deleted file mode 100755 index 9fa61cf..0000000 --- a/tools/snapshot +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | # This scipt assumes that you have anonCVS for nagios and nagiosplug | ||
4 | # in ${IN} | ||
5 | |||
6 | # cvs -d:pserver:anonymous@cvs.nagiosplug.sourceforge.net:/cvsroot/nagiosplug login | ||
7 | # cvs -z3 -d:pserver:anonymous@cvs.nagiosplug.sourceforge.net:/cvsroot/nagiosplug co nagiosplug | ||
8 | # | ||
9 | # cvs -d:pserver:anonymous@cvs.nagios.sourceforge.net:/cvsroot/nagios login | ||
10 | # cvs -z3 -d:pserver:anonymous@cvs.nagios.sourceforge.net:/cvsroot/nagios co nagios | ||
11 | |||
12 | # Set directories | ||
13 | IN=${HOME}/sf | ||
14 | OUT=/col/htdocs/src/nagios | ||
15 | RPM_TOPDIR=${HOME}/redhat | ||
16 | |||
17 | # Update nagiosplug CVS | ||
18 | cd ${IN}/nagiosplug | ||
19 | rm configure configure.in Makefile.in | ||
20 | cvs update | ||
21 | DS=`date -u +%Y%m%d%H%M` | ||
22 | sed "s/^VER=.*/VER=${DS}/;s/^REL=.*/REL=snapshot/" configure.in > configure.tmp | ||
23 | mv configure.tmp configure.in | ||
24 | aclocal | ||
25 | autoheader | ||
26 | autoconf | ||
27 | automake | ||
28 | autoreconf | ||
29 | |||
30 | # Make the Nagiosplug dist tarball | ||
31 | rm -r build-dist | ||
32 | mkdir build-dist | ||
33 | cd build-dist | ||
34 | ../configure | ||
35 | make dist | ||
36 | cp -fv *.gz ${OUT} | ||
37 | |||
38 | # Make the Nagiosplug custom RPM | ||
39 | echo "%_topdir ${RPM_TOPDIR}" > ./.rpmrc | ||
40 | mkdir -p ${RPM_TOPDIR}/RPMS/i386 ${RPM_TOPDIR}/SRPMS ${RPM_TOPDIR}/SOURCES ${RPM_TOPDIR}/BUILD ${RPM_TOPDIR}/SPECS | ||
41 | rpm --rcfile "/usr/lib/rpm/rpmrc:${IN}/rpmrc" --define 'custom 1' -ta *.gz | ||
42 | cp -fv ~/redhat/RPMS/i386/nagios-plugins-custom-*.i386.rpm /col/htdocs/src/nagios | ||
43 | |||
44 | # Copy the new snapshot and delete the old ones | ||
45 | cd ${OUT} | ||
46 | GLOBIGNORE=nagios-plugins-${DS}-snapshot.tar.gz | ||
47 | rm -f nagios-plugins-*.tar.gz | ||
48 | GLOBIGNORE=nagios-plugins-custom-${DS}-snapshot.i386.rpm | ||
49 | rm -f nagios-plugins-custom-*-snapshot.i386.rpm | ||
50 | cd ~/redhat/SRPMS | ||
51 | rm nagios-plugins-custom-${DS}-snapshot.src.rpm | ||
52 | cd ~/redhat/RPMS/i386 | ||
53 | rm nagios-plugins-custom-${DS}-snapshot.i386.rpm | ||
54 | |||
55 | # Update Nagios CVS | ||
56 | cd ${IN}/sf/nagios | ||
57 | rm configure configure.in nagios.spec base/nagios.c common/common.h \ | ||
58 | html/main.html Makefile.in | ||
59 | cvs update | ||
60 | |||
61 | # Make the Nagios tarball | ||
62 | DS=`date -u +%Y%m%d%H%M` | ||
63 | ./make-tarball ${DS} | ||
64 | |||
65 | # Copy the new snapshot and delete the old ones | ||
66 | mv ../nagios-${DS}.tar.gz /col/htdocs/src/nagios/ | ||
67 | GLOBIGNORE=${OUT}/nagios-${DS}.tar.gz | ||
68 | rm ${OUT}/nagios-20*.tar.gz | ||
69 | |||
diff --git a/tools/update_man_pages b/tools/update_man_pages new file mode 100755 index 0000000..5c4a901 --- /dev/null +++ b/tools/update_man_pages | |||
@@ -0,0 +1,34 @@ | |||
1 | #!/usr/bin/perl | ||
2 | use strict; | ||
3 | use DBI; | ||
4 | #$ENV{PERL5LIB}="plugins-scripts"; # Needed for utils.pm | ||
5 | |||
6 | unless ($ENV{DRUPAL_PASSWORD}) { | ||
7 | die "Must set envvar for DRUPAL_PASSWORD"; | ||
8 | } | ||
9 | |||
10 | my $dbh = DBI->connect("DBI:mysql:database=www;host=127.0.0.1", "www", $ENV{DRUPAL_PASSWORD}); | ||
11 | |||
12 | my @plugin_paths; | ||
13 | push @plugin_paths, (grep { -x $_ && -f $_ } (<plugins-root/*>, <plugins/*>) ); | ||
14 | |||
15 | foreach my $plugin_path (@plugin_paths) { | ||
16 | my $plugin = $plugin_path; | ||
17 | $plugin =~ s%.*/%%; | ||
18 | my $help_option = "--help"; | ||
19 | $help_option = "-h" if ($plugin eq "check_icmp"); | ||
20 | my $help = `$plugin_path $help_option` || die "Cannot run $plugin -h"; | ||
21 | $help =~ s/</</g; | ||
22 | $help =~ s/>/>/g; | ||
23 | |||
24 | my $rows = $dbh->do("UPDATE node SET created=UNIX_TIMESTAMP(NOW()) WHERE title='$plugin'"); | ||
25 | unless ($rows == 1) { | ||
26 | die "Cannot find $plugin in drupal to update - create book page first"; | ||
27 | } | ||
28 | |||
29 | $dbh->do("UPDATE node_revisions SET timestamp=UNIX_TIMESTAMP(NOW()), log='Updated by update_online_manpage', teaser='$plugin --help', body=? WHERE title='$plugin'", | ||
30 | {}, | ||
31 | "<pre>".$help."</pre>"); | ||
32 | } | ||
33 | |||
34 | print "Finished\n"; | ||