1 |
valya |
1.1 |
### RPM cms webtools-base 0.1.1
|
2 |
|
|
## INITENV +PATH PYTHONPATH %i/lib/python`echo $PYTHON_VERSION | cut -d. -f 1,2`/site-packages
|
3 |
|
|
%define moduleName WEBTOOLS
|
4 |
|
|
%define exportName WEBTOOLS
|
5 |
|
|
%define cvstag V01-03-18
|
6 |
|
|
%define cvsserver cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e
|
7 |
|
|
Source: %cvsserver&strategy=checkout&module=%{moduleName}&nocache=true&export=%{exportName}&tag=-r%{cvstag}&output=/%{moduleName}.tar.gz
|
8 |
|
|
Requires: python cherrypy py2-cheetah yui webtools
|
9 |
|
|
Provides: perl(CGI)
|
10 |
|
|
Provides: perl(Crypt::CBC)
|
11 |
|
|
Provides: perl(SecurityModule)
|
12 |
|
|
Provides: perl(DBI)
|
13 |
|
|
%prep
|
14 |
|
|
%setup -n %{moduleName}
|
15 |
|
|
%build
|
16 |
|
|
|
17 |
|
|
rm -rf %i/etc/profile.d
|
18 |
|
|
mkdir -p %i/etc/profile.d
|
19 |
|
|
echo '#!/bin/sh' > %{i}/etc/profile.d/dependencies-setup.sh
|
20 |
|
|
echo '#!/bin/tcsh' > %{i}/etc/profile.d/dependencies-setup.csh
|
21 |
|
|
echo requiredtools `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
|
22 |
|
|
for tool in `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
|
23 |
|
|
do
|
24 |
|
|
case X$tool in
|
25 |
|
|
Xdistcc|Xccache )
|
26 |
|
|
;;
|
27 |
|
|
* )
|
28 |
|
|
toolcap=`echo $tool | tr a-z- A-Z_`
|
29 |
|
|
eval echo ". $`echo ${toolcap}_ROOT`/etc/profile.d/init.sh" >> %{i}/etc/profile.d/dependencies-setup.sh
|
30 |
|
|
eval echo "source $`echo ${toolcap}_ROOT`/etc/profile.d/init.csh" >> %{i}/etc/profile.d/dependencies-setup.csh
|
31 |
|
|
;;
|
32 |
|
|
esac
|
33 |
|
|
done
|
34 |
|
|
|
35 |
|
|
perl -p -i -e 's|\. /etc/profile\.d/init\.sh||' %{i}/etc/profile.d/dependencies-setup.sh
|
36 |
|
|
perl -p -i -e 's|source /etc/profile\.d/init\.csh||' %{i}/etc/profile.d/dependencies-setup.csh
|
37 |
|
|
|
38 |
|
|
%install
|
39 |
|
|
mkdir -p %i/etc
|
40 |
|
|
mkdir -p %i/bin
|
41 |
|
|
mkdir -p %i/lib/python`echo $PYTHON_VERSION | cut -d. -f1,2`/site-packages/Applications
|
42 |
|
|
cp -r Applications/base %i/lib/python`echo $PYTHON_VERSION | cut -d. -f1,2`/site-packages/Applications
|
43 |
|
|
cp cmsWeb %i/bin
|
44 |
valya |
1.2 |
|
45 |
|
|
|
46 |
valya |
1.3 |
cat << \EOF > %i/bin/base_init
|
47 |
valya |
1.2 |
#!/bin/bash
|
48 |
|
|
#
|
49 |
|
|
# dbs_discovery This script runs CMS DBS Data Discovery service
|
50 |
|
|
#
|
51 |
|
|
# chkconfig: 345 05 95
|
52 |
|
|
|
53 |
|
|
if [ -z ${WEBTOOLS_BASE_ROOT} ]; then
|
54 |
|
|
echo $"The WEBTOOLS_BASE_ROOT environment is not set"
|
55 |
|
|
exit 1
|
56 |
|
|
fi
|
57 |
|
|
|
58 |
|
|
RETVAL=$?
|
59 |
|
|
|
60 |
|
|
port=7999
|
61 |
|
|
pid=`ps auxw | grep WSServer | grep -v grep | awk '{print $2}'`
|
62 |
|
|
base=base
|
63 |
|
|
cmd = "cmsWeb --base-url=https://cmsweb.cern.ch/base --port $port --default-page /WSServer"
|
64 |
|
|
|
65 |
|
|
case "$1" in
|
66 |
|
|
restart)
|
67 |
|
|
echo $"Checking for existing WSServer..."
|
68 |
|
|
if [ ! -z ${pid} ]; then
|
69 |
|
|
kill -9 ${pid}
|
70 |
|
|
fi
|
71 |
|
|
echo $"Restart WSServer..."
|
72 |
|
|
nohup ${cmd} 2>&1 1>& /dev/null < /dev/null &
|
73 |
|
|
;;
|
74 |
|
|
start)
|
75 |
|
|
if [ ! -z ${pid} ]; then
|
76 |
|
|
kill -9 ${pid}
|
77 |
|
|
fi
|
78 |
|
|
nohup ${cmd} 2>&1 1>& /dev/null < /dev/null &
|
79 |
|
|
;;
|
80 |
|
|
status)
|
81 |
|
|
if [ ! -z ${pid} ]; then
|
82 |
|
|
echo $"${base} is running, pid=${pid}"
|
83 |
|
|
exit 0
|
84 |
|
|
fi
|
85 |
|
|
echo $"${base} is stopped"
|
86 |
|
|
exit 3
|
87 |
|
|
;;
|
88 |
|
|
stop)
|
89 |
|
|
if [ ! -z ${pid} ]; then
|
90 |
|
|
kill -9 ${pid}
|
91 |
|
|
fi
|
92 |
|
|
;;
|
93 |
|
|
*)
|
94 |
|
|
echo $"Usage: $0 {start|stop|status|restart}"
|
95 |
|
|
exit 1
|
96 |
|
|
;;
|
97 |
|
|
esac
|
98 |
|
|
|
99 |
|
|
exit $RETVAL
|
100 |
|
|
|
101 |
|
|
EOF
|
102 |
|
|
|
103 |
valya |
1.1 |
%post
|
104 |
|
|
%{relocateConfig}etc/profile.d/dependencies-setup.sh
|
105 |
|
|
%{relocateConfig}etc/profile.d/dependencies-setup.csh
|
106 |
|
|
perl -p -i -e "s!\@RPM_INSTALL_PREFIX\@!$RPM_INSTALL_PREFIX/%pkgrel!" $RPM_INSTALL_PREFIX/%pkgrel/bin/cmsWeb
|
107 |
|
|
|