From 68bc158d189b952f66d04b57bb480a35066d6c7d Mon Sep 17 00:00:00 2001
From: Jan Soukal <soukal@ics.muni.cz>
Date: Tue, 23 Oct 2012 20:13:33 +0200
Subject: [PATCH] finalni upravy pro klienta 2.1

---
 src/warden-client/doc/example-sender.pl.txt |  0
 src/warden-client/etc/package_version       |  2 +-
 src/warden-client/lib/WardenClientCommon.pm |  0
 src/warden-client/sh/install.sh             | 36 +++++++++++++-
 src/warden-client/sh/uninstall.sh           | 11 ++---
 src/warden-client/sh/update.sh              | 53 +++++++++++++++++++--
 6 files changed, 88 insertions(+), 14 deletions(-)
 mode change 100644 => 100755 src/warden-client/doc/example-sender.pl.txt
 mode change 100644 => 100755 src/warden-client/lib/WardenClientCommon.pm

diff --git a/src/warden-client/doc/example-sender.pl.txt b/src/warden-client/doc/example-sender.pl.txt
old mode 100644
new mode 100755
diff --git a/src/warden-client/etc/package_version b/src/warden-client/etc/package_version
index 0838c14..b0e1372 100644
--- a/src/warden-client/etc/package_version
+++ b/src/warden-client/etc/package_version
@@ -1 +1 @@
-warden-client-2.0
+warden-client-2.1
diff --git a/src/warden-client/lib/WardenClientCommon.pm b/src/warden-client/lib/WardenClientCommon.pm
old mode 100644
new mode 100755
diff --git a/src/warden-client/sh/install.sh b/src/warden-client/sh/install.sh
index 5d996ed..78226b7 100755
--- a/src/warden-client/sh/install.sh
+++ b/src/warden-client/sh/install.sh
@@ -140,18 +140,25 @@ make_warden_dir()
 {
 	echo -n "Creating warden client directory ... "
 	test -d $prefix || mkdir -p prefix
-	if cp -R ${dirname}/warden-client $prefix 2> $err; then
+	
+        if cp -R ${dirname}/warden-client $prefix 2> $err; then
 		echo "OK"
 	else
         	err_clean
 	fi
 
+        echo -n "Copying files ... "
+
 	files=(CHANGELOG INSTALL LICENSE README README.cesnet)
 	for file in ${files[@]};
 	do
 		cp ${dirname}/warden-client/doc/$file ${client_path}/doc
 	done
+        
+        test -d ${client_path}/sh || mkdir -p ${client_path}/sh
 	cp ${dirname}/uninstall.sh ${client_path}/sh
+
+        echo "OK"
 }
 
 
@@ -203,6 +210,33 @@ make_conf_file()
 # SSL_CA_FILE - path to CA certificate file
 #-------------------------------------------------------------------------------
 \$SSL_CA_FILE = \"${ca_file}\";
+
+#-------------------------------------------------------------------------------
+# MAX_RCV_EVENTS_LIMIT - maximum number of events the client is allowd to get
+#                        from the Warden server in one batch
+#-------------------------------------------------------------------------------
+\$MAX_RCV_EVENTS_LIMIT = 6000; #consumes app. 250 MB of memory
+
+#-------------------------------------------------------------------------------
+# Log options
+#
+# LOG_STDERR, LOG_SYSLOG - hide (0) or allow (1) error reporting on STDERR
+#                          and/or to Syslog
+# LOG_STDERR_VERBOSE, LOG_SYSLOG_VERBOSE - print only error message without
+#                                          a stack (0) or print debug info
+#                                          including err. message and stack (1)
+#-------------------------------------------------------------------------------
+\$LOG_STDERR = 1;
+
+\$LOG_SYSLOG = 0;
+\$LOG_SYSLOG_FACILITY = \"local7\";
+
+\$LOG_VERBOSE = 0;
+
+
+
+1;
+
 " > $conf_file 2> $err; ret_val=`echo $?`
 
 	if [ $ret_val -eq 0 ]; then
diff --git a/src/warden-client/sh/uninstall.sh b/src/warden-client/sh/uninstall.sh
index c2b52d0..96e6341 100755
--- a/src/warden-client/sh/uninstall.sh
+++ b/src/warden-client/sh/uninstall.sh
@@ -6,7 +6,7 @@
 #
 # Use of this source is governed by a BSD-style license, see LICENSE file.  
 
-VERSION="2.0"
+VERSION="2.1"
 
 #-------------------------------------------------------------------------------
 #				FUNCTIONS
@@ -126,12 +126,6 @@ uninstall_warden_client()
 #				MAIN
 #-------------------------------------------------------------------------------
 
-# OS test
-os_chck
-
-# Shell test
-shell_chck
-
 # read input
 while getopts "d:Vh" options; do
 	case $options in
@@ -156,6 +150,9 @@ obtain_package_version
 echo
 echo "------------------------- Uninstallation process --------------------------------"
 
+# root check
+root_chck
+
 # check if $prefix/warden-client directory exist
 warden_dir_chck
 
diff --git a/src/warden-client/sh/update.sh b/src/warden-client/sh/update.sh
index 6256499..a08085c 100755
--- a/src/warden-client/sh/update.sh
+++ b/src/warden-client/sh/update.sh
@@ -7,7 +7,7 @@
 # Use of this source is governed by a BSD-style license, see LICENSE file.
 
 
-VERSION="2.0"
+VERSION="2.1"
 
 #-------------------------------------------------------------------------------
 #				FUNCTIONS
@@ -184,6 +184,28 @@ make_conf_file()
 	ssl_key_file=`cat $conf_file | grep '$SSL_KEY_FILE'`
 	ssl_cert_file=`cat $conf_file | grep '$SSL_CERT_FILE'`
 	ssl_ca_file=`cat $conf_file | grep '$SSL_CA_FILE'`
+        max_rcv_events_limit=`cat $conf_file | grep '$MAX_RCV_EVENTS_LIMIT'`
+
+        log_stderr=`cat $conf_file | grep '$LOG_STDERR'`
+        if [ -z $log_stderr ]; then
+          log_stderr="\$LOG_STDERR = 1;"
+        fi
+
+        log_syslog=`cat $conf_file | grep '$LOG_SYSLOG'`
+        if [ -z $log_syslog ]; then
+          log_syslog="\$LOG_SYSLOG = 0;"
+        fi
+
+        log_syslog_facility=`cat $conf_file | grep '$LOG_SYSLOG_FACILITY'`
+        if [ -z $log_syslog_facility ]; then 
+          log_syslog_facility="\$LOG_SYSLOG_FACILITY = \"local7\";"
+        fi
+
+        log_verbose=`cat $conf_file | grep '$LOG_VERBOSE'`
+        if [ -z $log_verbose ]; then 
+          log_verbose="\$LOG_VERBOSE = 0;"
+        fi
+        
 	echo "#
 # warden-client.conf - configuration file for the warden sender/receiver client
 #
@@ -207,6 +229,30 @@ $ssl_cert_file
 # SSL_CA_FILE - path to CA certificate file
 #-------------------------------------------------------------------------------
 $ssl_ca_file
+
+#-------------------------------------------------------------------------------
+# MAX_RCV_EVENTS_LIMIT - maximum number of events the client is allowd to get
+#                        from the Warden server in one batch
+#-------------------------------------------------------------------------------
+$max_rcv_events_limit
+
+#-------------------------------------------------------------------------------
+# Log options
+#
+# LOG_STDERR, LOG_SYSLOG - hide (0) or allow (1) error reporting on STDERR
+#                          and/or to Syslog
+# LOG_STDERR_VERBOSE, LOG_SYSLOG_VERBOSE - print only error message without
+#                                          a stack (0) or print debug info
+#                                          including err. message and stack (1)
+#-------------------------------------------------------------------------------
+$log_stderr
+
+$log_syslog
+$log_syslog_facility
+
+$log_verbose
+
+1;
 " > $conf_file 2> $err; ret_val=`echo $?`
 
 	if [ $ret_val -eq 0 ]; then
@@ -221,9 +267,6 @@ change_permissions()
 {
 	echo -n "Changing permissions to updated package ... "
 	chown -R $user: $client_path 2>$err || err_clean
-	key_file=`echo $ssl_key_file | cut -d "\"" -f 2`
-	cert_file=`echo $ssl_cert_file | cut -d "\"" -f 2`
-       	chmod 400 $key_file $cert_file || err_clean 
        	chmod 644 $old_package_version_file || err_clean
 	if chmod 600 $conf_file; then
 		echo "OK"
@@ -239,7 +282,7 @@ change_permissions()
 #-------------------------------------------------------------------------------
 
 # list of used Perl modules
-modules=(SOAP::Lite IO::Socket::SSL SOAP::Transport::HTTP FindBin DateTime)
+modules=(SOAP::Lite IO::Socket::SSL SOAP::Transport::HTTP FindBin DateTime Carp)
 
 # read input
 while getopts "d:Vh" options; do
-- 
GitLab