From 7098ef16fb8a7f86fcd9dcb61e0e4e19c0cc107a Mon Sep 17 00:00:00 2001
From: Tomas Plesnik <plesnik@ics.muni.cz>
Date: Wed, 7 Dec 2011 11:18:19 +0100
Subject: [PATCH] provedena revize kodu

---
 src/warden-client/sh/install.sh | 38 +++++++++++++++++----------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/warden-client/sh/install.sh b/src/warden-client/sh/install.sh
index 0d6e579..454321b 100755
--- a/src/warden-client/sh/install.sh
+++ b/src/warden-client/sh/install.sh
@@ -38,21 +38,21 @@ VERSION="1.1.0"
 #-------------------------------------------------------------------------------
 usage()
 {
-echo "Usage: `basename $0` [-d <directory>] [-u <user>] [-k <ssl_key_file>] [-c <ssl_cert_file>] [-a <ssl_ca_file>] [-hV]"
-echo "-d <directory>            installation directory (default: /opt)"
-echo "-u <user>                 owner of warden client package (user for running detection scripts)"
-echo "-k <ssl_key_file>         path to SSL certificate key file"
-echo "-c <ssl_cert_file>        path to SSL certificate file"
-echo "-a <ssl_ca_file>          path to CA certificate file"
-echo "-h                        print this help"
-echo "-V                        print script version number and exit"
-echo
-echo "Example: ./`basename $0` -d /opt -u detector -k /etc/ssl/private/client.key -c /etc/ssl/certs/client.pem -a /etc/ssl/certs/tcs-ca-bundle.pem"
-echo
-echo "Note: You must be root for running this script."
-echo "      For more information about installation process, see README file (section Installation)."
-echo
-exit 0
+  echo "Usage: `basename $0` [-d <directory>] [-u <user>] [-k <ssl_key_file>] [-c <ssl_cert_file>] [-a <ssl_ca_file>] [-hV]"
+  echo "-d <directory>            installation directory (default: /opt)"
+  echo "-u <user>                 owner of warden client package (user for running detection scripts)"
+  echo "-k <ssl_key_file>         path to SSL certificate key file"
+  echo "-c <ssl_cert_file>        path to SSL certificate file"
+  echo "-a <ssl_ca_file>          path to CA certificate file"
+  echo "-h                        print this help"
+  echo "-V                        print script version number and exit"
+  echo
+  echo "Example: ./`basename $0` -d /opt -u detector -k /etc/ssl/private/client.key -c /etc/ssl/certs/client.pem -a /etc/ssl/certs/tcs-ca-bundle.pem"
+  echo
+  echo "Note: You must be root for running this script."
+  echo "      For more information about installation process, see README file (section Installation)."
+  echo
+  exit 0
 }
 
 
@@ -67,6 +67,7 @@ err()
 {
   echo "FAILED!"
   cat $err
+  rm -rf $err
   echo
   echo "Installation FAILED!!!"
   exit 1
@@ -119,7 +120,7 @@ params_chck()
 {
   if [ -z $prefix ]; then
     prefix=/opt
-    echo "Warning: parameter -d <directory> is not set - default installation directory is /opt!"
+    echo "Warning: parameter -d <directory> is not set - default installation directory is $prefix!"
   fi
   if [ -z $user ]; then
     echo "Parameter -u <user> is not set!"
@@ -148,6 +149,7 @@ perl_chck()
     echo "OK"
   else
     echo "FAILED!"
+    echo "Error: Perl interpreter is not installed!"
     exit 1
   fi
 }
@@ -162,7 +164,7 @@ modules_chck()
     if [ $ret_val -eq 0 ]; then
       echo "OK"
     else
-     err
+      err
     fi
   done
 }
@@ -184,13 +186,13 @@ installation_dir_chck()
 make_warden_dir()
 {
   echo -n "Making warden client directory ... "
-  cp CHANGELOG INSTALL LICENSE README "$client_path/doc"
   cp -R ./warden-client $prefix 2> $err; ret_val=`echo $?`
   if [ $ret_val -eq 0 ]; then
     echo "OK"
   else
     err_clean
   fi
+  cp -u CHANGELOG INSTALL LICENSE README "$client_path/doc"
 }
 
 
-- 
GitLab