-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·48 lines (45 loc) · 1.51 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#
# install - install mariacmdb
#
function runCommand
{
cmd="$@"
echo "Running command: $cmd"
eval $cmd
rc=$?
if [ "$rc" != 0 ]; then
echo "ERROR: command $cmd returned $rc"
exit 1
fi
} # runCommand()
function checkRepoDir
{
if [ ! -d $mariacmdbDir ]; then
echo "ERROR: directory $mariacmdbDir not found"
exit 1
fi
} # checkRepoDir()
function checkCGIdir
{
if [ ! -d $CGIdir ]; then
runCommand sudo mkdir -p /srv/www/mariacmdb
fi
} # checkDir()
# main()
mariacmdbDir="$HOME/mariacmdb" # must be cloned to home directory
CGIdir="/srv/www/mariacmdb" # must exist
checkRepoDir # check the repo is in the home directory
checkCGIdir # check for /srv/www/mariacmdb
echo "Copying scripts to /usr/local/sbin ..."
runCommand sudo cp $mariacmdbDir/usr/local/sbin/mariacmdb /usr/local/sbin
runCommand sudo cp $mariacmdbDir/usr/local/sbin/vif /usr/local/sbin
runCommand sudo cp $mariacmdbDir/usr/local/sbin/testvif /usr/local/sbin
runCommand sudo cp $mariacmdbDir/usr/local/sbin/testrestapi /usr/local/sbin
echo
echo "Copying thin client script to home directory ..."
runCommand sudo cp $mariacmdbDir/usr/local/sbin/serverinfo $HOME
echo
echo "Copying cgi files to /srv/www/mariacmdb ..."
runCommand sudo cp $mariacmdbDir/srv/www/mariacmdb/* /srv/www/mariacmdb
echo