5 Summary: Collaborative Development Tool
11 Group: Development/Tools
13 Source0: http://gforge.org/download.php/37/gforge-3.0.tar.bz2
15 Source0: gforge-3.0.tar.gz
18 Patch1000: gforge-3.0-local_config.patch
19 Patch1001: gforge-3.0-php_path.patch
20 Patch1002: gforge-3.0-init_sql.patch
21 Patch1003: gforge-3.0-cronjobs.patch
23 Requires: /bin/sh /bin/bash /usr/bin/perl php-pgql postgresql-server
24 URL: http://www.gforge.org/
25 BuildRoot: /var/tmp/%{name}-%{version}-root
28 GForge is a web-based Collaborative Development Environment offering
29 easy access to CVS, mailing lists, bug tracking, message
30 boards/forums, task management, permanent file archival, and total
31 web-based administration.
33 NOTE: After installing this RPM, you will have a working GForge site
34 at http://localhost/. However, everything is set up to work locally,
35 so if you are installing a site-wide instance of GForge, be sure to
36 customize /etc/gforge/local.inc before use!
38 # Macro for generating an environment variable (%1) with %2 random characters
39 %define randstr() %1=`perl -e 'for ($i = 0, $bit = "!", $key = ""; $i < %2; $i++) {while ($bit !~ /^[0-9A-Za-z]$/) { $bit = chr(rand(90) + 32); } $key .= $bit; $bit = "!"; } print "$key";'`
41 # Change password for "siteadmin"
42 %define chpass() echo "UPDATE users SET user_pw = '%1' WHERE user_name = 'siteadmin'" | su -l postgres -s /bin/sh -c "psql alexandria" >/dev/null 2>&1
54 rm -rf $RPM_BUILD_ROOT
56 mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
57 for i in backend common cronjobs db monitor utils www ; do
58 cp -rp $i $RPM_BUILD_ROOT%{_datadir}/%{name}/
60 mkdir $RPM_BUILD_ROOT%{_datadir}/%{name}/www/incoming
62 mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d
63 install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/%{name}.conf
65 mkdir -p $RPM_BUILD_ROOT/etc/%{name}
66 install -m 600 etc/local.inc $RPM_BUILD_ROOT/etc/%{name}/
68 mkdir -p $RPM_BUILD_ROOT/etc/cron.daily $RPM_BUILD_ROOT/etc/cron.hourly
69 install -m 755 utils/gforge-nightly-cronjobs.sh $RPM_BUILD_ROOT/etc/cron.daily/
70 install -m 755 utils/gforge-hourly-cronjobs.sh $RPM_BUILD_ROOT/etc/cron.hourly/
73 if ! id -u %gfuser >/dev/null 2>&1; then
74 groupadd -r %{gfgroup}
75 useradd -r -g %{gfgroup} -d %{_datadir}/%{name} -s /bin/false -c "GForge User" %{gfuser}
80 # Initial install. Create and populate DB.
81 service postgresql status | grep 'is running' >/dev/null 2>&1 || service postgresql start
82 su -l postgres -s /bin/sh -c "createdb alexandria >/dev/null 2>&1"
83 su -l postgres -s /bin/sh -c "psql alexandria < %{_datadir}/%{name}/db/%{name}3.sql >/tmp/gforge.log 2>&1"
86 (echo $GFPASS ; echo $GFPASS) | su -l postgres -s /bin/sh -c "createuser -D -a -P -E gforge >/dev/null 2>&1"
89 echo "$SAPASS" > /etc/%{name}/siteadmin.pass
90 chmod 0600 /etc/%{name}/siteadmin.pass
91 SAPASS=`echo -n $SAPASS | md5sum | awk '{print $1}'`
94 # Update apache config
95 if test -f /etc/httpd/conf/httpd.conf; then
96 if ! grep 'Include .*%{name}.conf' /etc/httpd/conf/httpd.conf >/dev/null 2>&1; then
97 echo '# Added by %{name} package' >> /etc/httpd/conf/httpd.conf
98 echo "Include /etc/httpd/conf.d/%{name}.conf" >> /etc/httpd/conf/httpd.conf
99 service httpd restart >/dev/null 2>&1
104 if grep -i '^ *register_globals *=' /etc/php.ini >/dev/null 2>&1; then
105 if ! grep -i '^ *register_globals *= *on' /etc/php.ini >/dev/null 2>&1; then
106 perl -pi.pkgsave.%{name} -e 's/^\s*register_globals\s*=.*$/register_globals = On/gi;' /etc/php.ini
109 echo 'register_globals = On' >> /etc/php.ini
111 if grep -i '^ *include_path *=' /etc/php.ini >/dev/null 2>&1; then
112 if ! grep -i '^ *include_path *=.*%{name}' /etc/php.ini >/dev/null 2>&1; then
113 perl -pi.pkgsave.%{name} -e 's@^\s*include_path\s*=.*$@include_path = ".:%{_datadir}/%{name}/:%{_datadir}/%{name}/www/include/"@gi;' /etc/php.ini
116 echo 'include_path = ".:%{_datadir}/%{name}/:%{_datadir}/%{name}/www/include/"' >> /etc/php.ini
119 # Update PostgreSQL config
120 if ! grep -i '^ *host.*alexandria.*' /var/lib/pgsql/data/pg_hba.conf >/dev/null 2>&1; then
121 echo 'host alexandria 127.0.0.1 255.255.255.255 md5' >> /var/lib/pgsql/data/pg_hba.conf
122 service postgresql restart
125 # Add "noreply" alias
126 for i in /etc/postfix/aliases /etc/mail/aliases /etc/aliases ; do
128 if ! grep -i '^ *noreply:' $i >/dev/null 2>&1; then
129 echo 'noreply: /dev/null' >> $i
136 # Generate random session ID
139 perl -pi -e "s/DBPASSHERE/$GFPASS/g; s/RANDOMIDHERE/$SESSID/g;" /etc/%{name}/local.inc
147 if [ $1 -eq 0 ]; then
148 # Uninstall everything
149 su -l postgres -s /bin/sh -c "dropuser gforge ; dropdb alexandria"
150 rm -f /etc/%{name}/siteadmin.pass
152 # Remove apache config
153 if test -f /etc/httpd/conf/httpd.conf; then
154 if grep '^ *Include /etc/httpd/conf.d/%{name}.conf' /etc/httpd/conf/httpd.conf > /dev/null; then
155 perl -ni -e 'm@^\# Added by %{name}.*$@ or m@^ *Include /etc/httpd/conf.d/%{name}.conf@ or print;' /etc/httpd/conf/httpd.conf
156 service httpd restart
160 # Remove PHP include path
161 if grep -i '^ *include_path *=.*%{name}' /etc/php.ini >/dev/null 2>&1; then
162 perl -ni -e 'm@^ *include_path *=.*%{name}@ or print;' /etc/php.ini
165 # Remove PostgreSQL access
166 if grep -i '^ *host.*alexandria.*' /var/lib/pgsql/data/pg_hba.conf >/dev/null 2>&1; then
167 perl -ni -e 'm@^ *host.*alexandria.*@ or print;' /var/lib/pgsql/data/pg_hba.conf
171 if id -u %gfuser >/dev/null 2>&1; then
173 groupdel %gfgroup 2>/dev/null || :
182 rm -rf $RPM_BUILD_ROOT
185 %defattr(-, root, root)
186 %doc AUTHORS COPYING ChangeLog INSTALL README*
188 %attr(0600, apache, apache) %config(noreplace) /etc/%{name}/local.inc
189 %attr(0640, apache, apache) %config(noreplace) /etc/httpd/conf.d/%{name}.conf
190 %attr(0775, apache, apache) %dir %{_datadir}/%{name}/www/incoming
191 %{_datadir}/%{name}/backend
192 %{_datadir}/%{name}/common
193 %{_datadir}/%{name}/cronjobs
194 %{_datadir}/%{name}/db
195 %{_datadir}/%{name}/monitor
196 %{_datadir}/%{name}/utils
197 %{_datadir}/%{name}/www
198 /etc/cron.daily/gforge-nightly-cronjobs.sh
199 /etc/cron.hourly/gforge-hourly-cronjobs.sh
202 * Tue Sep 09 2003 Franco Catrin L. <fcatrin@tuxpan.com>
203 - Fixed PHP and PostgreSQL dependencies