micro-evtd (3.4-1) dont-copy-eventscript.patch

Summary

 files/micro-evtd.event |   36 ++++++++----------------------------
 src/micro-evtd.c       |    9 +++++----
 2 files changed, 13 insertions(+), 32 deletions(-)

    
download this patch

Patch contents

--- a/src/micro-evtd.c
+++ b/src/micro-evtd.c
@@ -606,13 +606,14 @@
 	size_t length;
 
 	// Create the command line
-	length = snprintf(strEventScript, CMDLINE_LENGTH, "%smicro-evtd.event %c %d %ld %s %s %d %c",
-		(CP_SCRIPT == cmd ? "" : strTmpPath),	// for copying call the event script via PATH
+	length = snprintf(strEventScript, CMDLINE_LENGTH, "micro-evtd.event %c %d %ld %s %s %d %c",
+		//(CP_SCRIPT == cmd ? "" : strTmpPath),	// for copying call the event script via PATH
 		cmd,
 		cmd2,
 		cmd3,
 		cmdstring,
-		(CP_SCRIPT == cmd ? strTmpPath : log_path),	// for copying log use tmp folder
+		//(CP_SCRIPT == cmd ? strTmpPath : log_path),	// for copying log use tmp folder
+		log_path,
 		iDebugLevel,
 		(CALL_NO_WAIT == type ? '&' : ' '));
 //ToDo:	if ( length >= CMDLINE_LENGTH ) { error handling }
@@ -1787,7 +1788,7 @@
 	i_instandby--;
 
 	// Ensure that our script is copied to RAMDISK first
-	execute_command(CP_SCRIPT, 0, CALL_WAIT);
+	//execute_command(CP_SCRIPT, 0, CALL_WAIT);
 
 	/* Create pid file */
 	execute_command2(CREATE_PID, ".", CALL_WAIT, 0, getpid());
--- a/files/micro-evtd.event
+++ b/files/micro-evtd.event
@@ -4,7 +4,6 @@
 # Sample Event Script written by Bob Perry (2007-2009)
 # NOTE: Some of these events are not syncronous with the daemon.
 #
-# C - Transfer script to tmp location (RAM disk)
 # I - Dump fan speed and temperature to status file
 # 4 - Fan failure logic
 # O - Overheat logic
@@ -24,22 +23,14 @@
 
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
-if [ "$1" = "C" ]; then
-  TMP=$5
-  ## Ensure tmp path is valid
-  LEN=${#TMP}-1
-  if [ $'\r' = "${TMP:${LEN}:1}" ]; then TMP=${TMP:0:$LEN} ; fi
-  if [ ! -d ${TMP} ]; then TMP=/tmp ; fi	# Linkstations have a ramdisk for /tmp, so sub-folders get lost
-else
-  TMP=`dirname $0`
-  DEBUG=$6
-  LOG=$5
-  if [ "$DEBUG" -gt 0 ] && [ -d "$LOG" ]; then
-	  case "$DEBUG" in
-	     1) if [ "$1" = "I" ]; then echo "`date` $2,$3,$4" >> $LOG/micro-evtd.log ; fi ;;
-	     2) echo "`date` $1 $2 $3 $4" >> $LOG/micro-evtd.log
-      esac
-  fi
+TMP=`dirname $0`
+DEBUG=$6
+LOG=$5
+if [ "$DEBUG" -gt 0 ] && [ -d "$LOG" ]; then
+  case "$DEBUG" in
+   1) if [ "$1" = "I" ]; then echo "`date` $2,$3,$4" >> $LOG/micro-evtd.log ; fi ;;
+   2) echo "`date` $1 $2 $3 $4" >> $LOG/micro-evtd.log
+  esac
 fi
 
 fan_fault() {
@@ -51,16 +42,6 @@
 	esac
 }
 
-create_script() {
-	## Ensure path does not exist
-	rm -f $TMP/micro-evtd.event
-	## Create RAM version of control file
-	EVENT=`which micro-evtd.event 2>/dev/null`
-	cp -a "$EVENT" $TMP/.
-	## Stop flashing LEDs and clear error codes
-	micro-evtd -q -s 02520000,02540000
-}
-
 over_heat() {
 	## Overheat detection and notification
 	if [ "$1" -eq 0 ]; then
@@ -176,7 +157,6 @@
 
 case "$1" in
 	4)	fan_fault $2 ;;
-	C)	create_script ;;
 	O)	over_heat $2 ;;
 	I)	dump_info $2 $3 ${4//_/ } ;;
 	B)	button $2 $4;;