-
Notifications
You must be signed in to change notification settings - Fork 0
/
iobserve-setup-planning.sh
executable file
·47 lines (33 loc) · 1.6 KB
/
iobserve-setup-planning.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
#!/bin/bash
# execute setup
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
if [ -f $BASE_DIR/config ] ; then
. $BASE_DIR/config
else
echo "Missing configuration"
exit 1
fi
. $BASE_DIR/common-functions.sh
# check executables
checkExecutable "iObserve Planning" "$PLANNING_EXECUTABLE"
# check for directories
checkDirectory "iObserve configuration directory" $IOBSERVE_DIR
checkDirectory "Scenario directory" $SCENARIO_DIR
checkDirectory "Concrete scenario directory" $SCENARIO_DIR/$SCENARIO
checkDirectory "Runtime model directory" $SCENARIO_DIR/$SCENARIO/runtimemodel
checkDirectory "Redeployment model directory" $SCENARIO_DIR/$SCENARIO/redeploymentmodel
checkDirectory "Planning working directory" $WORKING_DIR_PLANNING
echo "Setting up iObserve planning workspace..."
# clear working directories
rm -rf $WORKING_DIR_PLANNING/*
# copy models to working directory of planning
cp -R $SCENARIO_DIR/$SCENARIO/runtimemodel $WORKING_DIR_PLANNING
cp -R $SCENARIO_DIR/$SCENARIO/redeploymentmodel $WORKING_DIR_PLANNING
# copy iobserve planning configuration file to working dir and replace paths in iobserve configuration file
cat $IOBSERVE_DIR/planning.config | sed "s#%WORKING_DIRECTORY_PLANNING%#$WORKING_DIR_PLANNING#g" > $WORKING_DIR_PLANNING/planning.config
# replace PlanningMain by PlanningMainMockup in execution script to exclude model optimization with PerOpteryx from planning
TEMP="${PLANNING_EXECUTABLE}2" # (workaround because sed -i did not work in the test environment)
cat $PLANNING_EXECUTABLE | sed "s#PlanningMain #PlanningMainMockup #g" > $TEMP
mv $TEMP $PLANNING_EXECUTABLE
chmod 700 $PLANNING_EXECUTABLE
echo "Done."