[packages/nagios-plugin-check_ftp_fully] fix bashisms

glen glen at pld-linux.org
Wed Mar 25 11:05:48 CET 2015


commit eaf349f350c023cfba249dee9f25ab6bee96f1be
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Wed Mar 25 12:03:37 2015 +0200

    fix bashisms

 bashisms.patch                     | 81 ++++++++++++++++++++++++++++++++++++++
 nagios-plugin-check_ftp_fully.spec |  2 +
 2 files changed, 83 insertions(+)
---
diff --git a/nagios-plugin-check_ftp_fully.spec b/nagios-plugin-check_ftp_fully.spec
index 6157b98..f518ee9 100644
--- a/nagios-plugin-check_ftp_fully.spec
+++ b/nagios-plugin-check_ftp_fully.spec
@@ -10,6 +10,7 @@ Source0:	http://www.deathwing00.org/nagios/check_ftp_fully
 # Source0-md5:	821dbac0cc911e8250e41d7cca56cc62
 Source1:	%{plugin}.cfg
 Patch0:		args.patch
+Patch1:		bashisms.patch
 URL:		http://exchange.nagios.org/directory/Plugins/Network-Protocols/FTP/check_ftp_fully/details
 Requires:	lftp
 Requires:	nagios-common
@@ -31,6 +32,7 @@ be extended easily.
 %setup -qcT
 cp -p %{SOURCE0} %{plugin}
 %patch0 -p1
+%patch1 -p1
 
 %install
 rm -rf $RPM_BUILD_ROOT
diff --git a/bashisms.patch b/bashisms.patch
new file mode 100644
index 0000000..a89c1b4
--- /dev/null
+++ b/bashisms.patch
@@ -0,0 +1,81 @@
+--- nagios-plugin-check_ftp_fully-0.1/check_ftp_fully~	2015-03-25 11:58:38.476178569 +0200
++++ nagios-plugin-check_ftp_fully-0.1/check_ftp_fully	2015-03-25 12:02:08.343698845 +0200
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ 
+ # check_ftp_fully - plugin for nagios to check that an ftp server is working
+ #                   correctly and allows to log in, list, put, get and delete
+@@ -35,33 +35,33 @@
+ FILENAME=".fspftpcheck."$(/bin/date +%s)
+ FILEPATH=${FILEDIR}${FILENAME}
+ 
+-function setup {
++setup() {
+     echo $(/bin/date) > ${FILEPATH}
+ }
+ 
+-function teardown {
++teardown() {
+     /bin/rm -f ${FILEPATH}
+ }
+ 
+-function f_ok {
++f_ok() {
+     teardown
+     echo "OK: "${1}
+     exit 0
+ }
+ 
+-function f_war {
++f_war() {
+     teardown
+     echo "WARNING: "${1}
+     exit 1
+ }
+ 
+-function f_cri {
++f_cri() {
+     teardown
+     echo "CRITICAL: "${1}
+     exit 2
+ }
+ 
+-function f_unk {
++f_unk() {
+     teardown
+     echo "UNKNOWN: "${1}
+     exit 3
+@@ -88,28 +88,28 @@
+ setup
+ 
+ # List test
+-${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "LS; QUIT" ${HOSTNAME} &> /dev/null
++${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "LS; QUIT" ${HOSTNAME} >/dev/null 2>&1
+ result=$?
+ if [ ${result} != 0 ]; then
+     f_cri "FTP check failed when trying to list the contents of a directory."
+ fi
+ 
+ # Put test
+-${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "PUT ${FILEPATH}; QUIT" ${HOSTNAME} &> /dev/null
++${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "PUT ${FILEPATH}; QUIT" ${HOSTNAME} >/dev/null 2>&1
+ result=$?
+ if [ ${result} != 0 ]; then
+     f_cri "FTP check failed when trying to put a file into a directory."
+ fi
+ 
+ # Get test
+-${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "GET ${FILENAME}; quit" ${HOSTNAME} &> /dev/null
++${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "GET ${FILENAME}; quit" ${HOSTNAME} >/dev/null 2>&1
+ result=$?
+ if [ ${result} != 0 ]; then
+     f_cri "FTP check failed when trying to get a file from a directory."
+ fi
+ 
+ # Get test
+-${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "RM -f ${FILENAME}; QUIT" ${HOSTNAME} &> /dev/null
++${LFTP} -u ${USERNAME},${PASSWORD} -p${PORT} -e "RM -f ${FILENAME}; QUIT" ${HOSTNAME} >/dev/null 2>&1
+ result=$?
+ if [ ${result} != 0 ]; then
+     f_cri "FTP check failed when trying to delete a file from a directory."
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nagios-plugin-check_ftp_fully.git/commitdiff/eaf349f350c023cfba249dee9f25ab6bee96f1be



More information about the pld-cvs-commit mailing list