File: fusionforge-shell-postgresql.spec

package info (click to toggle)
fusionforge 5.3.2%2B20141104-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 60,472 kB
  • sloc: php: 271,846; sql: 36,817; python: 14,575; perl: 6,406; sh: 5,980; xml: 4,294; pascal: 1,411; makefile: 911; cpp: 52; awk: 27
file content (126 lines) | stat: -rw-r--r-- 3,722 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#%define dbhost			localhost
%define dbname			gforge
#%define dbuser			gforge
#%define plugin          scmcvs
%{!?release:%define release 1}

Summary: collaborative development tool - shell accounts (using PostgreSQL)
Name: fusionforge-shell-postgresql
Version: 4.8.2
Release: %{release}
BuildArch: noarch
License: GPL
Group: Development/Tools
Source: %{name}-%{version}.tar.bz2
AutoReqProv: off
Requires: fusionforge >= 4.8
Requires: libnss-pgsql >= 1.4
Requires: nscd
#Requires: perl perl-URI

URL: http://www.fusionforge.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-root

#%define gfuser                  gforge
#%define gfgroup                 gforge

#Requires: perl-IPC-Run

#Globals defines for gforge
%define GFORGE_DIR              %{_datadir}/gforge
%define SBIN_DIR		%{_sbindir}
%define CROND_DIR               %{_sysconfdir}/cron.d
%define GFORGE_CONF_DIR         %{_sysconfdir}/gforge

%define startnscd() service nscd status | grep '(pid' >/dev/null 2>&1 || service nscd start
%define nscdonstart() chkconfig nscd on

%description
GForge provides many tools to aid collaboration in a
development project, such as bug-tracking, task management,
mailing-lists, SCM repository, forums, support request helper,
web/FTP hosting, release management, etc. All these services are
integrated into one web site and managed through a web interface.

This package provides shell accounts authenticated via the PostGreSQL
database to GForge users.

%prep
%setup

%build

%install
# cleaning build environment
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

# creating required directories
install -m 755 -d $RPM_BUILD_ROOT/%{GFORGE_DIR}/utils
install -m 755 install-nsspgsql.sh $RPM_BUILD_ROOT/%{GFORGE_DIR}/utils/install-nsspgsql.sh

# installing configuration file
# rien pour le moment

%pre

%post
if [ "$1" = "1" ] ; then
	
	# configuring gforge
	perl -pi -e "
		s/^sys_account_manager_type=.*/sys_account_manager_type=pgsql/g" %{GFORGE_CONF_DIR}/gforge.conf

	# creating gforge database user
	#GFORGEDATABASE_PASSWORD=$(grep ^db_password= %{GFORGE_CONF_DIR}/gforge.conf | cut -d= -f2-)
	#su -l postgres -c "psql -c \"CREATE USER gforge_nss WITH PASSWORD '$GFORGEDATABASE_PASSWORD' NOCREATEUSER\" %{dbname} >/dev/null 2>&1"
	
	# updating PostgreSQL configuration
	#if ! grep -i '^ *host.*gforge_nss.*' /var/lib/pgsql/data/pg_hba.conf >/dev/null 2>&1; then
	#	echo 'host %{dbname} gforge_nss 127.0.0.1 255.255.255.255 trust' >> /var/lib/pgsql/data/pg_hba.conf
	#	%reloadpostgresql
	#fi
	
	#Configuration de libnss-pgsql
	ln -s %{GFORGE_DIR}/utils/install-nsspgsql.sh %{SBIN_DIR}/
	install-nsspgsql.sh setup

	%startnscd
        %nscdonstart

	#if plugin scmcvs is installed, comment the cron usergroup.php
	if [ ! "$(rpm -qa fusionforge-plugin-scmcvs)" = "" ]; then
		#echo "plugin scmcvs installed"
		if [ "$(grep 'usergroup.php' %{CROND_DIR}/fusionforge-plugin-scmcvs | grep '#')" = "" ]; then
			#echo "I comment the cron if it is un comment"
			sed -i "s/^\(.*usergroup.php.*\)/#\1/" %{CROND_DIR}/fusionforge-plugin-scmcvs
		fi
	fi
else
        # upgrade
        :
fi

%postun
if [ "$1" = "0" ] ; then
        #reconfiguration de gforge
	#suppression des fichiers de conf créés par install-nsspgsql.sh
        #suppression du user gforge_nss
        #suppression de gforge_nss 127.0.0.1 255.255.255.255 trust dans /var/lib/pgsql/data/pg_hba.conf
	#activation du cron usergroup.php
else
        # upgrade
        :
fi

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
#%doc AUTHORS COPYING README
%{GFORGE_DIR}/utils/install-nsspgsql.sh

%changelog
* Mon Feb 13 2009 Alexandre NEYMANN <alexandre.neymann@dgfip.finances.gouv.fr>
- 4.7.1
Initial RPM packaging