Revision: | 1.10 |
Committed: | Wed Oct 29 15:28:21 2008 UTC (16 years, 6 months ago) by valya |
Branch: | MAIN |
CVS Tags: | MotT0_1_0_2, MotT0_1_0_1, MotT0_1_0_0, MotT0_100531_1, MotT0_100528_1, T0Mon_100518_1, T0Mon_100503_1, T0Mon_100316_1, T0Mon_100308_2, T0Mon_100308_1, T0Mon_100216_1, T0Mon_100210_1, T0Mon_100204_4, T0Mon_100204_3, T0Mon_100204_1, T0Mon_100127_1, T0Mon_091111_1, T0Mon_090828_1, T0Mon_090822_1, T0Mon_090715_1, T0Mon_090612_1, T0Mon_090611_1, T0Mon_090610_1, T0Mon_090601_1, T0Mon_090527_2, T0Mon_090527_1, T0Mon_090522_1, T0Mon_090519_2, T0Mon_090519_1, T0Mon_090517_1, T0Mon_090516_1, T0Mon_090515_4, T0Mon_090515_3, T0Mon_090515_2, T0Mon_090515_1, T0Mon_090510_1, T0Mon_090406_1, T0Mon_090326_1, T0Mon_090325_1, T0Mon_090318_1, T0Mon_090315_1, T0Mon_090303_1, DBS-APPS_20081205, DBS-APPS_20081204, DBS-APPS_200811204, DBS-APPS_20081126_1, DBS-APPS_20081126, DBS-APPS_20081125, testofc, DBS-APPS_20081119, DBS-APPS_20081118, DBS-APPS_20081117, DBS-APPS_20081114_1, DBS-APPS_20081114, DBS-APPS_20081112, DBS-APPS_20081111_1, DBS-APPS_20081110_2, DBS-APPS_20081110_1, WEBTOOLS-APPS_20081110, DBS-APPS_20081110, WEBTOOLS-APPS_20081107_1, WEBTOOLS-APPS_20081107, DBS-APPS_20081107, T0Mon_081107_1, DBS-APPS_20081105, T0Mon_081105_1, DBS-APPS_20081104, WEBTOOLS-APPS_20081031_2, DBS-APPS_20081031_2, DBS-APPS_20081031_1, WEBTOOLS-APPS_20081031_1, WEBTOOLS-APPS_20081031 |
Changes since 1.9: | +2 -2 lines |
Log Message: | Fix init script |
# | Content |
---|---|
1 | ### RPM cms webtools-base 0.1.6 |
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-21 |
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 | |
45 | |
46 | cat << \EOF > %i/bin/base_init |
47 | #!/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 $port | grep -v grep | awk '{print $2}'` |
62 | base=base |
63 | if [ -n "$WEBTOOLS_BASEURL" ]; then |
64 | url="$WEBTOOLS_BASEURL/$base" |
65 | else |
66 | url="http://cmsweb.cern.ch/$base" |
67 | fi |
68 | cmd="cmsWeb --base-url=$url --port $port --default-page /WSServer/" |
69 | |
70 | case "$1" in |
71 | restart) |
72 | echo $"Checking for existing WSServer..." |
73 | if [ ! -z ${pid} ]; then |
74 | kill -9 ${pid} |
75 | fi |
76 | echo $"Restart WSServer..." |
77 | nohup ${cmd} 2>&1 1>& /dev/null < /dev/null & |
78 | ;; |
79 | start) |
80 | if [ ! -z ${pid} ]; then |
81 | kill -9 ${pid} |
82 | fi |
83 | nohup ${cmd} 2>&1 1>& /dev/null < /dev/null & |
84 | ;; |
85 | status) |
86 | if [ ! -z ${pid} ]; then |
87 | echo $"${base} is running, pid=${pid}" |
88 | exit 0 |
89 | fi |
90 | echo $"${base} is stopped" |
91 | exit 3 |
92 | ;; |
93 | stop) |
94 | if [ ! -z ${pid} ]; then |
95 | kill -9 ${pid} |
96 | fi |
97 | ;; |
98 | *) |
99 | echo $"Usage: $0 {start|stop|status|restart}" |
100 | exit 1 |
101 | ;; |
102 | esac |
103 | |
104 | exit $RETVAL |
105 | |
106 | EOF |
107 | chmod a+x %i/bin/base_init |
108 | |
109 | %post |
110 | %{relocateConfig}etc/profile.d/dependencies-setup.sh |
111 | %{relocateConfig}etc/profile.d/dependencies-setup.csh |
112 | perl -p -i -e "s!\@RPM_INSTALL_PREFIX\@!$RPM_INSTALL_PREFIX/%pkgrel!" $RPM_INSTALL_PREFIX/%pkgrel/bin/cmsWeb |
113 |