-
Notifications
You must be signed in to change notification settings - Fork 25
/
update_heurist.sh
executable file
·128 lines (103 loc) · 4.8 KB
/
update_heurist.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#! /bin/sh
# update_heurist.sh: update script for Heurist, creates new copy
# @package Heurist academic knowledge management system
# @link http://HeuristNetwork.org
# @copyright (C) 2005-2022 University of Sydney
# @author Ian Johnson <[email protected]>
# @license http://www.gnu.org/licenses/gpl-3.0.txt GNU License 3.0
# @version 6
# Licensed under the GNU License, Version 3.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at http://www.gnu.org/licenses/gpl-3.0.txt
# Unless required by applicable law or agreed to in writing, software distributed under the License is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
# See the License for the specific language governing permissions and limitations under the License.
# installation source: Heurist reference server
ref_server=https://HeuristRef.Net
base_dir="/var/www/html"
# -------------PRELIMINARIES ---------------------------------------------------------------------------------------------
# Checking parameters and availability ...
if [ -z $1 ]
then
echo "Usage: ./update_heurist.sh hx.x.x sudo"
echo "Please supply version eg. hx.x.x. (this MUST exist as a tar.bz2 file "
echo "on $ref_server/HEURIST/DISTRIBUTION or script will not download the Heurist code package)"
exit
fi
# Test download package is valid before we get half way and can't find it ... s=silent
if ! curl -fs --range 0-100 $ref_server/HEURIST/DISTRIBUTION/$1.tar.bz2 > /dev/null; then
echo "The version parameter you supplied does not point to a Heurist installation package"
echo "Please check for the latest version at HeuristNetwork.org/installation"
echo "The parameter should be eg. h6.2.1 as given - DO NOT include the url path or .tar.bz2"
echo "Supply 'sudo' as the second argument eg. "
echo
echo " ./update_heurist.sh h6.2.1 sudo"
exit
fi
echo
echo
echo "----------------------- Installing Update to Heurist ---------------------------"
echo
echo
cd "${base_dir}/HEURIST"
$2 mkdir -p temp_install_unzip
$2 chmod a+rwx temp_install_unzip
cd temp_install_unzip
echo "Fetching Heurist code from $ref_server/HEURIST/DISTRIBUTION/$1.tar.bz2"
echo
$2 rm -f $1.tar.bz2
$2 curl -O# $ref_server/HEURIST/DISTRIBUTION/$1.tar.bz2
# -j is bzip2 format
$2 tar -xjf $1.tar.bz2
$2 rm -f $1.tar.bz2
# remove existing directory if present then make directory and copy over Heurist
$2 rm -Rf "${base_dir}/HEURIST/$1"
$2 mkdir "${base_dir}/HEURIST/$1"
$2 cp -R $1/* "${base_dir}/HEURIST/$1"
echo
echo Obtaining updated support files - external and help files
echo
# Ensure correct ownership and mode of HEURIST_SUPPORT (added 19/7/22)
# Worst case this won't set group if heurist group does not exist
$2 chown -R apache "${base_dir}/HEURIST/HEURIST_SUPPORT"
$2 chgrp -R heurist "${base_dir}/HEURIST/HEURIST_SUPPORT"
$2 chmod -R ug+rwx "${base_dir}/HEURIST/HEURIST_SUPPORT"
# Update support files
cd "${base_dir}/HEURIST/HEURIST_SUPPORT"
$2 rm -f external_h5.tar.bz2
$2 curl -O# $ref_server/HEURIST/DISTRIBUTION/HEURIST_SUPPORT/external_h5.tar.bz2
$2 tar -xjf external_h5.tar.bz2
$2 rm -f external_h5.tar.bz2
$2 rm -f vendor.tar.bz2
$2 curl -O# $ref_server/HEURIST/DISTRIBUTION/HEURIST_SUPPORT/vendor.tar.bz2
$2 tar -xjf vendor.tar.bz2
$2 rm -f vendor.tar.bz2
$2 rm -f help.tar.bz2
$2 curl -O# $ref_server/HEURIST/DISTRIBUTION/HEURIST_SUPPORT/help.tar.bz2
$2 tar -xjf help.tar.bz2
$2 rm -f help.tar.bz2
# Ensure correct ownership of instance just installed (added 19/7/22)
# Worst case this won't set group if heurist group does not exist
$2 chown -R apache "${base_dir}/HEURIST/$1"
$2 chgrp -R heurist "${base_dir}/HEURIST/$1"
$2 chmod -R ug+rwx "${base_dir}/HEURIST/$1"
# Place simlinks in instance directory
cd "${base_dir}/HEURIST/$1"
$2 ln -s ../HEURIST_SUPPORT/external_h5 external
$2 ln -s ../HEURIST_SUPPORT/vendor vendor
$2 ln -s ../HEURIST_SUPPORT/help help
echo "Heurist unpacked"
# This installation of elastic search generated a number of security holes rated HIGH RISK
# We are therefore removing it pending investigation. Sept 2014
# $2 mkdir "${base_dir}/HEURIST/HEURIST_SUPPORT/external/elasticsearch"
# cd "${base_dir}/HEURIST/HEURIST_SUPPORT/external/elasticsearch"
# $2 curl -O# $ref_server/HEURIST/DISTRIBUTION/HEURIST_SUPPORT/external/elasticsearch/elasticsearch-1.3.2.tar.gz
# $2 tar -zxvf elasticsearch-1.3.2.tar.gz
# cd "${base_dir}/HEURIST/HEURIST_SUPPORT/external/elasticsearch/elasticsearch-1.3.2"
# ./bin/elasticsearch -d
# Remove temporary unzip directory used during installation
$2 rm -rf "${base_dir}/HEURIST/temp_install_unzip/"
echo ""
echo ""
echo "---- Heurist update installed in ${base_dir}/HEURIST/$1 -------------------------------------------"
echo
echo