Fixed message typo.
[captive.git] / captive.spec.in
index 1f60ba4..fb40beb 100644 (file)
@@ -1,6 +1,6 @@
 # $Id$
 # rpm package description file for building
 # $Id$
 # rpm package description file for building
-# Copyright (C) 2002-2003 Jan Kratochvil <project-captive@jankratochvil.net>
+# Copyright (C) 2002-2005 Jan Kratochvil <project-captive@jankratochvil.net>
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
+# Build fully statically.
+# /usr/local/staticbuild is required to contain static libraries.
+%define static 1
+
+
 # Temporary cludge before full 'devel' package gets deployed
 %define _unpackaged_files_terminate_build 0
 
 Summary: Microsoft Windows platform filesystem access.
 # Temporary cludge before full 'devel' package gets deployed
 %define _unpackaged_files_terminate_build 0
 
 Summary: Microsoft Windows platform filesystem access.
+%if %{static}
+Name: @PACKAGE@-static
+%else
 Name: @PACKAGE@
 Name: @PACKAGE@
+%endif
 %define release 0
 Version: @VERSION@
 Release: %{release}
 Group: System Environment/Base
 %define release 0
 Version: @VERSION@
 Release: %{release}
 Group: System Environment/Base
-Packager: Jan Kratochvil <project-captive@jankratochvil.net>
+Packager: Jan Kratochvil <lace@jankratochvil.net>
 Source: http://www.jankratochvil.net/project/captive/dist/@PACKAGE@-@VERSION@.tar.gz
 Source: http://www.jankratochvil.net/project/captive/dist/@PACKAGE@-@VERSION@.tar.gz
-Copyright: GPL
+License: GPL
 BuildRoot: /var/tmp/@PACKAGE@-@VERSION@-%{release}-root
 BuildRequires: ORBit2-devel
 BuildRoot: /var/tmp/@PACKAGE@-@VERSION@-%{release}-root
 BuildRequires: ORBit2-devel
-Requires: ORBit2
-# Due to --with-orbit-line=linc
-Conflicts: ORBit2 >= 2.7.0
+# >= 2.7.0 due to --with-orbit-line=link
+# >= 2.8.3 due to Mandrake-9.2 bugreport.
+%if ! %{static}
+Requires: ORBit2 >= 2.8.3
+%endif
 BuildRequires: openssl-devel
 BuildRequires: openssl-devel
+%if ! %{static}
 Requires: openssl
 Requires: openssl
+%endif
 BuildRequires: gnome-vfs2-devel
 BuildRequires: gnome-vfs2-devel
+%if ! %{static}
 Requires: gnome-vfs2
 Requires: gnome-vfs2
+%endif
 BuildRequires: libxml2-devel
 BuildRequires: libxml2-devel
+%if ! %{static}
 Requires: libxml2
 Requires: libxml2
+%endif
 BuildRequires: popt
 BuildRequires: popt
+%if ! %{static}
 Requires: popt
 Requires: popt
+%endif
 BuildRequires: glib2-devel
 BuildRequires: glib2-devel
+%if ! %{static}
 Requires: glib2
 Requires: glib2
+%endif
 BuildRequires: readline-devel
 BuildRequires: readline-devel
+%if ! %{static}
 Requires: readline
 Requires: readline
+%endif
 BuildRequires: gcc >= 3.0
 BuildRequires: gcc >= 3.0
+%if %{static}
+BuildRequires: fuse-devel
+BuildRequires: ntfsprogs-devel >= 1.8.0
+BuildRequires: libgnomeui-devel
+Obsoletes: @PACKAGE@
+Obsoletes: @PACKAGE@-lufs
+Obsoletes: @PACKAGE@-install
+# FIXME: ?: ntfsprogs-gnomevfs < 1.1
+%else
+Conflicts: @PACKAGE@-static
+%endif
 
 %description
 Existing binary Microsoft Windows file system drivers were exploited
 
 %description
 Existing binary Microsoft Windows file system drivers were exploited
@@ -58,23 +92,29 @@ The implementation allows applications running under the GNU/Linux operating
 system to access NTFS drives. File system driver compatibility with VFAT,
 ISO9660 and EXT2 is also provided.
 
 system to access NTFS drives. File system driver compatibility with VFAT,
 ISO9660 and EXT2 is also provided.
 
-%package lufs
-Summary: LUFS module for Microsoft Windows platform filesystem access.
+http://www.jankratochvil.net/project/captive/
+%if %{static}
+This packaging is a standalone static version, no other packages are needed.
+
+%else
+
+%package fuse
+Summary: FUSE module for Microsoft Windows platform filesystem access.
 Group: System Environment/Base
 Requires: captive = %{PACKAGE_VERSION}
 Group: System Environment/Base
 Requires: captive = %{PACKAGE_VERSION}
-BuildRequires: lufs >= 0.9.6-1captive
-Requires: lufs >= 0.9.6-1captive
+BuildRequires: fuse-devel
+Requires: fuse fuse-libs
 
 
-%description lufs
-LUFS is a hybrid userspace filesystem framework.
+%description fuse
+FUSE is a userspace filesystem framework.
 
 
-Package provides LUFS filesystem module to access Microsoft Windows platform
+Package provides FUSE filesystem module to access Microsoft Windows platform
 filesystems such as NTFS. Use filesystem type 'captive-ntfs' for NTFS disks.
 
 %package install
 Summary: Instant installer for Microsoft Windows platform filesystem access.
 Group: System Environment/Base
 filesystems such as NTFS. Use filesystem type 'captive-ntfs' for NTFS disks.
 
 %package install
 Summary: Instant installer for Microsoft Windows platform filesystem access.
 Group: System Environment/Base
-Requires: captive-lufs = %{PACKAGE_VERSION}
+Requires: captive-fuse = %{PACKAGE_VERSION}
 # Versions before 1.8.0 were too buggy
 BuildRequires: ntfsprogs-devel >= 1.8.0
 # 'PreReq' needed for Mandrake-9.1 otherwise '%preun install' fails
 # Versions before 1.8.0 were too buggy
 BuildRequires: ntfsprogs-devel >= 1.8.0
 # 'PreReq' needed for Mandrake-9.1 otherwise '%preun install' fails
@@ -82,7 +122,7 @@ BuildRequires: ntfsprogs-devel >= 1.8.0
 PreReq: ntfsprogs >= 1.8.0
 Requires: ntfsprogs >= 1.8.0
 Requires: ntfsprogs-gnomevfs
 PreReq: ntfsprogs >= 1.8.0
 Requires: ntfsprogs >= 1.8.0
 Requires: ntfsprogs-gnomevfs
-Requires: gnome-vfs-httpcaptive
+Obsoletes: gnome-vfs-httpcaptive
 BuildRequires: gnome-vfs2-devel
 Requires: gnome-vfs2
 BuildRequires: libgnomeui-devel
 BuildRequires: gnome-vfs2-devel
 Requires: gnome-vfs2
 BuildRequires: libgnomeui-devel
@@ -100,6 +140,8 @@ tries to acquire needed Microsoft Windows filesystem driver files.
 You may need to run 'captive-install-acquire' to answer several questions.
 NTFS disks will become mount(8)able at directories: /mnt/captive-VOLUME_NAME
 
 You may need to run 'captive-install-acquire' to answer several questions.
 NTFS disks will become mount(8)able at directories: /mnt/captive-VOLUME_NAME
 
+%endif
+
 #% %package devel
 #% Summary: Microsoft Windows platform filesystem access development support.
 #% Group: Development/System
 #% %package devel
 #% Summary: Microsoft Windows platform filesystem access development support.
 #% Group: Development/System
@@ -113,16 +155,33 @@ NTFS disks will become mount(8)able at directories: /mnt/captive-VOLUME_NAME
 #% TODO
 
 %prep
 #% TODO
 
 %prep
-%setup
+%setup -n @PACKAGE@-%{version}
 
 %build
 # Never disable debug for captive, see FAQ
 #      "How to check valid input arguments? Invalid processing state assumptions?"
 
 %build
 # Never disable debug for captive, see FAQ
 #      "How to check valid input arguments? Invalid processing state assumptions?"
+%if 0
+# For AutoGen:
+%configure
+%endif
+# 'define' of rpm(1) does not accept line-continuation backslashes ('\').
+%if %{static}
+export CPPFLAGS="-I/usr/local/staticbuild/include/gnome-vfs-module-2.0"
+%configure \
+               --disable-shared --enable-static \
+               --enable-standalone \
+               --enable-standalone-fonts=%{_datadir}/@PACKAGE@/fonts \
+%else
 %configure \
                --enable-shared --disable-static \
 %configure \
                --enable-shared --disable-static \
+               --disable-standalone \
+               --disable-standalone-fonts \
+%endif
+               --disable-standalone-yum \
                --with-readline \
                --disable-bug-replay \
                --with-readline \
                --disable-bug-replay \
-               --enable-lufs \
+               --disable-lufs \
+               --enable-fuse \
                --enable-install-pkg \
                --enable-sandbox-setuid=@PACKAGE@ \
                --enable-sandbox-setgid=@PACKAGE@ \
                --enable-install-pkg \
                --enable-sandbox-setuid=@PACKAGE@ \
                --enable-sandbox-setgid=@PACKAGE@ \
@@ -130,9 +189,16 @@ NTFS disks will become mount(8)able at directories: /mnt/captive-VOLUME_NAME
                --enable-man-pages \
                --enable-sbin-mountdir=/sbin \
                --enable-sbin-mount-fs=ntfs:fastfat:cdfs:ext2fsd \
                --enable-man-pages \
                --enable-sbin-mountdir=/sbin \
                --enable-sbin-mount-fs=ntfs:fastfat:cdfs:ext2fsd \
+               --with-initddir=%{_initrddir} \
                --disable-gtk-doc \
                --disable-gtk-doc \
-               --with-orbit-line=linc
+               --with-orbit-line=link
+
+#              --enable-standalone-yum=%{_sysconfdir}/yum.repos.d
+
 make
 make
+%if %{static}
+./build-static link
+%endif
 
 %install
 make DESTDIR=$RPM_BUILD_ROOT install-strip
 
 %install
 make DESTDIR=$RPM_BUILD_ROOT install-strip
@@ -140,56 +206,116 @@ make DESTDIR=$RPM_BUILD_ROOT install-strip
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%pre
+
+%if ! %{static}
+%pre fuse
+%endif
+%if %{static}
+/usr/sbin/groupadd -r                                  fuse 2>/dev/null || \
+   /usr/sbin/groupadd                                  fuse 2>/dev/null || \
+   /usr/sbin/adduser --quiet --system --no-create-home fuse 2>/dev/null || \
+   echo >&2 "WARNING: Failed to create system group: fuse"
+%endif
+
 %post
 /sbin/ldconfig
 %post
 /sbin/ldconfig
-/usr/sbin/groupadd -r captive 2>/dev/null || true
-/usr/sbin/useradd -c "Captive Sandbox" -s /sbin/nologin -r -g captive -d %{_var}/lib/@PACKAGE@ captive 2>/dev/null || true
+/usr/sbin/groupadd -r                  captive 2>/dev/null || \
+   /usr/sbin/groupadd                  captive 2>/dev/null || \
+   /usr/sbin/addgroup --system --quiet captive 2>/dev/null || \
+   echo >&2 "WARNING: Failed to create system group: captive"
+/usr/sbin/useradd -r -c "Captive Sandbox" -s /sbin/nologin -g captive -d %{_var}/lib/@PACKAGE@ captive 2>/dev/null || \
+   /usr/sbin/useradd -c "Captive Sandbox" -s /sbin/nologin -g captive -d %{_var}/lib/@PACKAGE@ captive 2>/dev/null || \
+   /usr/sbin/adduser --quiet --system --no-create-home            --home %{_var}/lib/@PACKAGE@ captive 2>/dev/null || \
+   echo >&2 "WARNING: Failed to create system user: captive"
+
+%if ! %{static}
+%post fuse
+%endif
+/usr/lib/lsb/install_initd @PACKAGE@ 2>/dev/null || \
+               /sbin/chkconfig --add @PACKAGE@
+touch %{_var}/lock/subsys/@PACKAGE@
+
+%if ! %{static}
+%post install
+%endif
+%{_sbindir}/captive-install-fstab --add
+%{_sbindir}/captive-install-acquire --text --scan-disks-quick
+
+%preun
+
+%if ! %{static}
+%preun fuse
+%endif
+# Only on real erase, not on upgrade:
+if [ $1 = 0 ];then
+       /usr/lib/lsb/remove_initd @PACKAGE@ 2>/dev/null || \
+                       /sbin/chkconfig --del @PACKAGE@
+       %{_initrddir}/@PACKAGE@ stop
+       rm -f %{_var}/lock/subsys/@PACKAGE@
+fi
+
+%if ! %{static}
+%preun install
+%endif
+# Only on real erase, not on upgrade:
+if [ $1 = 0 ];then
+       %{_sbindir}/captive-install-fstab --remove
+fi
 
 %postun
 /sbin/ldconfig
 
 %postun
 /sbin/ldconfig
-# Remove stale sandbox chroot directories owned by 'captive.captive':
-rm -rf %{_var}/lib/@PACKAGE@/sandbox-server-*
+# Only on real erase, not on upgrade:
+if [ $1 = 0 ];then
+       # Remove stale sandbox chroot directories owned by 'captive.captive':
+       rm -rf %{_var}/lib/@PACKAGE@/s-*
+       rm -rf %{_var}/lib/@PACKAGE@/tmp/*
+fi
 
 %files
 %defattr(-,root,root)
 %doc README NEWS AUTHORS THANKS TODO
 
 %files
 %defattr(-,root,root)
 %doc README NEWS AUTHORS THANKS TODO
+%if ! %{static}
 %{_libdir}/lib@PACKAGE@-@VERSION@.so
 %{_libdir}/lib@PACKAGE@-@VERSION@.so
-%attr(644,root,root) %{_mandir}/man?/@PACKAGE@.*
 %{_libdir}/gnome-vfs-2.0/modules/lib@PACKAGE@-gnomevfs-@VERSION@.so
 %{_libdir}/gnome-vfs-2.0/modules/lib@PACKAGE@-gnomevfs.so
 %{_libdir}/gnome-vfs-2.0/modules/lib@PACKAGE@-gnomevfs-@VERSION@.so
 %{_libdir}/gnome-vfs-2.0/modules/lib@PACKAGE@-gnomevfs.so
+%endif
+%attr(644,root,root) %{_mandir}/man?/@PACKAGE@.*
 %{_bindir}/@PACKAGE@-cmdline
 %attr(644,root,root) %{_mandir}/man?/@PACKAGE@-cmdline.*
 %{_bindir}/@PACKAGE@-cmdline
 %attr(644,root,root) %{_mandir}/man?/@PACKAGE@-cmdline.*
-%attr(4755,root,root) %{_sbindir}/@PACKAGE@-sandbox-server
+%attr(4755,root,root) %{_libexecdir}/@PACKAGE@-sandbox-server
 %attr(644,root,root) %{_mandir}/man?/@PACKAGE@-sandbox-server.*
 %attr(644,root,root) %{_mandir}/man?/@PACKAGE@-sandbox-server.*
+%config %{_sysconfdir}/w32-mod-id.captivemodid.xml
+%if ! %{static}
 %config %{_sysconfdir}/gnome-vfs-2.0/modules/@PACKAGE@.conf
 %config %{_sysconfdir}/gnome-vfs-2.0/modules/@PACKAGE@.conf
+%endif
+# %config %{_sysconfdir}/yum.repos.d/*
 %{_datadir}/locale/*/LC_MESSAGES/@PACKAGE@.mo
 %{_datadir}/locale/*/LC_MESSAGES/@PACKAGE@.mo
-%attr(755,root,root) %{_var}/lib/@PACKAGE@
-%attr(1777,root,root) %{_var}/lib/@PACKAGE@/tmp
-%attr(644,root,root) %{_var}/lib/@PACKAGE@/*.sys
+%{_var}/lib/@PACKAGE@
 
 
-%files lufs
+%if ! %{static}
+%files fuse
+%endif
 %defattr(-,root,root)
 %defattr(-,root,root)
-%{_libdir}/liblufs-@PACKAGE@fs-@VERSION@.so
-%{_libdir}/liblufs-@PACKAGE@fs.so
-%attr(644,root,root) %{_mandir}/man?/lufs-@PACKAGE@fs.*
+%{_initrddir}/@PACKAGE@
 /sbin/mount.@PACKAGE@
 /sbin/mount.@PACKAGE@-*
 %attr(644,root,root) %{_mandir}/man?/mount.@PACKAGE@.*
 /sbin/mount.@PACKAGE@
 /sbin/mount.@PACKAGE@-*
 %attr(644,root,root) %{_mandir}/man?/mount.@PACKAGE@.*
+%if %{static}
+%attr(4754,root,fuse) %{_libexecdir}/@PACKAGE@-fusermount
+%endif
 
 
-%post install
-%{_sbindir}/captive-install-fstab --add
-%{_sbindir}/captive-install-acquire --text --scan-disks-quick
-
-%preun install
-%{_sbindir}/captive-install-fstab --remove
-
+%if ! %{static}
 %files install
 %files install
+%endif
 %defattr(-,root,root)
 %defattr(-,root,root)
-%config %{_sysconfdir}/w32-mod-id.captivemodid.xml
 %{_sbindir}/captive-install-fstab
 %attr(644,root,root) %{_mandir}/man?/captive-install-fstab.*
 %{_sbindir}/captive-install-acquire
 %attr(644,root,root) %{_mandir}/man?/captive-install-acquire.*
 %{_sbindir}/captive-install-fstab
 %attr(644,root,root) %{_mandir}/man?/captive-install-fstab.*
 %{_sbindir}/captive-install-acquire
 %attr(644,root,root) %{_mandir}/man?/captive-install-acquire.*
+%if %{static}
+%{_datadir}/@PACKAGE@
+%endif
 
 # %files devel
 # %defattr(-,root,root)
 
 # %files devel
 # %defattr(-,root,root)