Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden - archive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
713
Warden
Warden - archive
Commits
1ac16a3e
Commit
1ac16a3e
authored
13 years ago
by
Tomáš Plesník
Browse files
Options
Downloads
Patches
Plain Diff
instalacni skript serveru
parent
1da619e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/warden-server/sh/install.sh
+135
-65
135 additions, 65 deletions
src/warden-server/sh/install.sh
with
135 additions
and
65 deletions
src/warden-server/sh/install.sh
+
135
−
65
View file @
1ac16a3e
...
@@ -121,10 +121,6 @@ params_chck()
...
@@ -121,10 +121,6 @@ params_chck()
prefix
=
/opt
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
fi
if
[
-z
$user
]
;
then
echo
"Parameter -u <user> is not set!"
exit
1
fi
if
[
-z
$key
]
;
then
if
[
-z
$key
]
;
then
echo
"Parameter -k <ssl_key_file> is not set!"
echo
"Parameter -k <ssl_key_file> is not set!"
exit
1
exit
1
...
@@ -140,13 +136,13 @@ params_chck()
...
@@ -140,13 +136,13 @@ params_chck()
}
}
old_
client
_chck
()
old_
package
_chck
()
{
{
old_package_version_file
=
"
$etc
/package_version"
old_package_version_file
=
"
$etc
/package_version"
if
[
-f
$old_package_version_file
]
;
then
if
[
-f
$old_package_version_file
]
;
then
old_package_version
=
`
cat
$old_package_version_file
`
old_package_version
=
`
cat
$old_package_version_file
`
echo
"Sorry, but
$old_package_version
package is installed!"
echo
"Sorry, but
$old_package_version
package is installed!"
echo
"For update of warden
client
package please use update.sh
script.
"
echo
"For update of warden
server
package please use update.sh"
exit
1
exit
1
fi
fi
}
}
...
@@ -155,8 +151,7 @@ old_client_chck()
...
@@ -155,8 +151,7 @@ old_client_chck()
perl_chck
()
perl_chck
()
{
{
echo
-n
"Checking Perl interpreter ... "
echo
-n
"Checking Perl interpreter ... "
which perl 1>/dev/null
;
ret_val
=
`
echo
$?
`
if
which perl 1> /dev/null
;
then
if
[
$ret_val
-eq
0
]
;
then
echo
"OK"
echo
"OK"
else
else
echo
"FAILED!"
echo
"FAILED!"
...
@@ -165,14 +160,24 @@ perl_chck()
...
@@ -165,14 +160,24 @@ perl_chck()
fi
fi
}
}
sqlite_chck
()
{
echo
-n
"Checking SQLite database engine ... "
if
which sqlite3 1> /dev/null
;
then
echo
"OK"
else
echo
"FAILED!"
echo
"Error: SQLite3 database engine is not installed!"
exit
1
fi
}
modules_chck
()
modules_chck
()
{
{
for
module
in
${
modules
[@]
}
;
for
module
in
${
modules
[@]
}
;
do
do
echo
-n
"Checking
$module
module ... "
echo
-n
"Checking
$module
module ... "
perl
-e
"use
$module
"
2>
$err
;
ret_val
=
`
echo
$?
`
if
perl
-e
"use
$module
"
2>
$err
;
then
if
[
$ret_val
-eq
0
]
;
then
echo
"OK"
echo
"OK"
else
else
err
err
...
@@ -183,39 +188,50 @@ modules_chck()
...
@@ -183,39 +188,50 @@ modules_chck()
make_warden_dir
()
make_warden_dir
()
{
{
echo
-n
"Creating warden client directory ... "
echo
-n
"Creating warden server directory ... "
cp
-R
$dirname
/warden-client
$prefix
2>
$err
;
ret_val
=
`
echo
$?
`
if
cp
-R
$dirname
/warden-server
$prefix
2>
$err
;
then
if
[
$ret_val
-eq
0
]
;
then
echo
"OK"
echo
"OK"
else
else
err_clean
err_clean
fi
fi
files
=(
CHANGELOG INSTALL LICENSE README
README.cesnet
)
files
=(
CHANGELOG INSTALL LICENSE README
)
for
file
in
${
files
[@]
}
;
for
file
in
${
files
[@]
}
;
do
do
cp
$dirname
/
$file
"
$client
_path
/doc
"
cp
$dirname
/
$file
$server
_path
/doc
done
done
cp
$dirname
/uninstall.sh
"
$client
_path
"
cp
$dirname
/uninstall.sh
$server
_path
}
}
copy_key
()
make_client_conf
()
{
{
echo
-n
"Copying certificate key file ... "
echo
-n
"Creating client configuration file ... "
cp
$key
$etc
2>
$err
;
ret_val
=
`
echo
$?
`
echo
"#
if
[
$ret_val
-eq
0
]
;
then
# warden-client.conf - configuration file for the warden sender/receiver client
echo
"OK"
#
else
err_clean
fi
}
#-------------------------------------------------------------------------------
# URI - URI address of Warden server
#-------------------------------------------------------------------------------
\$
URI =
\"
https://
${
hostname
}
:443/Warden
\"
;
#-------------------------------------------------------------------------------
# SSL_KEY_FILE - path to client SSL certificate key file
#-------------------------------------------------------------------------------
\$
SSL_KEY_FILE =
\"
${
etc
}
/
${
key_file
}
\"
;
#-------------------------------------------------------------------------------
# SSL_CERT_FILE - path to client SSL certificate file
#-------------------------------------------------------------------------------
\$
SSL_CERT_FILE =
\"
${
etc
}
/
${
cert_file
}
\"
;
#-------------------------------------------------------------------------------
# SSL_CA_FILE - path to CA certificate file
#-------------------------------------------------------------------------------
\$
SSL_CA_FILE =
\"
${
ca_file
}
\"
;
"
>
$client_conf
2>
$err
;
ret_val
=
`
echo
$?
`
copy_cert
()
{
echo
-n
"Copying certificate file ... "
cp
$cert
$etc
2>
$err
;
ret_val
=
`
echo
$?
`
if
[
$ret_val
-eq
0
]
;
then
if
[
$ret_val
-eq
0
]
;
then
echo
"OK"
echo
"OK"
else
else
...
@@ -224,33 +240,63 @@ copy_cert()
...
@@ -224,33 +240,63 @@ copy_cert()
}
}
make_
conf_file
()
make_
server_conf
()
{
{
echo
-n
"Creating configuration file ... "
echo
-n
"Creating
server
configuration file ... "
echo
"#
echo
"#
# warden-
client
.conf - configuration file for
the w
arden se
nder/receiver client
# warden-
server
.conf - configuration file for
W
arden se
rver
#
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
URI - URI
address of
W
arden server
#
ADDRESS - IP
address of
w
arden server
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
\$
URI =
\"
https://warden.cesnet.cz:443/Warden
\"
;
\$
ADDRESS =
\"
${
hostname
}
\"
;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
SSL_KEY_FILE - path to client SSL certificate key file
#
PORT - used TCP port for Warden server
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
\$
SSL_KEY_FILE =
\"
$etc
/
$key_file
\"
;
\$
PORT =
\"
443
\"
;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
SSL_CERT_FILE - path to client SSL certificate file
#
BASEDIR - base directory of Warden server
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
\$
SSL_CERT_FILE =
\"
$etc
/
$cert_file
\"
;
\$
BASEDIR =
\"
${
server_path
}
\"
;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# SSL_CA_FILE - path to CA certificate file
# VARDIR - var directory
#-------------------------------------------------------------------------------
\$
VARDIR =
\"\$
BASEDIR/var/
\"
;
#-------------------------------------------------------------------------------
# LOGDIR - logging directory
#-------------------------------------------------------------------------------
\$
LOGDIR =
\"
/var/log/
\"
;
#-------------------------------------------------------------------------------
# PIDDIR - process ID directory
#-------------------------------------------------------------------------------
\$
PIDDIR =
\"
/var/run/
\"
;
#-------------------------------------------------------------------------------
# SSL_KEY_FILE - path to server SSL certificate key file
#-------------------------------------------------------------------------------
\$
SSL_KEY_FILE =
\"
${
key
}
\"
;
#-------------------------------------------------------------------------------
# SSL_CERT_FILE - path to server SSL certificate file
#-------------------------------------------------------------------------------
\$
SSL_CERT_FILE =
\"
${
cert
}
\"
;
#-------------------------------------------------------------------------------
# SSL_CA_FILE - path to CA ceritificate file
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
\$
SSL_CA_FILE =
\"
$ca_file
\"
;
\$
SSL_CA_FILE =
\"
${
ca_file
}
\"
;
"
>
$conf_file
2>
$err
;
ret_val
=
`
echo
$?
`
#-------------------------------------------------------------------------------
# FACILITY - syslog facility
#-------------------------------------------------------------------------------
\$
FACILITY =
\"
local7
\"
;
"
>
$server_conf
2>
$err
;
ret_val
=
`
echo
$?
`
if
[
$ret_val
-eq
0
]
;
then
if
[
$ret_val
-eq
0
]
;
then
echo
"OK"
echo
"OK"
...
@@ -260,11 +306,11 @@ make_conf_file()
...
@@ -260,11 +306,11 @@ make_conf_file()
}
}
c
hange_permissions
()
c
reate_db
()
{
{
echo
-n
"C
hanging permissions to installed packag
e ... "
echo
-n
"C
reating warden server databas
e ... "
chown
-R
$user
:
$client_path
2>
$err
;
ret_val
=
`
echo
$?
`
$create_tables
$db_file
2>
$err
||
err_clean
if
[
$ret_val
-eq
0
]
;
then
if
chmod
600
$db_file
2>
$err
;
then
echo
"OK"
echo
"OK"
else
else
err_clean
err_clean
...
@@ -272,13 +318,24 @@ change_permissions()
...
@@ -272,13 +318,24 @@ change_permissions()
}
}
create_symlinks
()
{
echo
"Creating symbolic links ..."
for
file
in
`
ls
-1
$bin
|
grep
-v
warden-alive |
grep
-v
create_tables.sh |
grep
-v
wardend
`
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
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# MAIN
# MAIN
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# list of used Perl modules
# list of used Perl modules
modules
=(
SOAP::Lite
IO::Socket::SSL
SOAP::Transport::TCP Fi
ndBin DateTime
)
modules
=(
SOAP::Lite SOAP::Transport::TCP Fi
le::Pid POSIX DBI DBD::SQLite Format::Human::Bytes Sys::Syslog File::Basename FindBin Net::CIDR::Lite DateTime Getopt::Std Switch IO::Socket::SSL
)
# OS test
# OS test
os_chck
os_chck
...
@@ -287,10 +344,9 @@ os_chck
...
@@ -287,10 +344,9 @@ os_chck
shell_chck
shell_chck
# read input
# read input
while
getopts
"d:
u:
k:c:a:Vh"
options
;
do
while
getopts
"d:k:c:a:Vh"
options
;
do
case
$options
in
case
$options
in
d
)
prefix
=
$OPTARG
;;
d
)
prefix
=
$OPTARG
;;
u
)
user
=
$OPTARG
;;
k
)
key
=
$OPTARG
;;
k
)
key
=
$OPTARG
;;
c
)
cert
=
$OPTARG
;;
c
)
cert
=
$OPTARG
;;
a
)
ca_file
=
$OPTARG
;;
a
)
ca_file
=
$OPTARG
;;
...
@@ -308,17 +364,26 @@ params_chck
...
@@ -308,17 +364,26 @@ params_chck
# create variables
# create variables
dirname
=
`
dirname
$0
`
dirname
=
`
dirname
$0
`
package_version
=
`
cat
$dirname
/warden-client/etc/package_version
`
hostname
=
`
hostname
`
key_file
=
`
basename
$key
`
key_file
=
`
basename
$key
`
cert_file
=
`
basename
$cert
`
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
[[
$prefix
==
*
/
]]
&&
prefix
=
"
${
prefix
%?
}
"
# remove last char (slash) from prefix
client_path
=
"
$prefix
/warden-client"
server_path
=
"
${
prefix
}
/warden-server"
etc
=
"
$client_path
/etc"
bin
=
"
${
server_path
}
/bin"
conf_file
=
"
$etc
/warden-client.conf"
local_bin
=
"/usr/local/bin"
etc
=
"
${
server_path
}
/etc"
client_conf
=
"
${
etc
}
/warden-client.conf"
server_conf
=
"
${
etc
}
/warden-server.conf"
var
=
"
${
server_path
}
/var"
db_file
=
"
${
var
}
/warden.db"
err
=
"/tmp/warden-err"
err
=
"/tmp/warden-err"
init
=
"/etc/init.d/wardend"
# check if warden-
client
is installed
# check if warden-
server
is installed
old_
client
_chck
old_
package
_chck
echo
echo
echo
"------------------------- Dependencies check-in -------------------------"
echo
"------------------------- Dependencies check-in -------------------------"
...
@@ -326,30 +391,35 @@ echo "------------------------- Dependencies check-in -------------------------"
...
@@ -326,30 +391,35 @@ echo "------------------------- Dependencies check-in -------------------------"
# Perl interpreter test
# Perl interpreter test
perl_chck
perl_chck
# SQLite database engine test
sqlite_chck
# Perl modules test
# Perl modules test
modules_chck
modules_chck
echo
echo
echo
"------------------------- Installation process --------------------------"
echo
"------------------------- Installation process --------------------------"
# make warden client directory
# make warden client directory
make_warden_dir
make_warden_dir
# c
opy cert key
file
# c
reate client configuration
file
copy_key
make_client_conf
# c
opy cert
file
# c
reate server configuration
file
copy_cert
make_server_conf
# create
conf fil
e
# create
warden server databas
e
make_conf_file
create_db
# c
hange permissions
# c
rate symlinks from warden server bin directory to /usr/local/bin
c
hange_permission
s
c
reate_symlink
s
echo
echo
echo
"Please check configuration file in
$conf_file
!"
echo
"Please check client configuration file in
$client_conf
!"
echo
"Please check server configuration file in
$server_conf
!"
echo
echo
"Start Warden server by /etc/init.d/wardend start"
echo
echo
echo
"Installation of
$package_version
package was SUCCESSFUL!!!"
echo
"Installation of
$package_version
package was SUCCESSFUL!!!"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment