Skip to content
Snippets Groups Projects
Commit e011fff1 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

presun skriptu z opravene verzi 1.2.0

parent 338355c8
No related branches found
No related tags found
No related merge requests found
......@@ -10,12 +10,12 @@ $URI = "https://warden-dev.cesnet.cz:443/Warden";
#-------------------------------------------------------------------------------
# SSL_KEY_FILE - path to client SSL certificate key file
#-------------------------------------------------------------------------------
$SSL_KEY_FILE = "/opt/warden-client/etc/barny.ics.muni.cz.key";
$SSL_KEY_FILE = "/opt/warden-client/etc/warden-dev.cesnet.cz.key";
#-------------------------------------------------------------------------------
# SSL_CERT_FILE - path to client SSL certificate file
#-------------------------------------------------------------------------------
$SSL_CERT_FILE = "/opt/warden-client/etc/barny.ics.muni.cz.pem";
$SSL_CERT_FILE = "/opt/warden-client/etc/warden-dev.cesnet.cz.pem";
#-------------------------------------------------------------------------------
# SSL_CA_FILE - path to CA certificate file
......
......@@ -6,6 +6,7 @@
#
# Use of this source is governed by a BSD-style license, see LICENSE file.
VERSION="2.0"
#-------------------------------------------------------------------------------
......@@ -75,7 +76,7 @@ params_chck()
{
if [ -z $prefix ]; then
prefix=/opt
echo "Warning: parameter -d <directory> is not set - default installation directory is $prefix!"
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!"
......@@ -98,7 +99,7 @@ params_chck()
old_client_chck()
{
old_package_version_file="$etc/package_version"
old_package_version_file={$etc}/package_version
if [ -f $old_package_version_file ]; then
old_package_version=`cat $old_package_version_file`
echo "Sorry, but $old_package_version package is installed!"
......@@ -111,8 +112,7 @@ old_client_chck()
perl_chck()
{
echo -n "Checking Perl interpreter ... "
which perl 1>/dev/null; ret_val=`echo $?`
if [ $ret_val -eq 0 ]; then
if which perl 1> /dev/null; then
echo "OK"
else
echo "FAILED!"
......@@ -127,8 +127,7 @@ modules_chck()
for module in ${modules[@]};
do
echo -n "Checking $module module ... "
perl -e "use $module" 2> $err; ret_val=`echo $?`
if [ $ret_val -eq 0 ]; then
if perl -e "use $module" 2> $err; then
echo "OK"
else
err
......@@ -140,8 +139,8 @@ modules_chck()
make_warden_dir()
{
echo -n "Creating warden client directory ... "
cp -R $dirname/warden-client $prefix 2> $err; ret_val=`echo $?`
if [ $ret_val -eq 0 ]; then
test -d $prefix || mkdir -p $prefix
if cp -R ${dirname}/warden-client $prefix 2> $err; then
echo "OK"
else
err_clean
......@@ -150,17 +149,16 @@ make_warden_dir()
files=(CHANGELOG INSTALL LICENSE README README.cesnet)
for file in ${files[@]};
do
cp $dirname/$file "$client_path/doc"
cp ${dirname}/$file ${client_path}/doc
done
cp $dirname/uninstall.sh "$client_path"
cp ${dirname}/uninstall.sh $client_path
}
copy_key()
{
echo -n "Copying certificate key file ... "
cp $key $etc 2> $err; ret_val=`echo $?`
if [ $ret_val -eq 0 ]; then
if cp $key $etc 2> $err; then
echo "OK"
else
err_clean
......@@ -171,8 +169,7 @@ copy_key()
copy_cert()
{
echo -n "Copying certificate file ... "
cp $cert $etc 2> $err; ret_val=`echo $?`
if [ $ret_val -eq 0 ]; then
if cp $cert $etc 2> $err; then
echo "OK"
else
err_clean
......@@ -195,17 +192,17 @@ make_conf_file()
#-------------------------------------------------------------------------------
# SSL_KEY_FILE - path to client SSL certificate key file
#-------------------------------------------------------------------------------
\$SSL_KEY_FILE = \"$etc/$key_file\";
\$SSL_KEY_FILE = \"${etc}/${key_file}\";
#-------------------------------------------------------------------------------
# SSL_CERT_FILE - path to client SSL certificate file
#-------------------------------------------------------------------------------
\$SSL_CERT_FILE = \"$etc/$cert_file\";
\$SSL_CERT_FILE = \"${etc}/${cert_file}\";
#-------------------------------------------------------------------------------
# SSL_CA_FILE - path to CA certificate file
#-------------------------------------------------------------------------------
\$SSL_CA_FILE = \"$ca_file\";
\$SSL_CA_FILE = \"${ca_file}\";
" > $conf_file 2> $err; ret_val=`echo $?`
if [ $ret_val -eq 0 ]; then
......@@ -219,8 +216,10 @@ make_conf_file()
change_permissions()
{
echo -n "Changing permissions to installed package ... "
chown -R $user: $client_path 2>$err; ret_val=`echo $?`
if [ $ret_val -eq 0 ]; then
chown -R $user: $client_path 2> $err || err_clean
chmod 400 ${etc}/$key_file ${etc}/$cert_file || err_clean
chmod 644 ${etc}/package_version || err_clean
if chmod 600 $conf_file; then
echo "OK"
else
err_clean
......@@ -258,13 +257,13 @@ params_chck
# create variables
dirname=`dirname $0`
package_version=`cat $dirname/warden-client/etc/package_version`
package_version=`cat ${dirname}/warden-client/etc/package_version`
key_file=`basename $key`
cert_file=`basename $cert`
[[ $prefix == */ ]] && prefix="${prefix%?}" # remove last char (slash) from prefix
client_path="$prefix/warden-client"
etc="$client_path/etc"
conf_file="$etc/warden-client.conf"
client_path="${prefix}/warden-client"
etc="${client_path}/etc"
conf_file="${etc}/warden-client.conf"
err="/tmp/warden-err"
# check if warden-client is installed
......@@ -299,7 +298,9 @@ make_conf_file
change_permissions
echo
echo "Please check configuration file in $conf_file!"
echo "Please check configuration file in ${conf_file}!"
echo
echo "Warden client directory: $client_path"
echo
echo "Installation of $package_version package was SUCCESSFUL!!!"
......
......@@ -72,7 +72,7 @@ params_chck()
{
if [ -z $prefix ]; then
prefix=/opt
echo "Warning: parameter -d <directory> is not set - default uninstallation directory is $prefix!"
echo "Warning: parameter -d <directory> is not set - default uninstallation directory is ${prefix}!"
fi
}
......@@ -104,7 +104,7 @@ backup()
{
echo -n "Backing-up warden client directory ... "
mkdir $backup_dir
if cp -R $client_path $backup_dir 2> $err; then
if cp -R ${client_path}/* $backup_dir 2> $err; then
echo "OK"
else
err
......@@ -126,6 +126,12 @@ uninstall_warden_client()
# MAIN
#-------------------------------------------------------------------------------
# OS test
os_chck
# Shell test
shell_chck
# read input
while getopts "d:Vh" options; do
case $options in
......@@ -136,12 +142,6 @@ while getopts "d:Vh" options; do
esac
done
# root test
root_chck
# params test
params_chck
# create variables
[[ $prefix == */ ]] && prefix="${prefix%?}" # remove last char (slash) from prefix
client_path="${prefix}/warden-client"
......
......@@ -4,7 +4,8 @@
#
# Copyright (C) 2011-2012 Cesnet z.s.p.o
#
# Use of this source is governed by a BSD-style license, see LICENSE file.
# Use of this source is governed by a BSD-style license, see LICENSE file.
VERSION="2.0"
......@@ -73,7 +74,7 @@ params_chck()
{
if [ -z $prefix ]; then
prefix=/opt
echo "Warning: parameter -d <directory> is not set - default installation directory is $prefix!"
echo "Warning: parameter -d <directory> is not set - default installation directory is ${prefix}!"
fi
}
......@@ -138,7 +139,7 @@ backup()
{
echo -n "Backing-up warden client directory ... "
mkdir $backup_dir
if cp -R $client_path $backup_dir 2> $err; then
if cp -R ${client_path}/* $backup_dir 2> $err; then
echo "OK"
else
err
......@@ -220,9 +221,9 @@ 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 | cut -d "\"" -f 1
cert_file=`echo $ssl_cert_file` | cut -d "\"" -f 2 | cut -d "\"" -f 1
chmod 400 ${etc}/$key_file ${etc}/$cert_file || 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"
......@@ -301,7 +302,7 @@ make_conf_file
change_permissions
echo
echo "Please check configuration file in $conf_file!"
echo "Please check configuration file in ${conf_file}!"
echo
echo "Warden client directory: $client_path"
echo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment