1 |
|
### RPM cms cms-env 1.0 |
2 |
|
Source: cmsos |
3 |
– |
Requires: SCRAM SCRAMV1 |
3 |
|
%prep |
4 |
|
%build |
5 |
|
echo $SCRAM_ROOT |
9 |
|
|
10 |
|
mkdir -p %instroot/bin |
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 |
30 |
|
SCRAM_ARCH=${SCRAM_ARCH}_$compilerv |
31 |
|
export SCRAM_ARCH |
32 |
|
|
33 |
< |
source %instroot/$SCRAM_ARCH/lcg/SCRAM/V0_20_0/etc/profile.d/init.sh |
34 |
< |
source %instroot/$SCRAM_ARCH/lcg/SCRAMV1/V1_0_2/etc/profile.d/init.sh |
33 |
> |
if [ "$VO_CMS_SW_DIR" != "" ] then |
34 |
> |
here=$VO_CMS_SW_DIR |
35 |
> |
else |
36 |
> |
here=`dirname $0` |
37 |
> |
endif |
38 |
> |
|
39 |
> |
[ -d $here/${SCRAM_ARCH}/etc/profile.d ] || 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". |
40 |
> |
|
41 |
> |
for pkg in `ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'` |
42 |
> |
do |
43 |
> |
source $here/${SCRAM_ARCH}/etc/profile.d/$pkg |
44 |
> |
done |
45 |
> |
|
46 |
|
EOF_CMSSET_DEFAULT_SH |
47 |
|
|
48 |
+ |
|
49 |
+ |
### CSH code |
50 |
+ |
|
51 |
|
cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh |
52 |
+ |
|
53 |
|
if (${?PATH}) then |
54 |
|
setenv PATH %instroot/bin:$PATH |
55 |
|
else |
87 |
|
endsw |
88 |
|
|
89 |
|
setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv} |
90 |
+ |
if ( ${?VO_CMS_SW_DIR} ) then |
91 |
+ |
setenv here $VO_CMS_SW_DIR |
92 |
+ |
else |
93 |
+ |
setenv here . |
94 |
+ |
endif |
95 |
+ |
|
96 |
+ |
if ( ! -e $here/cmsset_default.csh ) then |
97 |
+ |
echo "Please cd into the directory where cmsset_default.csh is." |
98 |
+ |
endif |
99 |
+ |
|
100 |
+ |
foreach pkg ( `ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` ) |
101 |
+ |
source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg |
102 |
+ |
end |
103 |
|
|
73 |
– |
source %instroot/${SCRAM_ARCH}/lcg/SCRAM/V0_20_0/etc/profile.d/init.csh |
74 |
– |
source %instroot/${SCRAM_ARCH}/lcg/SCRAMV1/V1_0_2/etc/profile.d/init.csh |
104 |
|
EOF_CMSSET_DEFAULT_CSH |
105 |
|
|
106 |
+ |
%pre |
107 |
+ |
[ -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` |
108 |
+ |
[ -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` |
109 |
+ |
[ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d` |
110 |
|
%post |
111 |
|
echo $RPM_INSTALL_PREFIX |
112 |
|
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh |
117 |
|
%instroot/cmsset_default.sh |
118 |
|
%instroot/cmsset_default.csh |
119 |
|
%instroot/bin/cmsos |
120 |
+ |
%instroot/%cmsplatf/etc/profile.d |
121 |
+ |
%exclude %instroot/%cmsplatf/etc/profile.d/* |