lsc-core.spec 5.86 KB
Newer Older
1
#=================================================
2
# Specification file for LSC-project RPM
3
#
4
# Install LSC
5
#
6
7
8
# BSD License
#
# Copyright (c) 2009 - 2012 LSC Project
9
10
11
12
13
#=================================================

#=================================================
# Variables
#=================================================
14
%define lsc_name	lsc
Clément OUDOT's avatar
Clément OUDOT committed
15
%define lsc_version	2.0.2
16
17
18
%define lsc_logdir      /var/log/lsc
%define lsc_user        lsc
%define lsc_group       lsc
19
20
21
22
23

#=================================================
# Header
#=================================================
Summary: LDAP Synchronization Connector
24
25
Name: %{lsc_name}
Version: %{lsc_version}
26
Release: 0%{?dist}
27
License: BSD
28
BuildArch: noarch
29
30

Group: Applications/System
31
URL: http://lsc-project.org
32

33
Source: %{lsc_name}-core-%{lsc_version}-dist.zip
34
35
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

36
Prereq: coreutils
37
38
39
40
41
42
43
44
45
46

%description
The Ldap Synchronization Connector project provides tools to synchronize
a LDAP directory from a list of data sources including any database with
a JDBC connector, another LDAP directory, flat files... 

#=================================================
# Source preparation
#=================================================
%prep
47
48
49
50
51
52
%setup -n  %{lsc_name}-%{lsc_version}

#=================================================
# Build
#=================================================
%build
53
54
55
56
57
58
59
60

#=================================================
# Installation
#=================================================
%install
rm -rf %{buildroot}

# Create directories
61
62
63
64
mkdir -p %{buildroot}/usr/bin
mkdir -p %{buildroot}/usr/%{_lib}/lsc
mkdir -p %{buildroot}/etc/lsc
mkdir -p %{buildroot}/etc/lsc/sql-map-config.d
65
mkdir -p %{buildroot}/etc/cron.d
66
67
mkdir -p %{buildroot}/etc/init.d
mkdir -p %{buildroot}/etc/default
68
mkdir -p %{buildroot}/usr/share/doc/lsc/bin
69
mkdir -p %{buildroot}%{lsc_logdir}
70
mkdir -p %{buildroot}/var/lib/lsc/nagios
71
72

# Copy files
73
74
75
## bin
cp -a bin/lsc %{buildroot}/usr/bin
cp -a bin/lsc-agent %{buildroot}/usr/bin
76
cp -a bin/hsqldb %{buildroot}/usr/bin
77
78
79
80
81
82
83
84
## config
cp -a etc/logback.xml %{buildroot}/etc/lsc
cp -a etc/lsc.xml-sample %{buildroot}/etc/lsc/lsc.xml
cp -a etc/sql-map-config.xml-sample %{buildroot}/etc/lsc/sql-map-config.xml
## lib
cp -a lib/* %{buildroot}/usr/%{_lib}/lsc
## sample
cp -a sample/ %{buildroot}/usr/share/doc/lsc
85
## cron
86
cp -a etc/cron.d/lsc.cron %{buildroot}/etc/cron.d/lsc
87
88
89
## init
cp -a etc/init.d/lsc %{buildroot}/etc/init.d/lsc
cp -a etc/default/lsc %{buildroot}/etc/default/lsc
90
91
## nagios
cp -a bin/check_lsc* %{buildroot}/var/lib/lsc/nagios
92
93
94

# Reconfigure files
## logback
95
sed -i 's:/tmp/lsc/log:%{lsc_logdir}:' %{buildroot}/etc/lsc/logback.xml
96
97
98
99
100
## cron
sed -i 's: root : %{lsc_user} :' %{buildroot}/etc/cron.d/lsc
sed -i 's:#LSC_BIN#:/usr/bin/lsc:g' %{buildroot}/etc/cron.d/lsc
sed -i 's:^30:#30:' %{buildroot}/etc/cron.d/lsc
## bin
101
102
103
104
sed -i 's:^CFG_DIR.*:CFG_DIR="/etc/lsc":' %{buildroot}/usr/bin/lsc %{buildroot}/usr/bin/lsc-agent %{buildroot}/usr/bin/hsqldb
sed -i 's:^LIB_DIR.*:LIB_DIR="/usr/%{_lib}/lsc":' %{buildroot}/usr/bin/lsc %{buildroot}/usr/bin/lsc-agent %{buildroot}/usr/bin/hsqldb
sed -i 's:^LOG_DIR.*:LOG_DIR="%{lsc_logdir}":' %{buildroot}/usr/bin/lsc %{buildroot}/usr/bin/lsc-agent %{buildroot}/usr/bin/hsqldb
sed -i 's:^VAR_DIR.*:VAR_DIR="/var/lsc":' %{buildroot}/usr/bin/hsqldb
105
106
107
108
109
110
## init
sed -i 's:^LSC_BIN.*:LSC_BIN="/usr/bin/lsc":' %{buildroot}/etc/default/lsc
sed -i 's:^LSC_CFG_DIR.*:LSC_CFG_DIR="/etc/lsc":' %{buildroot}/etc/default/lsc
sed -i 's:^LSC_USER.*:LSC_USER="lsc":' %{buildroot}/etc/default/lsc
sed -i 's:^LSC_GROUP.*:LSC_GROUP="lsc":' %{buildroot}/etc/default/lsc
sed -i 's:^LSC_PID_FILE.*:LSC_PID_FILE="/var/run/lsc.pid":' %{buildroot}/etc/default/lsc
111
112
113
114
115
116
117
118
119

%post
#=================================================
# Post Installation
#=================================================

# Do this at first install
if [ $1 -eq 1 ]
then
120
121
122
        # Set lsc as service
        /sbin/chkconfig --add lsc

123
124
125
126
127
128
129
130
131
132
        # Create user and group
        /usr/sbin/groupadd %{lsc_group}
        /usr/sbin/useradd %{lsc_user} -g %{lsc_group}
fi

# Always do this
# Change owner
/bin/chown -R %{lsc_user}:%{lsc_group} %{lsc_logdir}

# Add symlink for sample to work
133
134
ln -sf /usr/%{_lib}/lsc/ /usr/share/doc/lsc/%{_lib}
ln -sf /usr/bin/lsc /usr/share/doc/lsc/bin/
135
136
137
138
139
140
141
142
143

%postun
#=================================================
# Post uninstallation
#=================================================

# Don't do this if newer version is installed
if [ $1 -eq 0 ]
then
144
145
146
147
	# Remove sample symlinks
	rm -rf /usr/share/doc/lsc/%{_lib}
	rm -rf /usr/share/doc/lsc/bin/

148
149
150
        # Delete user and group
        /usr/sbin/userdel -r %{lsc_user}
fi
151
152
153
154
155
156
157

#=================================================
# Cleaning
#=================================================
%clean
rm -rf %{buildroot}

158
#=================================================
159
160
161
# Files
#=================================================
%files
162
%defattr(-, root, root, 0755)
163
164
%config(noreplace) /etc/lsc/
%config(noreplace) /etc/cron.d/lsc
165
%config(noreplace) /etc/default/lsc
166
167
/usr/bin/lsc
/usr/bin/lsc-agent
168
/usr/bin/hsqldb
169
/etc/init.d/lsc
170
171
172
/usr/%{_lib}/lsc/
/usr/share/doc/lsc
%{lsc_logdir}
173
/var/lib/lsc/nagios
174
175
176
177
178

#=================================================
# Changelog
#=================================================
%changelog
Clément OUDOT's avatar
Clément OUDOT committed
179
180
* Fri Mar 22 2013 - Clement Oudot <clem@lsc-project.org> - 2.0.2-0
- Upgrade to LSC 2.0.2
Clément OUDOT's avatar
Clément OUDOT committed
181
182
* Thu Oct 11 2012 - Clement Oudot <clem@lsc-project.org> - 2.0.1-0
- Upgrade to LSC 2.0.1
183
184
185
186
187
188
189
190
191
192
193
* Mon Apr 02 2012 - Clement Oudot <clem@lsc-project.org> - 2.0-0
- Upgrade to LSC 2.0
* Thu Feb 09 2012 - Clement Oudot <clem@lsc-project.org> - 1.2.2-0
- Upgrade to LSC 1.2.2
- Change ownership of configuration files (#396)
- Add symlink for sample (#302)
* Sun Jul 18 2010 - Clement Oudot <clem@lsc-project.org> - 1.2.1-0
- Upgrade to LSC 1.2.1
- Build package from source
* Thu May 25 2010 - Clement Oudot <clem@lsc-project.org> - 1.2.0-0
- First package for LSC