1 | #!/bin/bash |
---|
2 | |
---|
3 | ########### SVN repository information ################### |
---|
4 | # $Date: 2011-08-12 20:34:40 +0000 (Fri, 12 Aug 2011) $ |
---|
5 | # $Author: jemian $ |
---|
6 | # $Revision: 612 $ |
---|
7 | # $URL: epd_deployment/deployment.sh $ |
---|
8 | # $Id: deployment.sh 612 2011-08-12 20:34:40Z jemian $ |
---|
9 | ########### SVN repository information ################### |
---|
10 | |
---|
11 | # generic EPD installment/deployment procedure for /APSshare |
---|
12 | |
---|
13 | ################################################################################### |
---|
14 | # |
---|
15 | # parse the command line |
---|
16 | # |
---|
17 | |
---|
18 | [ $# -lt 3 ] && _cmd_usage |
---|
19 | [ $# -gt 4 ] && _cmd_usage |
---|
20 | |
---|
21 | _cmd_usage() { |
---|
22 | echo "" |
---|
23 | echo "usage: $0 EPD_OS_SPECIFIC_DISTRIBUTION EPICS_LIBCA EPD_ROOT_DIR [BITS]" |
---|
24 | echo " EPD_OS_SPECIFIC_DISTRIBUTION is the path and file of the EPD download file (a shell script)" |
---|
25 | echo " EPICS_LIBCA is the path and file of libca.so" |
---|
26 | echo " EPD_ROOT_DIR is the path in which this EPD will be deployed (installed)" |
---|
27 | echo " BITS is optional, if present, indicates that deployment is to be 32- or 64-bit (64-bit is default)" |
---|
28 | echo "" |
---|
29 | echo "for example:" |
---|
30 | echo " $0\\" |
---|
31 | echo " /APSshare/epd/downloads/epd-7.1-2-rh5-x86_64.sh \\" |
---|
32 | echo " /APSshare/epics/base-3.14.11/lib/linux-x86_64-el5/libca.so.3.14 \\" |
---|
33 | echo " /APSshare/epd \\" |
---|
34 | echo " 64" |
---|
35 | echo "This will deploy EPD 7.1-2 for a 64-bit RHEL6 system with EPICS 3.14.11" |
---|
36 | echo "" |
---|
37 | exit 1 |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | ################################################################################### |
---|
42 | # |
---|
43 | # establish basic definitions |
---|
44 | # |
---|
45 | |
---|
46 | TOOL=$0 |
---|
47 | EPD_OS_SPECIFIC_DISTRIBUTION=$1 |
---|
48 | EPICS_LIBCA=$2 |
---|
49 | EPD_ROOT_DIR=$3 |
---|
50 | BITS=$4 |
---|
51 | |
---|
52 | START_DIR=`/bin/pwd` |
---|
53 | |
---|
54 | |
---|
55 | # Example: EPD_OS_SPECIFIC_DISTRIBUTION=/APSshare/epd/downloads/epd-7.1-2-rh5-x86_64.sh |
---|
56 | # INSTALLER_SCRIPT=epd-7.1-2-rh5-x86_64.sh |
---|
57 | INSTALLER_SCRIPT=$(basename ${EPD_OS_SPECIFIC_DISTRIBUTION}) |
---|
58 | echo "INSTALLER_SCRIPT = ${INSTALLER_SCRIPT}" |
---|
59 | |
---|
60 | # cut off first 10 characters |
---|
61 | # TODO: could do better but this works for now |
---|
62 | # INSTALLER_SCRIPT__OS_PART=rh5-x86_64.sh |
---|
63 | INSTALLER_SCRIPT__OS_PART=`echo ${INSTALLER_SCRIPT} | colrm 1 10` |
---|
64 | echo "INSTALLER_SCRIPT__OS_PART = ${INSTALLER_SCRIPT__OS_PART}" |
---|
65 | |
---|
66 | # EPD_DEPLOYMENT_SUBDIR=rh5-x86_64 |
---|
67 | EPD_DEPLOYMENT_SUBDIR=${INSTALLER_SCRIPT__OS_PART%.*} |
---|
68 | echo "EPD_DEPLOYMENT_SUBDIR = ${EPD_DEPLOYMENT_SUBDIR}" |
---|
69 | |
---|
70 | EPD_DEPLOYMENT_DIR=${EPD_ROOT_DIR}/${EPD_DEPLOYMENT_SUBDIR} |
---|
71 | |
---|
72 | |
---|
73 | #OS_KERNEL_NAME=`uname -s` # Linux |
---|
74 | #PROCESSOR_TYPE=`uname -p` # x86_64 |
---|
75 | #KERNEL_RELEASE_NAME=`uname -r` # 2.6.32-131.2.1.el6.x86_64 (el6 is the important part here) |
---|
76 | # |
---|
77 | #case ${OS_KERNEL_NAME} in |
---|
78 | # Linux) |
---|
79 | # echo "This is Linux, release ${KERNEL_RELEASE_NAME}" |
---|
80 | # ;; |
---|
81 | # SunOS) |
---|
82 | # echo "This is Solaris, release ${KERNEL_RELEASE_NAME}" |
---|
83 | # ;; |
---|
84 | #esac |
---|
85 | |
---|
86 | |
---|
87 | ################################################################################### |
---|
88 | # |
---|
89 | # post/update the README file |
---|
90 | # |
---|
91 | # TODO: short-term need |
---|
92 | [ -f ${EPD_ROOT_DIR}/00_README.txt ] && /bin/rm ${EPD_ROOT_DIR}/00_README.txt |
---|
93 | # |
---|
94 | if [ ./README.txt -nt ${EPD_ROOT_DIR}/README.txt ]; then |
---|
95 | echo "updating README file" |
---|
96 | /bin/cp ./README.txt ${EPD_ROOT_DIR}/README.txt |
---|
97 | fi |
---|
98 | |
---|
99 | |
---|
100 | ################################################################################### |
---|
101 | # |
---|
102 | # install EPD |
---|
103 | # |
---|
104 | |
---|
105 | /bin/sh ${EPD_OS_SPECIFIC_DISTRIBUTION} -b -p ${EPD_DEPLOYMENT_DIR} |
---|
106 | cd ${EPD_DEPLOYMENT_DIR}/bin |
---|
107 | |
---|
108 | ################################################################################### |
---|
109 | # |
---|
110 | # copy the EPICS_LIB_FILE into the Python libraries |
---|
111 | # Is this a better way to provide libca.so and avoid setting LD_LIBRARY_PATH? |
---|
112 | # No, still need to set LD_LIBRARY_PATH or PATH. But that is easier. |
---|
113 | # Also, copying the library to Python associates this file directly. |
---|
114 | # Could also modify search list in PyEPICS epics.ca.find_libca() |
---|
115 | # to add <python>/lib at end of list. Not done yet. This would |
---|
116 | # allow a python session to fallback to known library. |
---|
117 | # |
---|
118 | |
---|
119 | cd ${EPD_DEPLOYMENT_DIR}/lib |
---|
120 | echo "# Copying EPICS libca.so support library for PyEpics" |
---|
121 | /bin/cp ${EPICS_LIBCA} ./ |
---|
122 | EPICS_LIB_FILE=$(basename ${EPICS_LIBCA}) |
---|
123 | if [ "${EPICS_LIB_FILE}" = "libca.so" ]; then |
---|
124 | echo "No need to make libca soft link" |
---|
125 | else |
---|
126 | echo "# making soft link to libca.so" |
---|
127 | [ -f ./libca.so ] && /bin/rm ./libca.so |
---|
128 | /bin/ln -s ./${EPICS_LIB_FILE} ./libca.so |
---|
129 | fi |
---|
130 | PATH=${EPD_DEPLOYMENT_DIR}/lib:${PATH} |
---|
131 | |
---|
132 | |
---|
133 | ################################################################################### |
---|
134 | # Since the release of EPD 7.0-2 a bug has been found in distribute, |
---|
135 | # which causes Cython extensions not to be compiled. We advise to |
---|
136 | # update to the latest distribute version (after the EPD installation) using: |
---|
137 | # $ enpkg distribute |
---|
138 | #cd ${EPD_DEPLOYMENT_DIR}/bin |
---|
139 | #./easy_install distribute |
---|
140 | #./enpkg distribute |
---|
141 | |
---|
142 | ################################################################################### |
---|
143 | # WhooshDoc is an Enthought utility to search for information in modules. |
---|
144 | # With more than 10^4 modules in EPD, the Python "help> modules" functionality runs |
---|
145 | # out of resources due to scale. Downside of WhooshDoc is it only works on the |
---|
146 | # EPD index of modules (EPDIndex), not including those added locally by easy_install. |
---|
147 | # |
---|
148 | # wdoc ui & |
---|
149 | # |
---|
150 | cd ${EPD_DEPLOYMENT_DIR}/bin |
---|
151 | ./enpkg whooshdoc |
---|
152 | |
---|
153 | ################################################################################### |
---|
154 | # |
---|
155 | # install additional packages |
---|
156 | # |
---|
157 | |
---|
158 | cd ${START_DIR} |
---|
159 | ./add-ons.sh ${EPD_DEPLOYMENT_DIR} |
---|