-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
226 lines (184 loc) · 5.1 KB
/
install.sh
File metadata and controls
226 lines (184 loc) · 5.1 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#!/bin/bash
#
################################################
#
# PDDL Merge and Translator - Install the PyReform system
#
# Author: Dr. Patricia Riddle @ 2013
# Contact: pat@cs.auckland.ac.nz
# Version: 2.0
#
# Translates PDDL files using an automated planner in order to improve performance
#
# Installs the PyReform system
#
# -------
#
# Copyright (C) 2013 Dr. Patricia Riddle, University of Auckland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################
PYREFORM_REPOSITORY="https://pyreform.googlecode.com/svn/trunk"
export PYREFORM_REPOSITORY
ANS="N"
read -p "This script will install the PyReform system. Do you wish to continue? [y/N] " ANS
if [ "$ANS" != "y" ]
then
exit
fi
INSTALL_TYPE=$1
if [ "$INSTALL_TYPE" == "" ]
then
#read -p "What type of install is this [local/server] " INSTALL_TYPE
INSTALL_TYPE="local"
fi
if [ "$INSTALL_TYPE" == "local" ]
then
if [ -d "opt" ]
then
echo "opt subdirectory already exists. Please delete this directory and start again!"
exit
fi
mkdir "opt"
BASE_DIR=`pwd`
PYREFORM_HOME=$BASE_DIR"/opt/pddl"
PLANNER_HOME=$BASE_DIR"/opt/planner"
elif [ "$INSTALL_TYPE" == "server" ]
then
PYREFORM_HOME="/opt/pddl"
PLANNER_HOME="/opt/planner"
fi
echo
echo "Gathering key directory paths..."
echo
read -p "Enter PyReform home directory [$PYREFORM_HOME]: " ANS
if [ "$ANS" != "" ]
then
PYREFORM_HOME=$ANS
fi
read -p "Enter planner home directory [$PLANNER_HOME]: " ANS
if [ "$ANS" != "" ]
then
PLANNER_HOME=$ANS
fi
export PYREFORM_HOME
export PLANNER_HOME
echo "Setting up key directories..."
echo
# If PYREFORM_HOME exists but is not a directory then exit
if [ -f $PYREFORM_HOME ]
then
echo "Your PyReform home path is not a directory! Exiting now..."
exit
fi
# If PYREFORM_HOME does not exist as a directory then create it
if [ ! -d $PYREFORM_HOME ]
then
mkdir $PYREFORM_HOME
echo "$PYREFORM_HOME..."
fi
# If PYREFORM_HOME/bin does not exist then create it but exit if it does exist
if [ ! -d "$PYREFORM_HOME/bin" ]
then
mkdir "$PYREFORM_HOME/bin"
echo "$PYREFORM_HOME/bin..."
else
echo "Your PyReform home path is not empty! Exiting now..."
exit
fi
# Install the system license
echo
echo "Installing the license file..."
echo
wget --no-check-certificate $PYREFORM_REPOSITORY/LICENSE.txt
cp LICENSE.txt $PYREFORM_HOME
# Start installing PyReform itself
echo "Installing the core PyReform modules..."
echo
# Determine how to install the core PyReform modules
ANS="local"
if [ "$INSTALL_TYPE" == "server" ]
then
read -p "install locally or as Python modules? [local/python] " ANS
fi
BASE_INSTALL_TYPE=$ANS
export BASE_INSTALL_TYPE
# install the core PyReform modules according to type
if [ "$BASE_INSTALL_TYPE" == "local" ]
then
svn export $PYREFORM_REPOSITORY/pyreform
mkdir $PYREFORM_HOME/bin/pyreform
cd pyreform
cp *.py $PYREFORM_HOME/bin/pyreform
cd ..
else
easy_install "$PYREFORM_REPOSITORY#egg=pyreform"
fi
echo
echo "Installing the PyReform scripts..."
echo
# install the main PyReform scripts
svn export $PYREFORM_REPOSITORY/bin
cd bin
cp *.* $PYREFORM_HOME/bin
cd ..
chmod a+rx $PYREFORM_HOME/bin/*.sh
echo "Updating the PyReform configuration..."
echo
echo "APP_HOME = '$PYREFORM_HOME'" > $PYREFORM_HOME/bin/config.py
echo "PLANNER_HOME = '$PLANNER_HOME'" >> $PYREFORM_HOME/bin/config.py
echo "Installing the default planner..."
echo
if [ -f $PLANNER_HOME ]
then
echo "$PLANNER_HOME is not a directory. Exiting now..."
exit
fi
# If the PLANNER_HOME does not exist then create the directory and install the planner
if [ ! -d $PLANNER_HOME ]
then
mkdir $PLANNER_HOME
# install the planner files
wget --no-check-certificate $PYREFORM_REPOSITORY/planners/fastdownward/fastdownward-latest.tgz
CURDIR=`pwd`
cd $PLANNER_HOME
tar xzvf $CURDIR/fastdownward-latest.tgz
# build the planner programs
cd src
./build_all
cd $CURDIR
# install the planner script
wget --no-check-certificate $PYREFORM_REPOSITORY/planners/fastdownward/planner.sh
cp planner.sh $PYREFORM_HOME/bin
chmod a+rx $PYREFORM_HOME/bin/planner.sh
fi
# Check if the user wishes to install the tests and if so install them
INSTALL_TESTS="N"
read -p "Do you want to install the PDDL problem test files? [y/N] " INSTALL_TESTS
if [ "$INSTALL_TESTS" == "y" ]
then
echo "Installing the PDDL problem tests..."
echo
svn export $PYREFORM_REPOSITORY/tests
mkdir $PYREFORM_HOME/tests
cd tests
cp -r * $PYREFORM_HOME/tests
cp bin/*.sh $PYREFORM_HOME/bin
cp bin/*.py $PYREFORM_HOME/bin
cd ..
chmod a+rx $PYREFORM_HOME/bin/*.sh
chmod a+rx $PYREFORM_HOME/bin/*.py
fi
echo "Done!"