|
1 | 1 | #!/bin/bash |
2 | 2 |
|
| 3 | +# Exit the script if an error occur |
| 4 | +set -e |
| 5 | + |
3 | 6 | # Get Ice in a ready-to-run state on a fresh AWI instance. |
4 | 7 |
|
5 | | -GRAILS_VERSION=2.2.1 |
| 8 | +GRAILS_VERSION=2.4.4 |
6 | 9 |
|
7 | 10 | # Install prerequisites |
8 | | - |
9 | 11 | if [ -f /etc/redhat-release ]; then |
10 | 12 | echo "Installing redhat packages" |
11 | | - sudo yum -y install git java-1.6.0-openjdk-devel.x86_64 wget unzip |
12 | | -else |
13 | | - [ -f /etc/debian-release ]; |
| 13 | + sudo yum -y install git java-1.7.0-openjdk-devel.x86_64 wget unzip |
| 14 | + |
| 15 | +elif [[ -f /etc/debian-release || -f /etc/debian_version ]];then |
14 | 16 | echo "Installing debian packages" |
15 | | - sudo apt-get -y install git openjdk-6-jdk wget unzip |
| 17 | + sudo apt-get -y install git openjdk-7-jdk wget unzip |
| 18 | + |
| 19 | +elif [[ -f /etc/issue && $(grep "Amazon Linux AMI" /etc/issue) ]]; then |
| 20 | + echo "Assuming AWS AMI, installing packages" |
| 21 | + sudo yum -y install git java-1.7.0-openjdk-devel.x86_64 wget unzip |
| 22 | + |
| 23 | +else |
| 24 | + echo "Unknown operating system. You may have to install Java 7 manually." |
16 | 25 | fi |
17 | 26 |
|
18 | 27 | INSTALL_DIR=$(pwd) |
|
53 | 62 | grails ${JAVA_OPTS} wrapper |
54 | 63 |
|
55 | 64 | # (Bug: Ice can't deal with this file existing and being empty.) |
56 | | -rm grails-app/i18n/messages.properties |
| 65 | +rm -f grails-app/i18n/messages.properties |
57 | 66 |
|
58 | 67 | # Create our local work directories (both for processing and reading) |
59 | | -mkdir ${HOME_DIR}/ice_processor |
60 | | -mkdir ${HOME_DIR}/ice_reader |
| 68 | +mkdir -p ${HOME_DIR}/ice_processor |
| 69 | +mkdir -p ${HOME_DIR}/ice_reader |
61 | 70 |
|
62 | 71 | # Set up the config file |
63 | 72 | cp src/java/sample.properties src/java/ice.properties |
|
74 | 83 | echo -n "-> " |
75 | 84 | read -r PROCBUCKET |
76 | 85 | done |
77 | | -sed -rie 's/=billing_s3bucketprefix\//=/; s|\/mnt\/|'"${HOME_DIR}"'\/|; s/=work_s3bucketprefix\//=/; s/^ice.account.*//; s/=billing_s3bucketname1/='${BILLBUCKET}'/; s/=work_s3bucketname/='${PROCBUCKET}'/' src/java/ice.properties |
| 86 | +sed -ri 's/=billing_s3bucketprefix\//=/; s|\/mnt\/|'"${HOME_DIR}"'\/|; s/=work_s3bucketprefix\//=/; s/^ice.account.*//; s/=billing_s3bucketname1/='${BILLBUCKET}'/; s/=work_s3bucketname/='${PROCBUCKET}'/' src/java/ice.properties |
78 | 87 |
|
79 | 88 | echo Ice is now ready to run as a processor. If you want to run the reader, edit: |
80 | | -echo ~/ice/src/java/ice.properties |
| 89 | +echo "${INSTALL_DIR}/src/java/ice.properties" |
81 | 90 | echo and alter the appropriate flags. You can now start Ice by running the following from the Ice root directory: |
82 | 91 | echo ./grailsw -Djava.net.preferIPv4Stack=true -Dice.s3AccessKeyId=\<access key ID\> -Dice.s3SecretKey=\<access key\> run-app |
0 commit comments