#
# Conditonal build:
-%bcond_with static # link cryptsetup statically
+%bcond_without initrd # don't build initrd version
+%bcond_without dietlibc # build initrd version with static glibc instead of dietlibc
+%bcond_without python # Python binding
#
+%define realname cryptsetup
Summary: LUKS for dm-crypt implemented in cryptsetup
-Summary(pl): LUKS dla dm-crypta zaimplementowany w cryptsetup
+Summary(pl.UTF-8): LUKS dla dm-crypta zaimplementowany w cryptsetup
Name: cryptsetup-luks
-Version: 1.0.4
+Version: 1.4.1
Release: 1
-License: GPL
+License: GPL v2
Group: Base
-Source0: http://luks.endorphin.org/source/%{name}-%{version}.tar.bz2
-# Source0-md5: 156ae6b618438ee9feeddc6c2bdc4e94
-Patch1: %{name}-nostatic.patch
-URL: http://luks.endorphin.org/about
-BuildRequires: autoconf
+#Source0Download: http://code.google.com/p/cryptsetup/downloads/list
+Source0: http://cryptsetup.googlecode.com/files/%{realname}-%{version}.tar.bz2
+# Source0-md5: 9253b3f29abf5c6f333eb74128b0df1c
+Source1: %{name}-initramfs-root-conf
+Source2: %{name}-initramfs-root-hook
+Source3: %{name}-initramfs-root-local-top
+Source4: %{name}-initramfs-passdev-hook
+Source5: %{name}-initramfs-README
+Patch0: %{name}-diet.patch
+Patch1: %{name}-dont-drag-more-libs.patch
+URL: http://code.google.com/p/cryptsetup/
+BuildRequires: autoconf >= 2.67
BuildRequires: automake
-BuildRequires: device-mapper-devel
-BuildRequires: gettext-devel
+BuildRequires: device-mapper-devel >= 1.02.03
+BuildRequires: gettext-devel >= 0.15
BuildRequires: libgcrypt-devel >= 1.1.42
BuildRequires: libselinux-devel
BuildRequires: libsepol-devel
+BuildRequires: libtool >= 2:2.0
BuildRequires: libuuid-devel
-BuildRequires: popt-devel
-BuildRequires: libtool
-%if %{with static}
+BuildRequires: popt-devel >= 1.7
+%if %{with python}
+BuildRequires: python-devel >= 1:2.4
+BuildRequires: rpm-pythonprov
+%endif
+%if %{with initrd}
+BuildRequires: libgpg-error-static
+ %if %{with dietlibc}
+BuildRequires: device-mapper-dietlibc
+BuildRequires: dietlibc-static
+BuildRequires: libgcrypt-dietlibc
+BuildRequires: libuuid-dietlibc
+BuildRequires: popt-dietlibc
+ %else
BuildRequires: device-mapper-static >= 1.02.07
BuildRequires: libgcrypt-static >= 1.1.42
-BuildRequires: libgpg-error-static
BuildRequires: libselinux-static
BuildRequires: libsepol-static
BuildRequires: libuuid-static
BuildRequires: popt-static
+ %endif
%endif
-Provides: cryptsetup = 0.2-1.pre1.8
+Requires: popt >= 1.7
+Provides: cryptsetup = %{version}
Obsoletes: cryptsetup
+Conflicts: udev < 1:118-1
+Conflicts: udev-core < 1:115
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _sbindir /sbin
This package contains implementation of LUKS for dm-crypt implemented
in cryptsetup.
-%description -l pl
-LUKS to nadchodz±cy standard linuksowego szyfrowania twardego dysku.
-Dostarczaj±c standardowy format danych na dysku nie tylko u³atwia
-utrzymanie kompatybilno¶ci miêdzy dystrybucjami, ale tak¿e dostarcza
-bezpieczne zarz±dzanie wieloma has³ami u¿ytkowników. W przeciwieñstwie
-do istniej±cego rozwi±zania LUKS przechowuje wszystkie potrzebne
-informacje o konfiguracji w nag³ówku partycji, pozwalaj±c
-u¿ytkownikowi przenosiæ lub migrowaæ dane w sposób przezroczysty.
+%description -l pl.UTF-8
+LUKS to nadchodzący standard linuksowego szyfrowania twardego dysku.
+Dostarczając standardowy format danych na dysku nie tylko ułatwia
+utrzymanie kompatybilności między dystrybucjami, ale także dostarcza
+bezpieczne zarządzanie wieloma hasłami użytkowników. W przeciwieństwie
+do istniejącego rozwiązania LUKS przechowuje wszystkie potrzebne
+informacje o konfiguracji w nagłówku partycji, pozwalając
+użytkownikowi przenosić lub migrować dane w sposób przezroczysty.
-Ten pakiet zawiera implementacjê LUKS dla dm-crytpa zaimplementowan± w
+Ten pakiet zawiera implementację LUKS dla dm-crytpa zaimplementowaną w
cryptsetup.
%package devel
Summary: Header files for cryptsetup library
-Summary(pl): Pliki nag³ówkowe biblioteki cryptsetup
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki cryptsetup
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: device-mapper-devel
Requires: libgcrypt-devel >= 1.1.42
-Provides: cryptsetup-devel
Obsoletes: cryptsetup-devel
%description devel
Header files for cryptsetup library.
-%description devel -l pl
-Pliki nag³ówkowe biblioteki cryptsetup.
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki cryptsetup.
%package static
Summary: Static cryptsetup library
-Summary(pl): Statyczna biblioteka cryptsetup
+Summary(pl.UTF-8): Statyczna biblioteka cryptsetup
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
-Provides: cryptsetup-static
Obsoletes: cryptsetup-static
%description static
Static version of cryptsetup library.
-%description static -l pl
+%description static -l pl.UTF-8
Statyczna wersja biblioteki cryptsetup.
+%package -n python-pycryptsetup
+Summary: Python binding for cryptsetup library
+Summary(pl.UTF-8): Wiązanie Pythona do biblioteki cryptsetup
+Group: Libraries/Python
+Requires: %{name}-libs = %{version}-%{release}
+%pyrequires_eq python-libs
+
+%description -n python-pycryptsetup
+Python binding for cryptsetup library.
+
+%description -n python-pycryptsetup -l pl.UTF-8
+Wiązanie Pythona do biblioteki cryptsetup.
+
+%package initrd
+Summary: LUKS for dm-crypt implemented in cryptsetup - initrd version
+Summary(pl.UTF-8): LUKS dla dm-crypta zaimplementowany w cryptsetup - wersja initrd
+Group: Base
+Requires: udev-initrd >= 1:115
+Conflicts: geninitrd < 10000.10
+
+%description initrd
+This package contains implementation of LUKS for dm-crypt implemented
+in cryptsetup - statically linked for initrd.
+
+%description initrd -l pl.UTF-8
+Ten pakiet zawiera implementację LUKS dla dm-crypta zaimplementowaną
+w cryptsetup - wersję statycznie zlinkowaną dla initrd.
+
+%package initramfs
+Summary: LUKS for dm-crypt implemented in cryptsetup - support scripts for initramfs-tools
+Summary(pl.UTF-8): LUKS dla dm-crypta zaimplementowany w cryptsetup - skrypty dla initramfs-tools
+Group: Base
+Requires: %{name} = %{version}-%{release}
+Requires: initramfs-tools
+
+%description initramfs
+LUKS for dm-crypt implemented in cryptsetup - support scripts
+for initramfs-tools.
+
+%description initramfs -l pl.UTF-8
+LUKS dla dm-crypta zaimplementowany w cryptsetup - skrypty dla
+initramfs-tools.
+
%prep
-%setup -q
+%setup -q -n %{realname}-%{version}
+%patch0 -p1
%patch1 -p1
+cp -a %{SOURCE5} README.initramfs
+
+%{__rm} po/stamp-po
+
%build
%{__gettextize}
-%{__autoheader}
+%{__libtoolize}
%{__aclocal} -I m4
%{__autoconf}
+%{__autoheader}
%{__automake}
+
+%if %{with initrd}
+CC="%{__cc}"
+%configure \
+%if %{with dietlibc}
%configure \
+ CC="diet ${CC#ccache } %{rpmcppflags} %{rpmcflags} %{rpmldflags} -Os" \
+ LIBS="-lcompat" \
+ ac_cv_lib_popt_poptConfigFileToString=yes \
+ ac_cv_lib_sepol_sepol_bool_set=no \
+ ac_cv_lib_selinux_is_selinux_enabled=no \
+%endif
+%if "%{?configure_cache}" == "1"
+ --cache-file=%{?configure_cache_file}%{!?configure_cache_file:configure}-initrd.cache \
+%endif
+ --disable-shared \
--enable-static \
- %{?with_static:--enable-static-cryptsetup}
+ --enable-static-cryptsetup \
+ --disable-udev \
+ --disable-nls
+
+%{__make} -C lib
+
+%if %{with dietlibc}
+# we have to do it by hand cause libtool "know better" and forces
+# static libs from /usr/lib
+CC="%{__cc}"
+diet ${CC#ccache } %{rpmcppflags} %{rpmcflags} %{rpmldflags} -Os -I. -I./lib -static \
+ -o cryptsetup-initrd src/cryptsetup.c ./lib/.libs/libcryptsetup.a \
+ -lpopt -lgcrypt -lgpg-error -ldevmapper -luuid -lcompat
+%else
+%{__make} -C src
+mv src/cryptsetup cryptsetup-initrd
+%endif
+
+%{__make} clean
+%endif
+
+%configure \
+ --enable-udev \
+ --enable-static \
+ %{?with_python:--enable-python}
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/{conf-hooks.d,hooks,scripts/local-top}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{_lib}
-mv -f $RPM_BUILD_ROOT%{_libdir}/libcryptsetup.so.*.*.* $RPM_BUILD_ROOT/%{_lib}
-ln -sf /%{_lib}/$(cd $RPM_BUILD_ROOT/%{_lib}; echo libcryptsetup.so.*.*.*) \
+mv -f $RPM_BUILD_ROOT%{_libdir}/libcryptsetup.so.* $RPM_BUILD_ROOT/%{_lib}
+ln -sf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/libcryptsetup.so.*.*.*) \
$RPM_BUILD_ROOT%{_libdir}/libcryptsetup.so
-%find_lang %{name}
+%if %{with initrd}
+install -d $RPM_BUILD_ROOT%{_libdir}/initrd
+install -p cryptsetup-initrd $RPM_BUILD_ROOT%{_libdir}/initrd/cryptsetup
+%endif
+
+install -p %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/conf-hooks.d/cryptsetup
+install -p %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/hooks/cryptroot
+install -p %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/scripts/local-top/cryptroot
+install -p %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/hooks/cryptpassdev
+
+%{?with_python:%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/pycryptsetup.{la,a}}
+
+%find_lang %{realname}
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
-%files -f %{name}.lang
+%files -f %{realname}.lang
%defattr(644,root,root,755)
-%doc ChangeLog
+%doc AUTHORS ChangeLog TODO
%attr(755,root,root) %{_sbindir}/cryptsetup
%attr(755,root,root) /%{_lib}/libcryptsetup.so.*.*.*
-%{_mandir}/man8/*
+%attr(755,root,root) %ghost /%{_lib}/libcryptsetup.so.4
+%{_mandir}/man8/cryptsetup.8*
%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libcryptsetup.so
%{_libdir}/libcryptsetup.la
-%{_includedir}/*.h
+%{_includedir}/libcryptsetup.h
+%{_pkgconfigdir}/libcryptsetup.pc
%files static
%defattr(644,root,root,755)
%{_libdir}/libcryptsetup.a
+
+%if %{with python}
+%files -n python-pycryptsetup
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py_sitedir}/pycryptsetup.so
+%endif
+
+%if %{with initrd}
+%files initrd
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/initrd/cryptsetup
+%endif
+
+%files initramfs
+%defattr(644,root,root,755)
+%doc README.initramfs
+%attr(755,root,root) %{_datadir}/initramfs-tools/conf-hooks.d/cryptsetup
+%attr(755,root,root) %{_datadir}/initramfs-tools/hooks/cryptroot
+%attr(755,root,root) %{_datadir}/initramfs-tools/hooks/cryptpassdev
+%attr(755,root,root) %{_datadir}/initramfs-tools/scripts/local-top/cryptroot