use python2 explicitly for f31
[plcrt.git] / plcrt.spec
1 #
2 # $Id$
3
4
5 %define url $URL: svn+ssh://svn.planet-lab.org/svn/PLCRT/trunk/plcrt.spec $
6
7 %define name plcrt
8 %define version 1.0
9 %define taglevel 11
10
11 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
12
13 Name: %{name}
14 Version: %{version}
15 Release: %{release}
16 Source0: %{name}-%{version}.tar.bz2
17 License: GPL
18 Group: Applications/System
19 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
20
21 Vendor: PlanetLab
22 Packager: PlanetLab Central <support@planet-lab.org>
23 Distribution: PlanetLab %{plrelease}
24 URL: %(echo %{url} | cut -d ' ' -f 2)
25
26 Summary: PLCRT account initialization for the root image.
27 Group: Applications/System
28 Requires: python
29 Requires: perl
30 Requires: rt3
31 Requires: rt3-mailgate
32 Requires: myplc
33
34 %description
35 PLCRT is a collection of configuration scripts for configuring RT.
36 By default RT does not come with all the settings needed for a standard PLC,
37 or PlanetLab in particular.  
38
39 %prep
40 %setup -q
41
42 %install
43
44 function install_file()
45 {
46     mod=$1
47     dest=$2
48     file=$3
49     if [ -z "$file" ] ; then 
50         file=$( basename $dest )
51     fi
52     if [ -f $file ] ; then
53         install -D -m $mod $file $dest
54     fi
55 }
56 function chmod_pattern()
57 {
58     mod=$1
59     pattern=$2
60     for file in $pattern ; do 
61         if [ -f $file ] ; then
62             chmod $mod $file
63         fi
64     done
65 }
66
67 install -d $RPM_BUILD_ROOT/%{_datadir}/%{name}
68 install_file 755 $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/plcrt plcrt.init
69
70 echo " * Installing core scripts"
71 rsync -a ./ $RPM_BUILD_ROOT/%{_datadir}/%{name}/
72
73 install_file 644 $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/rt.cron
74 install_file 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/getpersons.py
75 install_file 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/adduserstort.pl
76
77 echo " * Installing cron scripts"
78 chmod_pattern 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/cron.d/*.py 
79 chmod_pattern 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/cron.d/*.sh
80
81
82 %clean
83 rm -rf $RPM_BUILD_ROOT
84
85 %files 
86 %defattr(-,root,root)
87 #%config /etc/plcrt.conf
88 %{_datadir}/%{name}
89 %{_sysconfdir}/plc.d/plcrt
90 %{_sysconfdir}/cron.d/rt.cron
91
92 %post
93 if grep 'pam_loginuid.so' /etc/pam.d/crond ; then
94     sed -i -e 's/^session    required   pam_loginuid.so/#session    required   pam_loginuid.so/g' /etc/pam.d/crond
95 fi
96
97 if ! grep '<category id="plc_rt">' /etc/planetlab/default_config.xml ; then 
98     sed -i 's|<category id="plc_net">| <category id="plc_rt">\n <name>RT Configuration</name>\n <description>RT</description>\n <variablelist>\n <variable id="enabled" type="boolean">\n <name>Enabled</name>\n <value>false</value>\n <description>Enable on this machine.</description>\n </variable>\n <variable id="host" type="hostname">\n <name>Hostname</name>\n <value>localhost.localdomain</value>\n <description>The fully qualified hostname.</description>\n </variable>\n <variable id="ip" type="ip">\n <name>IP Address</name>\n <value/>\n <description>The IP address of the RT server.</description>\n </variable>\n <variable id="web_user" type="string">\n <name>username</name>\n <value>root</value>\n <description>The user name for RT access.</description>\n </variable>\n <variable id="web_password" type="password">\n <name>password</name>\n <value>password</value>\n <description>password to the rt user.</description>\n </variable>\n <variable id="cc_address" type="email">\n <name>email list</name>\n <value>root+list@localhost.localdomain</value>\n <description></description>\n </variable>\n <variable id="dbpassword" type="password">\n <name>Database Password</name>\n <value></value>\n <description>Password to use when accessing the RT database.</description>\n </variable>\n </variablelist>\n </category>\n <category id="plc_net">|' /etc/planetlab/default_config.xml
99 fi
100
101 mkdir -p /etc/planetlab/configs
102 plc-config --category plc_rt --variable cc_address \
103     --value 'root+list@localhost.localdomain'\
104     --save /etc/planetlab/default_config.xml /etc/planetlab/default_config.xml
105
106 plc-config --category plc_rt --variable enabled --value true \
107     --save /etc/planetlab/configs/site.xml /etc/planetlab/default_config.xml
108
109 # NOTE: setup default values until myplc includes them by default.
110 plc-config --category plc_rt --variable host --value localhost.localdomain \
111     --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
112 plc-config --category plc_rt --variable ip --value "" \
113     --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
114 plc-config --category plc_rt --variable web_user --value root \
115     --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
116 plc-config --category plc_rt --variable web_password --value password \
117     --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
118 plc-config --category plc_rt --variable dbpassword --value "" \
119     --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
120
121 # NOTE: not sure why these aren't setup by the rt package...
122 mkdir -p /var/log/rt3
123 touch /var/log/rt3/rt.log
124 chown apache.apache /var/log/rt3/rt.log
125
126 cp /usr/share/rt3/html/NoAuth/images/bplogo.gif /var/www/html/misc/logo.gif
127
128 %changelog
129 * Tue Nov 03 2009 Marc Fiuczynski <mef@cs.princeton.edu> - PLCRT-1.0-11
130 - Make sure to do updates to sendmail files, rather than appeneding same
131 - hostname values to the end of files.
132
133 * Mon Sep 21 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-10
134 - add reverse-lookup on given host IP addr to add any extra hostnames this
135 - server may be aliasing as.
136
137 * Mon Sep 21 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-9
138 - be more selective about which files to chmod
139
140 * Mon Sep 21 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-8
141 - shorter polling period for faster sync
142 - remove attempt to install removed file
143
144 * Sun Sep 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-7
145 - replace callplcsh with simpler scripts for syncing users
146
147 * Sat Sep 19 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-6
148 - some plcs don't return site_ids so getpersons should not depend on this field
149 - make scripts exec on install
150 - use RT_HOST name rather than localhost for RT mailgate configuration
151
152 * Wed Jul 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-5
153 - add mailing list watchers to default queues
154 - add script to addwatchers to default queues
155 - improved templates in plcrt.init
156
157 * Mon Jul 06 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-4
158 - rt db password
159 - template conf.d/* files rather than one-shot re-write
160 - better %post in spec file for logo and default xml settings.
161
162 * Sat Jul 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-3
163 - renamed getpersons.py to accept a given 'role'
164 - changed syncadmins.sh to use callplcsh.py
165 - added callplcsh.py to allow either a local or remote plc using plcsh
166
167 * Tue Jun 30 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-2
168 - improved init setup
169 - added plcsh version of getadmins script to add users to RT's db.
170 - improved %post code for installation
171
172 * Fri Jun 26 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-1
173 - trying to get the tag to work for new package.
174
175 * Thu Jun 26 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-1
176 - initial addition.