%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
%define	_root_sbindir	/sbin
%define	_root_libdir	/%{_lib}

Summary:     Utilities for managing ext2/3/4 filesystem.
Summary(ja): ext2/3/4 ファイルシステム操作ユーティリティ
Name:        e2fsprogs
Version:     1.41.10
Release:     1%{?_dist_release}
License:     GPL
Group:       System Environment/Base
Url:         http://e2fsprogs.sourceforge.net/
Source0:     ftp://download.sourceforge.net/pub/sourceforge/%{name}/%{name}-%{version}.tar.gz
Source1:     ext2_types-wrapper.h

Patch2:      e2fsprogs-1.40.4-sb_feature_check_ignore.patch

BuildRoot:   %{_tmppath}/%{name}-%{version}-root

BuildRequires: gettext, texinfo
BuildRequires: pkgconfig, device-mapper-devel, gawk
BuildRequires: libblkid-devel
BuildRequires: libuuid-devel

Requires(post): /sbin/install-info
Requires(postun): /sbin/install-info
Requires(post): chkconfig
Requires(pre): shadow-utils

%description
The e2fsprogs package contains a number of utilities for creating,
checking, modifying, and correcting any inconsistencies in ext2/3/4
filesystems. E2fsprogs contains e2fsck (used to repair filesystem 
inconsistencies after an unclean shutdown), mke2fs (used to 
initialize a partition to contain an empty ext2/3/4 filesystem),
debugfs (used to examine the internal structure of a filesystem, to
manually repair a corrupted filesystem, or to create test cases for
e2fsck), tune2fs (used to modify filesystem parameters), and most of
the other core ext2fs filesystem utilities.

You should install the e2fsprogs package if you need to manage the
performance of an ext2/3/4 filesystem.

%description -l ja
e2fsprogs パッケージには，ファイルシステムの作成/チェック/変更/修正など，
ext2/3/4 ファイルシステムに対する様々な操作を行うユーティリティが収めら
れています．e2fsck(正しくアンマウントされずにシャットダウンされた等して
破損したファイルシステムの不整合を修正する)，mke2fs (パーティションを初
期化してまっさらの ext2 ファイルシステムを作成する)，debugfs(ファイルシ
ステムの内部構造を直接参照して破損したファイルシステムを手で直したり 
e2fsck のテストケースを作りだしたりするのに使う)，tune2fs(ファイルシス
テムのパラメータを修正するのに使う)等，その他 ext2 ファイルシステム用基
本ユーティリティが収められています．

ext2/3/4 ファイルシステムのパフォーマンスをきちんと把握しておく為にも
e2fsprogs パッケージを是非インストールしておきましょう．


%package devel
Summary:     Ext2/3/4 filesystem-specific static libraries and headers.
Summary(ja): ext2/3/4 ファイルシステム特有のライブラリとヘッダ
Group:       Development/Libraries
Requires:    e2fsprogs = %{version}
Prereq:      install-info


%description devel
E2fsprogs-devel contains the libraries and header files needed to
develop ext2/3/4 filesystem-specific programs.

%description devel -l ja
e2fsprogs-devel には ext2/3/4 ファイルシステム固有のプログラムを開発する
のに必要なライブラリとヘッダファイルが収められています．


## to build compat32 for x86_64 architecture support
%package -n compat32-%{name}
Summary:     Utilities for managing ext2/3/4 filesystem.
Group:       System Environment/Base
%description -n compat32-%{name}
The e2fsprogs package contains a number of utilities for creating,
checking, modifying, and correcting any inconsistencies in ext2/3/4
filesystems. E2fsprogs contains e2fsck (used to repair filesystem 
inconsistencies after an unclean shutdown), mke2fs (used to initialize
a partition to contain an empty ext2 filesystem), debugfs (used to 
examine the internal structure of a filesystem, to manually repair 
a corrupted filesystem, or to create test cases for e2fsck), 
tune2fs (used to modify filesystem parameters), and most of the 
other core ext2fs filesystem utilities.

You should install the e2fsprogs package if you need to manage the
performance of an ext2/3/4 filesystem.

%package -n compat32-%{name}-devel
Summary:     Ext2/3/4 filesystem-specific static libraries and headers.
Group:       Development/Libraries
Requires:    compat32-%{name} = %{version}
%description -n compat32-%{name}-devel
E2fsprogs-devel contains the libraries and header files needed to
develop second extended (ext2) filesystem-specific programs.

You should install e2fsprogs-devel if you want to develop ext2
filesystem-specific programs. If you install e2fsprogs-devel, you'll
also want to install e2fsprogs.


%prep
%setup -q -n e2fsprogs-%{version}

# ignore some flag differences on primary/backup sb feature checks
# mildly unsafe but 'til I get something better, avoid full fsck
# after an selinux install...
%patch2 -p1 -b .featurecheck

%build
%configure --enable-elf-shlibs --enable-nls --disable-uuidd --disable-fsck \
           --disable-e2initrd-helper --disable-libblkid --disable-libuuid
make -C po update-po
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
export PATH=/sbin:$PATH

make install install-libs DESTDIR=$RPM_BUILD_ROOT INSTALL="%{__install} -p" \
	root_sbindir=%{_root_sbindir} root_libdir=%{_root_libdir}

chmod 644 $RPM_BUILD_ROOT%{_libdir}/*.a

%ifarch %{multilib_arches}
mv -f %{buildroot}%{_includedir}/ext2fs/ext2_types.h \
      %{buildroot}%{_includedir}/ext2fs/ext2_types-%{_arch}.h
install -p -m 644 %{SOURCE1} %{buildroot}%{_includedir}/ext2fs/ext2_types.h
%endif

%find_lang %{name}


%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%post devel
/sbin/install-info %{_infodir}/libext2fs.info.gz %{_infodir}/dir || :

%preun devel
if [ $1 = 0 ]; then
   /sbin/install-info --delete %{_infodir}/libext2fs.info.gz %{_infodir}/dir || :
fi
exit 0

%post -n compat32-%{name} -p /sbin/ldconfig
%postun -n compat32-%{name} -p /sbin/ldconfig


%files -f %{name}.lang
%defattr(-,root,root)
%doc README RELEASE-NOTES
%config(noreplace) %{_sysconfdir}/mke2fs.conf
%{_root_sbindir}/badblocks
%{_root_sbindir}/debugfs
%{_root_sbindir}/dumpe2fs
%{_root_sbindir}/e2fsck
%{_root_sbindir}/e2image
%{_root_sbindir}/e2label
%{_root_sbindir}/e2undo
%{_root_sbindir}/fsck.ext2
%{_root_sbindir}/fsck.ext3
%{_root_sbindir}/fsck.ext4
%{_root_sbindir}/fsck.ext4dev
%{_root_sbindir}/logsave
%{_root_sbindir}/mke2fs
%{_root_sbindir}/mkfs.ext2
%{_root_sbindir}/mkfs.ext3
%{_root_sbindir}/mkfs.ext4
%{_root_sbindir}/mkfs.ext4dev
%{_root_sbindir}/resize2fs
%{_root_sbindir}/tune2fs
%{_sbindir}/filefrag
%{_sbindir}/e2freefrag
%{_sbindir}/mklost+found

%{_root_libdir}/libcom_err.so.*
%{_root_libdir}/libe2p.so.*
%{_root_libdir}/libext2fs.so.*
%{_root_libdir}/libss.so.*

%{_bindir}/chattr
%{_bindir}/lsattr

%{_mandir}/man1/chattr.1*
%{_mandir}/man1/lsattr.1*

%{_mandir}/man5/e2fsck.conf.5*
%{_mandir}/man5/mke2fs.conf.5*

%{_mandir}/man8/badblocks.8*
%{_mandir}/man8/debugfs.8*
%{_mandir}/man8/dumpe2fs.8*
%{_mandir}/man8/e2fsck.8*
%{_mandir}/man8/e2undo.8*
%{_mandir}/man8/filefrag.8*
%{_mandir}/man8/e2freefrag.8*
%{_mandir}/man8/fsck.ext2.8*
%{_mandir}/man8/fsck.ext3.8*
%{_mandir}/man8/fsck.ext4.8*
%{_mandir}/man8/fsck.ext4dev.8*
%{_mandir}/man8/e2image.8*
%{_mandir}/man8/e2label.8*
%{_mandir}/man8/logsave.8*
%{_mandir}/man8/mke2fs.8*
%{_mandir}/man8/mkfs.ext2.8*
%{_mandir}/man8/mkfs.ext3.8*
%{_mandir}/man8/mkfs.ext4.8*
%{_mandir}/man8/mkfs.ext4dev.8*
%{_mandir}/man8/mklost+found.8*
%{_mandir}/man8/resize2fs.8*
%{_mandir}/man8/tune2fs.8*
      

%files devel
%defattr(-,root,root)
%{_infodir}/libext2fs.info*
%{_bindir}/compile_et
%{_bindir}/mk_cmds

%{_libdir}/libcom_err.a
%{_libdir}/libcom_err.so
%{_libdir}/libe2p.a
%{_libdir}/libe2p.so
%{_libdir}/libext2fs.a
%{_libdir}/libext2fs.so
%{_libdir}/libss.a
%{_libdir}/libss.so
%{_libdir}/pkgconfig/*.pc

%{_datadir}/et
%{_datadir}/ss
%{_includedir}/e2p
%{_includedir}/et
%{_includedir}/ext2fs
%{_includedir}/ss
%{_mandir}/man1/compile_et.1*
%{_mandir}/man1/mk_cmds.1*
%{_mandir}/man3/com_err.3*


%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%{_root_libdir}/libcom_err.so.*
%{_root_libdir}/libe2p.so.*
%{_root_libdir}/libext2fs.so.*
%{_root_libdir}/libss.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/libcom_err.a
%{_libdir}/libcom_err.so
%{_libdir}/libe2p.a
%{_libdir}/libe2p.so
%{_libdir}/libext2fs.a
%{_libdir}/libext2fs.so
%{_libdir}/libss.a
%{_libdir}/libss.so
%{_libdir}/pkgconfig/*.pc
%endif


%changelog
* Sun Feb 21 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1.41.10-1
- new upstream release

* Mon Oct 19 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.41.9-1
- new upstream release
- disable libuuid/uuidd/libblkid/fsck (replaced by util-linux-ng)

* Thu Jan 29 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.41.4-1
- new upstream release

* Sat Jan 17 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.41.3-2
- add Requires(pre): shadow-utils
- add Requires(post): chkconfig

* Tue Oct 14 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.41.3-1
- new upstream release

* Wed Sep 03 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.41.1-1
- new upstream release
- drop patch5 (merged in upstream)

* Sun Aug 17 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.41.0-1
- new upstream release
- drop patch4 (included in upstream)
- add e2undo and some ext4 related files in %%files section
- add patch5 to fix "mount -l" segmentation fault

* Fri Jul 11 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.40.10-1
- new upstream release

* Mon Apr 28 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.40.9-1
- new upstream release

* Fri Apr 25 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.40.8-1
- new upstream release
- drop unneeded patches
- update fedora patches

* Sat Dec 22 2007 NAKAMURA Kenta <kenta@vinelinux.org> 1.40.2-0vl3
- removed %%if !%%{build_compat32} case condition

* Mon Dec 10 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.40.2-0vl2
- add Patch100 for CVE-2007-5497 (see also <BTS:316>)

* Sun Dec 09 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1.40.2-0vl1
- new upstream release
- import fedora patches
- drop ext2resize(ext2online), online resize is now supported by resize2fs

* Thu Mar 09 2006 Shu KONNO <owa@bg.wakwak.com> 1.38-2vl2
- rebuilt for x86_64 architecture support
- added compat32-* packages for x86_64

* Sun Dec 11 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.38-2vl1
- new upstream release based on Fedora package
  * Thu Nov 10 2005 Thomas Woerner <twoerner@redhat.com> 1.38-2.1
  - fixed file conflicts between 32bit and 64bit packages (#168815)
  - fixed mklost+found crashes with buffer overflow (#157773)
    Thanks to Arjan van de Ven for the patch
  * Thu Sep  8 2005 Thomas Woerner <twoerner@redhat.com> 1.38-1
  - Close File descriptor for unregognized devices (#159878)
    Thanks to David Milburn for the patch.
    Merged from RHEL-4
  - enable tune2fs to set and clear feature resize_inode (#167816)
  - removed outdated information from ext2online man page (#164383)
  * Mon Sep  5 2005 Karel Zak <kzak@redhat.com> - 1.37-5
  - fix swsuspend partition detection (#165863)
  - fix revalidate from ext2 to ext3 (#162927)
  - fix vfat without magic detection (#161873)
  * Wed Sep  1 2004 Stephen C. Tweedie <sct@redhat.com> 1.35-9.4
  - Build and package ext2online during the e2fsprogs build

* Fri Jun 25 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.35-0vl2
- import Patch7 from fedora package to fix 'check after next mount'
  for filesystems with maximum mount count -1

* Sun Apr 18 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.35-0vl1
- new upstream release

* Mon Nov 17 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 1.34-0vl1
- new upstream release

* Sat May 24 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.33-2vl1
- syncd with rawhide

* Wed Nov 13 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 1.32-0vl1
- new upstream release

* Sun Sep 29 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 1.29-0vl1
- new upstream release 1.29

* Tue Mar 12 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.27-0vl1
- updated to new upstream bugfix release 1.27
  (the fix associated with Patch10 has been merged)
- added missing man pages

* Tue Mar 05 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.26-0vl2
- added Patch10 (upstream fix)

* Thu Feb 14 2002 Toru Sagami <sagami@vinelinux.org> 1.26-0vl1
- updated to current release 1.26 with minor spec fixes

* Sun Oct 28 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.25-0vl1
- updated to newest 1.25 release

* Fri Aug 31 2001 Toru Sagami <sagami@vinelinux.org>
- 1.24-0vl1: updated to 1.24

* Thu Aug 16 2001 <sagami@vinelinux.org>
- 1.23-0vl1: updated to 1.23 and added e2image files

* Fri Jul 13 2001 <sagami@vinelinux.org>
- 1.22-0vl1: updated to 1.22

* Sun Jun 17 2001 <sagami@vinelinux.org>
- 1.21-0vl1: updated to 1.21

* Sun Jun 10 2001 <sagami@vinelinux.org>
- 1.20-0vl1: updated to 1.20

* Sat May 19 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.19-4vl2
- added Japanese summary and description
- revamp spec file

* Wed May 09 2001 <sagami@vinelinux.org>
- 1.19-4vl1: in sync with RH 1.19-4
  * added some documant entries in %doc

* Fri Apr 06 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- add further IDE and SCSI disks to a hardcoded list in fsck #34190

* Tue Feb 27 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- require the main rpm from the devel rpm

* Thu Feb 22 2001 Helge Deller <hdeller@redhat.de>
- fix fsck -A bug (#21242)

* Mon Feb 12 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- fix bug with 16 byte long labels #27071

* Mon Sep 11 2000 Jeff Johnson <jbj@redhat.com>
- build for Red Hat 7.1.

* Tue Aug  8 2000 Jeff Johnson <jbj@redhat.com>
- merge LABEL patch.
- update to 1.19.

* Tue Jul 25 2000 Erik Troan <ewt@redhat.com>
- fixed LABEL handling

* Wed Jul 19 2000 Jakub Jelinek <jakub@redhat.com>
- rebuild to cope with glibc locale binary incompatibility

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Mon Jun 26 2000 Matt Wilson <msw@redhat.com>
- added resize2fs from the WIP snapshot

* Thu Jun 15 2000 Matt Wilson <msw@redhat.com>
- patched to build against linux 2.4 headers

* Mon Jun  5 2000 Jeff Johnson <jbj@redhat.com>
- FHS packaging.

* Fri Apr 28 2000 Bill Nottingham <notting@redhat.com>
- fix for ia64

* Sat Feb  5 2000 Bill Nottingham <notting@redhat.com>
- add install-info scripts

* Thu Feb 03 2000 Elliot Lee <sopwith@redhat.com>
- Fix bug #8585 (Y2K problems in debugfs)

* Wed Feb 02 2000 Jakub Jelinek <jakub@redhat.com>
- allow multiline errors in et, so that other programs
  can use compile_et (from Kerberos)

* Thu Jan 13 2000 Jeff Johnson <jbj@redhat.com>
- build 1.18 for 6.2.

* Tue Oct 26 1999 Bill Nottingham <notting@redhat.com>
- update to 1.17

* Mon Oct 25 1999 Bill Nottingham <notting@redhat.com>
- update to 1.16

* Thu Oct 21 1999 Bill Nottingham <notting@redhat.com>
- add patch to fix SIGUSR1 kills.

* Mon Oct 04 1999 Cristian Gafton <gafton@redhat.com>
- rebuild against new glibc in the sparc tree

* Thu Sep 23 1999 Jakub Jelinek <jakub@redhat.com>
- update mke2fs man page so that it reflects changes in mke2fs
  netweem 1.14 and 1.15

* Thu Aug  5 1999 Bill Nottingham <notting@redhat.com>
- fix lsattr on alpha

* Thu Jul 29 1999 Jeff Johnson <jbj@redhat.com>
- update to 1.15.

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 4)

* Tue Mar 16 1999 Cristian Gafton <gafton@redhat.com>
- fix fsck segfault

* Tue Feb  2 1999 Jeff Johnson <jbj@redhat.com>
- update to 1.14
- use %configure to generate config.sub on arm

* Thu Jan 14 1999 Jeff Johnson <jbj@redhat.com>
- fix /usr/bin/compile_et and doco for com_err.h (#673)

* Thu Jan 07 1999 Cristian Gafton <gafton@redhat.com>
- build with prefix=/usr
- add arm patch

* Mon Dec 28 1998 Jeff Johnson  <jbj@redhat.com>
- update to 1.13.

* Fri Aug 28 1998 Jeff Johnson <jbj@redhat.com>
- recompile statically linked binary for 5.2/sparc

* Mon Jul 13 1998 Jeff Johnson <jbj@redhat.com>
- upgrade to 1.12.

* Thu May 07 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Thu Apr 30 1998 Cristian Gafton <gafton@redhat.com>
- include <asm/types.h> to match kernel types in utils

* Tue Oct 14 1997 Donnie Barnes <djb@redhat.com>
- spec file cleanups

* Wed Oct 01 1997 Erik Troan <ewt@redhat.com>
- fixed broken llseek() prototype 

* Wed Aug 20 1997 Erik Troan <ewt@redhat.com>
- added patch to prototype llseek

* Tue Jun 17 1997 Erik Troan <ewt@redhat.com>
- built against glibc
