From 675a55c04d8b0c93dcd9591ac8f7a610df7f5da3 Mon Sep 17 00:00:00 2001
From: Tomas Plesnik <plesnik@ics.muni.cz>
Date: Fri, 20 Jul 2012 13:26:55 +0200
Subject: [PATCH] uprava instalatoru pro Warden server v2.0.0

---
 src/warden-server/sh/install.sh | 107 +++++---------------------------
 1 file changed, 16 insertions(+), 91 deletions(-)

diff --git a/src/warden-server/sh/install.sh b/src/warden-server/sh/install.sh
index 763699b..56ac5cd 100755
--- a/src/warden-server/sh/install.sh
+++ b/src/warden-server/sh/install.sh
@@ -3,35 +3,11 @@
 # install.sh
 #
 # Copyright (C) 2011-2012 Cesnet z.s.p.o
-# Author(s): 	Tomas PLESNIK 	<plesnik@ics.muni.cz>
-#		Jan SOUKAL	<soukal@ics.muni.cz>
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in
-#    the documentation and/or other materials provided with the
-#    distribution.
-# 3. Neither the name of the Cesnet z.s.p.o nor the names of its
-#    contributors may be used to endorse or promote products derived from
-#     this software without specific prior written permission.
-#
-# This software is provided ``as is'', and any express or implied
-# warranties, including, but not limited to, the implied warranties of
-# merchantability and fitness for a particular purpose are disclaimed.
-# In no event shall the Cesnet z.s.p.o or contributors be liable for
-# any direct, indirect, incidental, special, exemplary, or consequential
-# damages (including, but not limited to, procurement of substitute
-# goods or services; loss of use, data, or profits; or business
-# interruption) however caused and on any theory of liability, whether
-# in contract, strict liability, or tort (including negligence or
-# otherwise) arising in any way out of the use of this software, even
-# if advised of the possibility of such damage.
-
-VERSION="0.2"
+# Use of this source is governed by a BSD-style license, see LICENSE file.
+
+
+VERSION="2.0"
 
 #-------------------------------------------------------------------------------
 #				FUNCTIONS
@@ -86,26 +62,6 @@ err_clean()
 }
 
 
-os_chck()
-{
-	OS=`uname`
-	if [ "$OS" != "Linux" ]; then
-		echo "Sorry, unsupported operating system detected - \"${OS}\"!"
-		exit 1
-	fi
-}
-
-
-shell_chck()
-{
-	SHELL=`echo $SHELL`
-	if [ "$SHELL" != "/bin/bash" ]; then
-		echo "Sorry, this script is usable in Bourne Again Shell (bash) only!"
-		exit 1
-	fi
-}
-
-
 root_chck()
 {
 	if [ $UID -ne 0 ]; then
@@ -177,8 +133,8 @@ modules_chck()
 make_warden_dir()
 {
 	echo -n "Creating warden server directory ... "
-	test -d ${prefix} || mkdir -p ${prefix}	
-	if cp -R $dirname/warden-server $prefix 2> $err; then
+	test -d $prefix || mkdir -p $prefix
+	if cp -R ${dirname}/warden-server $prefix 2> $err; then
 		echo "OK"
 	else
 		err_clean
@@ -187,7 +143,7 @@ make_warden_dir()
 	files=(CHANGELOG INSTALL LICENSE README)
 	for file in ${files[@]};
 	do
-		cp ${dirname}/$file $server_path/doc
+		cp ${dirname}/$file ${server_path}/doc
 	done
 	cp ${dirname}/uninstall.sh $server_path
 }
@@ -263,14 +219,14 @@ make_server_conf()
 changeServerPath()
 {
 	echo "Update server path ...";
-	for file in `ls -1 $bin | grep -v warden-alive | grep -v create_tables.sh | grep -v wardend`
+	for file in `ls -1 $bin`
 	do
 		echo "- update server path: ${bin}/$file"
 		perl -pi -e "s#/opt#${prefix}#" ${bin}/$file
 	done
 
-	echo "- update server path: ${apache_conf}"
-	perl -pi -e "s#/opt#${prefix}#" ${apache_conf}
+	echo "- update server path: $apache_conf"
+	perl -pi -e "s#/opt#${prefix}#" $apache_conf
 
 	echo "- update server path: ${lib}/Warden.pm"
 	perl -pi -e "s#/opt#${prefix}#" ${lib}/Warden.pm
@@ -281,35 +237,21 @@ changeServerPath()
 updateCertsPath()
 {
 
-	echo "- update certs path: ${apache_conf}"
-	perl -pi -e "s#server-cert.pem#${cert}#" ${apache_conf}
-	perl -pi -e "s#server-key.pem#${key}#" ${apache_conf}
-	perl -pi -e "s#ca-cert.pem#${ca_file}#" ${apache_conf}
+	echo "- update certs path: $apache_conf"
+	perl -pi -e "s#server-cert.pem#${cert}#" $apache_conf
+	perl -pi -e "s#server-key.pem#${key}#" $apache_conf
+	perl -pi -e "s#ca-cert.pem#${ca_file}#" $apache_conf
 }
 
-#create_db()
-#{
-#	echo -n "Creating warden server database ... "
-#	$create_tables $db_file 2> $err || err_clean
-#	if chmod 600 $db_file 2> $err; then
-#		echo "OK"
-#	else
-#		err_clean
-#	fi
-#}
-
-
 
 create_symlinks()
 {
 	echo "Creating symbolic links ..."
-	for file in `ls -1 $bin | grep -v warden-alive | grep -v create_tables.sh | grep -v wardend`
+	for file in `ls -1 $bin`
 	do
 		echo "- making symlink: ${local_bin}/$file -> ${bin}/$file"
 		ln -s ${bin}/$file ${local_bin}/$file
 	done
-#	echo "- making symlink: ${bin}/wardend -> $init"
-#	ln -s ${bin}/wardend $init
 }
 
 
@@ -318,14 +260,7 @@ create_symlinks()
 #-------------------------------------------------------------------------------
 
 # list of used Perl modules
-#modules=(SOAP::Lite SOAP::Transport::TCP File::Pid POSIX DBI DBD::SQLite Format::Human::Bytes Sys::Syslog File::Basename FindBin Net::CIDR::Lite DateTime Getopt::Std Switch IO::Socket::SSL)
-modules=(DBI DBD::mysql Format::Human::Bytes Sys::Syslog File::Basename FindBin Net::CIDR::Lite DateTime Getopt::Std Switch IO::Socket::SSL MIME::Base64 Crypt::X509)
-
-# OS test
-os_chck
-
-# Shell test
-shell_chck
+modules=(SOAP::Lite SOAP::Transport::HTTP DBI DBD::mysql Format::Human::Bytes Sys::Syslog File::Basename Net::CIDR::Lite DateTime Getopt::Std Switch IO::Socket::SSL MIME::Base64 Crypt::X509)
 
 # read input
 while getopts "d:k:c:a:Vh" options; do
@@ -352,7 +287,6 @@ hostname=`hostname`
 key_file=`basename $key`
 cert_file=`basename $cert`
 package_version=`cat ${dirname}/warden-server/etc/package_version`
-create_tables="${dirname}/warden-server/bin/create_tables.sh"
 
 [[ $prefix == */ ]] && prefix="${prefix%?}" # remove last char (slash) from prefix
 server_path="${prefix}/warden-server"
@@ -364,9 +298,7 @@ server_conf="${etc}/warden-server.conf"
 apache_conf="${etc}/warden-apache.conf"
 var="${server_path}/var"
 lib="${server_path}/lib"
-db_file="${var}/warden.db"
 err="/tmp/warden-err"
-init="/etc/init.d/wardend"
 
 # check if warden-server is installed
 old_package_chck
@@ -377,9 +309,6 @@ echo "------------------------- Dependencies check-in -------------------------"
 # Perl interpreter test
 perl_chck
 
-## SQLite database engine test
-#sqlite_chck
-
 # Perl modules test
 modules_chck
 
@@ -395,9 +324,6 @@ make_client_conf
 # create server configuration file
 make_server_conf
 
-## create warden server database
-#create_db
-
 #update paths in utilities
 changeServerPath
 
@@ -412,7 +338,6 @@ echo "Please check client configuration file in ${client_conf}!"
 echo "Please check server configuration file in ${server_conf}!"
 echo
 echo "Warden server directory: $server_path"
-#echo "Warden server daemon: $init [start|stop|status|restart|force-stop]"
 echo
 echo "Installation of $package_version package was SUCCESSFUL!!!"
 
-- 
GitLab