11 |
|
install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos |
12 |
|
mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d |
13 |
|
|
14 |
+ |
### BASH code |
15 |
+ |
|
16 |
|
cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh |
17 |
|
export PATH=%instroot/bin:$PATH |
18 |
|
export LD_LIBRARY_PATH=%instroot/lib:$LD_LIBRARY_PATH |
23 |
|
# There is no other way around this. |
24 |
|
case $SCRAM_ARCH in |
25 |
|
slc3_ia32) compilerv=gcc323;; |
26 |
< |
slc3_amd64) compilerv=gcc345;; |
26 |
> |
slc3_amd64) compilerv=gcc344;; |
27 |
> |
slc4_ia32) compilerv=gcc345;; |
28 |
> |
slc4_amd64) compilerv=gcc345;; |
29 |
|
osx104_ia32) compilerv=gcc400;; |
30 |
|
osx104_pcc32) compilerv=gcc400;; |
31 |
|
esac |
32 |
|
SCRAM_ARCH=${SCRAM_ARCH}_$compilerv |
33 |
+ |
|
34 |
+ |
if [ $# -gt 0 ] |
35 |
+ |
then |
36 |
+ |
SCRAM_ARCH=$1 |
37 |
+ |
fi |
38 |
+ |
|
39 |
|
export SCRAM_ARCH |
40 |
|
|
41 |
< |
here=`dirname $0` |
42 |
< |
for pkg in `ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'` |
41 |
> |
here=%{instroot} |
42 |
> |
|
43 |
> |
if [ "$VO_CMS_SW_DIR" != "" ] |
44 |
> |
then |
45 |
> |
here=$VO_CMS_SW_DIR |
46 |
> |
else |
47 |
> |
if [ "$OSG_APP" != "" ] |
48 |
> |
then |
49 |
> |
here=$OSG_APP/cmssoft/cms |
50 |
> |
fi |
51 |
> |
fi |
52 |
> |
|
53 |
> |
if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ] |
54 |
> |
then |
55 |
> |
echo "Your shell is not able to find where cmsset_default.sh is. Either cd into the directory where it is or move to zsh" |
56 |
> |
exit 1 |
57 |
> |
fi |
58 |
> |
|
59 |
> |
for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'` |
60 |
|
do |
61 |
|
source $here/${SCRAM_ARCH}/etc/profile.d/$pkg |
62 |
|
done |
63 |
< |
|
63 |
> |
export CMS_PATH=$here |
64 |
|
EOF_CMSSET_DEFAULT_SH |
65 |
|
|
66 |
+ |
|
67 |
+ |
### CSH code |
68 |
+ |
|
69 |
|
cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh |
70 |
|
|
71 |
|
if (${?PATH}) then |
94 |
|
setenv compilerv gcc323 |
95 |
|
breaksw |
96 |
|
case slc3_amd64: |
97 |
+ |
setenv compilerv gcc344 |
98 |
+ |
breaksw |
99 |
+ |
case slc4_ia32: |
100 |
+ |
setenv compilerv gcc345 |
101 |
+ |
breaksw |
102 |
+ |
case slc4_amd64: |
103 |
|
setenv compilerv gcc345 |
104 |
|
breaksw |
105 |
|
case osx104_ia32: |
111 |
|
endsw |
112 |
|
|
113 |
|
setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv} |
114 |
+ |
|
115 |
+ |
if ( $# > 0 ) then |
116 |
+ |
setenv SCRAM_ARCH $1 |
117 |
+ |
endif |
118 |
+ |
|
119 |
+ |
setenv here %instroot |
120 |
+ |
|
121 |
|
if ( ${?VO_CMS_SW_DIR} ) then |
122 |
|
setenv here $VO_CMS_SW_DIR |
123 |
|
else |
124 |
< |
setenv here . |
124 |
> |
# OSG |
125 |
> |
if ( ${?OSG_APP} ) then |
126 |
> |
setenv here $OSG_APP/cmssoft/cms |
127 |
> |
endif |
128 |
> |
# OSG |
129 |
|
endif |
130 |
|
|
131 |
|
if ( ! -e $here/cmsset_default.csh ) then |
132 |
|
echo "Please cd into the directory where cmsset_default.csh is." |
133 |
|
endif |
134 |
|
|
135 |
< |
foreach pkg ( `ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` ) |
135 |
> |
foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` ) |
136 |
|
source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg |
137 |
|
end |
138 |
< |
|
138 |
> |
setenv CMS_PATH $here |
139 |
|
EOF_CMSSET_DEFAULT_CSH |
140 |
|
|
141 |
+ |
%pre |
142 |
+ |
[ -f $RPM_INSTALL_PREFIX/cmsset_default.sh ] && cp $RPM_INSTALL_PREFIX/cmsset_default.sh $RPM_INSTALL_PREFIX/cmsset_default.sh.old`date +%Y%m%d` |
143 |
+ |
[ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ] && cp $RPM_INSTALL_PREFIX/cmsset_default.csh $RPM_INSTALL_PREFIX/cmsset_default.csh.old`date +%Y%m%d` |
144 |
+ |
[ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d` |
145 |
|
%post |
146 |
|
echo $RPM_INSTALL_PREFIX |
147 |
|
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh |