Provided Debian compatible user/group add.
[captive.git] / captive.spec.in
1 # $Id$
2 # rpm package description file for building
3 # Copyright (C) 2002-2005 Jan Kratochvil <project-captive@jankratochvil.net>
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; exactly version 2 of June 1991 is required
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
19 # Build fully statically.
20 # /usr/local/staticbuild is required to contain static libraries.
21 %define static 1
22
23
24 # Temporary cludge before full 'devel' package gets deployed
25 %define _unpackaged_files_terminate_build 0
26
27 Summary: Microsoft Windows platform filesystem access.
28 %if %{static}
29 Name: @PACKAGE@-static
30 %else
31 Name: @PACKAGE@
32 %endif
33 %define release 0
34 Version: @VERSION@
35 Release: %{release}
36 Group: System Environment/Base
37 Packager: Jan Kratochvil <lace@jankratochvil.net>
38 Source: http://www.jankratochvil.net/project/captive/dist/@PACKAGE@-@VERSION@.tar.gz
39 License: GPL
40 BuildRoot: /var/tmp/@PACKAGE@-@VERSION@-%{release}-root
41 BuildRequires: ORBit2-devel
42 # >= 2.7.0 due to --with-orbit-line=link
43 # >= 2.8.3 due to Mandrake-9.2 bugreport.
44 %if ! %{static}
45 Requires: ORBit2 >= 2.8.3
46 %endif
47 BuildRequires: openssl-devel
48 %if ! %{static}
49 Requires: openssl
50 %endif
51 BuildRequires: gnome-vfs2-devel
52 %if ! %{static}
53 Requires: gnome-vfs2
54 %endif
55 BuildRequires: libxml2-devel
56 %if ! %{static}
57 Requires: libxml2
58 %endif
59 BuildRequires: popt
60 %if ! %{static}
61 Requires: popt
62 %endif
63 BuildRequires: glib2-devel
64 %if ! %{static}
65 Requires: glib2
66 %endif
67 BuildRequires: readline-devel
68 %if ! %{static}
69 Requires: readline
70 %endif
71 BuildRequires: gcc >= 3.0
72 %if %{static}
73 BuildRequires: fuse-devel
74 BuildRequires: ntfsprogs-devel >= 1.8.0
75 BuildRequires: libgnomeui-devel
76 Obsoletes: @PACKAGE@
77 Obsoletes: @PACKAGE@-lufs
78 Obsoletes: @PACKAGE@-install
79 # FIXME: ?: ntfsprogs-gnomevfs < 1.1
80 %else
81 Conflicts: @PACKAGE@-static
82 %endif
83
84 %description
85 Existing binary Microsoft Windows file system drivers were exploited
86 for accessing drives with possibly proprietary file system data structures.
87 Open file system API is provided to access these file system drivers.
88 Microsoft Windows system components required by these drivers
89 were analyzed and successfuly emulated in the GNU/Linux operating system.
90
91 The implementation allows applications running under the GNU/Linux operating
92 system to access NTFS drives. File system driver compatibility with VFAT,
93 ISO9660 and EXT2 is also provided.
94
95 http://www.jankratochvil.net/project/captive/
96 %if %{static}
97 This packaging is a standalone static version, no other packages are needed.
98
99 %else
100
101 %package fuse
102 Summary: FUSE module for Microsoft Windows platform filesystem access.
103 Group: System Environment/Base
104 Requires: captive = %{PACKAGE_VERSION}
105 BuildRequires: fuse-devel
106 Requires: fuse fuse-libs
107
108 %description fuse
109 FUSE is a userspace filesystem framework.
110
111 Package provides FUSE filesystem module to access Microsoft Windows platform
112 filesystems such as NTFS. Use filesystem type 'captive-ntfs' for NTFS disks.
113
114 %package install
115 Summary: Instant installer for Microsoft Windows platform filesystem access.
116 Group: System Environment/Base
117 Requires: captive-fuse = %{PACKAGE_VERSION}
118 # Versions before 1.8.0 were too buggy
119 BuildRequires: ntfsprogs-devel >= 1.8.0
120 # 'PreReq' needed for Mandrake-9.1 otherwise '%preun install' fails
121 # during 'rpm -e ntfsprogs captive-install':
122 PreReq: ntfsprogs >= 1.8.0
123 Requires: ntfsprogs >= 1.8.0
124 Requires: ntfsprogs-gnomevfs
125 Obsoletes: gnome-vfs-httpcaptive
126 BuildRequires: gnome-vfs2-devel
127 Requires: gnome-vfs2
128 BuildRequires: libgnomeui-devel
129 Requires: libgnomeui
130 BuildRequires: readline-devel
131 Requires: readline
132 BuildRequires: libxml2-devel >= 2.4.29
133 Requires: libxml2 >= 2.4.29
134
135 %description install
136 Package provides easy enough unattended installation of Microsoft Windows
137 platform filesystem access. Installer finds available NTFS partitions and
138 tries to acquire needed Microsoft Windows filesystem driver files.
139
140 You may need to run 'captive-install-acquire' to answer several questions.
141 NTFS disks will become mount(8)able at directories: /mnt/captive-VOLUME_NAME
142
143 %endif
144
145 #% %package devel
146 #% Summary: Microsoft Windows platform filesystem access development support.
147 #% Group: Development/System
148 #% Requires: surprise = %{PACKAGE_VERSION}
149 #% 
150 #% %description devel
151 #% Development package containing libraries for static linking together with
152 #% header files needed for any linking.
153 #% 
154 #% Microsoft Windows platform filesystem access.
155 #% TODO
156
157 %prep
158 %setup -n @PACKAGE@-%{version}
159
160 %build
161 # Never disable debug for captive, see FAQ
162 #       "How to check valid input arguments? Invalid processing state assumptions?"
163 %if 0
164 # For AutoGen:
165 %configure
166 %endif
167 # 'define' of rpm(1) does not accept line-continuation backslashes ('\').
168 %if %{static}
169 export CPPFLAGS="-I/usr/local/staticbuild/include/gnome-vfs-module-2.0"
170 %configure \
171                 --disable-shared --enable-static \
172                 --enable-standalone \
173                 --enable-standalone-fonts=%{_datadir}/@PACKAGE@/fonts \
174 %else
175 %configure \
176                 --enable-shared --disable-static \
177                 --disable-standalone \
178                 --disable-standalone-fonts \
179 %endif
180                 --disable-standalone-yum \
181                 --with-readline \
182                 --disable-bug-replay \
183                 --disable-lufs \
184                 --enable-fuse \
185                 --enable-install-pkg \
186                 --enable-sandbox-setuid=@PACKAGE@ \
187                 --enable-sandbox-setgid=@PACKAGE@ \
188                 --enable-sandbox-chroot=%{_var}/lib/@PACKAGE@ \
189                 --enable-man-pages \
190                 --enable-sbin-mountdir=/sbin \
191                 --enable-sbin-mount-fs=ntfs:fastfat:cdfs:ext2fsd \
192                 --with-initddir=%{_initrddir} \
193                 --disable-gtk-doc \
194                 --with-orbit-line=link
195
196 #               --enable-standalone-yum=%{_sysconfdir}/yum.repos.d
197
198 make
199 %if %{static}
200 ./build-static link
201 %endif
202
203 %install
204 make DESTDIR=$RPM_BUILD_ROOT install-strip
205
206 %clean
207 rm -rf $RPM_BUILD_ROOT
208
209 %pre
210
211 %if ! %{static}
212 %pre fuse
213 %endif
214 %if %{static}
215 /usr/sbin/groupadd -r                                  fuse 2>/dev/null || \
216    /usr/sbin/groupadd                                  fuse 2>/dev/null || \
217    /usr/sbin/adduser --quiet --system --no-create-home fuse 2>/dev/null || \
218    true
219 %endif
220
221 %post
222 /sbin/ldconfig
223 /usr/sbin/groupadd -r                  captive 2>/dev/null || \
224    /usr/sbin/groupadd                  captive 2>/dev/null || \
225    /usr/sbin/addgroup --system --quiet captive 2>/dev/null || \
226    true
227 /usr/sbin/useradd -r -c "Captive Sandbox" -s /sbin/nologin -g captive -d %{_var}/lib/@PACKAGE@ captive 2>/dev/null || \
228    /usr/sbin/useradd -c "Captive Sandbox" -s /sbin/nologin -g captive -d %{_var}/lib/@PACKAGE@ captive 2>/dev/null || \
229    /usr/sbin/adduser --quiet --system --no-create-home            --home %{_var}/lib/@PACKAGE@ captive 2>/dev/null || \
230    true
231
232 %if ! %{static}
233 %post fuse
234 %endif
235 /usr/lib/lsb/install_initd @PACKAGE@ 2>/dev/null || \
236                 /sbin/chkconfig --add @PACKAGE@
237 touch %{_var}/lock/subsys/@PACKAGE@
238
239 %if ! %{static}
240 %post install
241 %endif
242 %{_sbindir}/captive-install-fstab --add
243 %{_sbindir}/captive-install-acquire --text --scan-disks-quick
244
245 %preun
246
247 %if ! %{static}
248 %preun fuse
249 %endif
250 # Only on real erase, not on upgrade:
251 if [ $1 = 0 ];then
252         /usr/lib/lsb/remove_initd @PACKAGE@ 2>/dev/null || \
253                         /sbin/chkconfig --del @PACKAGE@
254         %{_initrddir}/@PACKAGE@ stop
255         rm -f %{_var}/lock/subsys/@PACKAGE@
256 fi
257
258 %if ! %{static}
259 %preun install
260 %endif
261 # Only on real erase, not on upgrade:
262 if [ $1 = 0 ];then
263         %{_sbindir}/captive-install-fstab --remove
264 fi
265
266 %postun
267 /sbin/ldconfig
268 # Only on real erase, not on upgrade:
269 if [ $1 = 0 ];then
270         # Remove stale sandbox chroot directories owned by 'captive.captive':
271         rm -rf %{_var}/lib/@PACKAGE@/s-*
272         rm -rf %{_var}/lib/@PACKAGE@/tmp/*
273 fi
274
275 %files
276 %defattr(-,root,root)
277 %doc README NEWS AUTHORS THANKS TODO
278 %if ! %{static}
279 %{_libdir}/lib@PACKAGE@-@VERSION@.so
280 %{_libdir}/gnome-vfs-2.0/modules/lib@PACKAGE@-gnomevfs-@VERSION@.so
281 %{_libdir}/gnome-vfs-2.0/modules/lib@PACKAGE@-gnomevfs.so
282 %endif
283 %attr(644,root,root) %{_mandir}/man?/@PACKAGE@.*
284 %{_bindir}/@PACKAGE@-cmdline
285 %attr(644,root,root) %{_mandir}/man?/@PACKAGE@-cmdline.*
286 %attr(4755,root,root) %{_libexecdir}/@PACKAGE@-sandbox-server
287 %attr(644,root,root) %{_mandir}/man?/@PACKAGE@-sandbox-server.*
288 %config %{_sysconfdir}/w32-mod-id.captivemodid.xml
289 %if ! %{static}
290 %config %{_sysconfdir}/gnome-vfs-2.0/modules/@PACKAGE@.conf
291 %endif
292 # %config %{_sysconfdir}/yum.repos.d/*
293 %{_datadir}/locale/*/LC_MESSAGES/@PACKAGE@.mo
294 %{_var}/lib/@PACKAGE@
295
296 %if ! %{static}
297 %files fuse
298 %endif
299 %defattr(-,root,root)
300 %{_initrddir}/@PACKAGE@
301 /sbin/mount.@PACKAGE@
302 /sbin/mount.@PACKAGE@-*
303 %attr(644,root,root) %{_mandir}/man?/mount.@PACKAGE@.*
304 %if %{static}
305 %attr(4754,root,fuse) %{_libexecdir}/@PACKAGE@-fusermount
306 %endif
307
308 %if ! %{static}
309 %files install
310 %endif
311 %defattr(-,root,root)
312 %{_sbindir}/captive-install-fstab
313 %attr(644,root,root) %{_mandir}/man?/captive-install-fstab.*
314 %{_sbindir}/captive-install-acquire
315 %attr(644,root,root) %{_mandir}/man?/captive-install-acquire.*
316 %if %{static}
317 %{_datadir}/@PACKAGE@
318 %endif
319
320 # %files devel
321 # %defattr(-,root,root)
322 # %doc ChangeLog
323 # /usr/include/@PACKAGE@
324 # /usr/share/aclocal/*
325 # %{_libdir}/gnome-vfs-2.0/modules/libcaptive-gnomevfs.la
326 # /usr/lib/*.a
327 # /usr/lib/*.la
328 # ###for --disable-shared/(--enable-static-link disable):
329 # /usr/lib/*[a-z].so