A new user interface for you! Read more...

File dd_rescue.spec of Package dd_rescue

#
# spec file for package ddrescue (Version 1.99_0.3.0)
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           dd_rescue
%define	ddrescuever 1.99.8
%define ddrhelpver 0.3.0
Version:        1.99_0.3.0
Release:        7
License:        GPL-2.0+
Group:          System/Base
# ddrescue was last used in openSUSE 11.4 (version 1.14_0.0.6)
Provides:       ddrescue = %{version}
Obsoletes:	ddrescue < %{version}
Autoreqprov:    on
Requires:       bc
%if 0%{?suse_version} >= 1100
Recommends:	libfallocate0
Recommends:	dd_rescue-lzo
Recommends:	dd_rescue-crypt
%endif
BuildRequires:	autoconf
BuildRequires:	libfallocate-devel 
BuildRequires:	libattr-devel
BuildRequires:	python
# dd_rhelp.test needs a few more
BuildRequires:	bc
BuildRequires:	util-linux
BuildRequires:	grep
BuildRequires:	openssl
%if 0%{?suse_version} > 0
BuildRequires:	libopenssl-devel
%else
BuildRequires:	openssl-devel
%endif
#%if 0%{?rhel_version} != 600
BuildRequires:	lzo-devel
#%endif
%if 0%{?suse_version} > 1210
BuildRequires:	lzop
%endif
%if 0%{?fedora_version} >= 19
BuildRequires:	lzop
%endif
%if 0%{?rhel_version} == 600 
# || 0%{?fedora_version} > 10
BuildRequires:  -libcom_err2
BuildRequires:  -libext2fs2
BuildRequires:	-e2fsprogs
%endif
Summary:        Data Recovery and Data Protection Tool
Url:		http://www.garloff.de/kurt/linux/ddrescue/
Source0:         http://www.garloff.de/kurt/linux/ddrescue/%{name}-%{ddrescuever}.tar.bz2
Source1:        http://garloff.de/ku3t/linux/ddrescue/%{name}-%{ddrescuever}.tar.bz2.asc
Source2:        %{name}.keyring
Source10:        dd_rhelp-%{ddrhelpver}.tar.gz
Source99:       %{name}.changes
Patch4:		dd_rhelp_EOF.diff
Patch5:		dd_rhelp_Summary.diff
Patch6:		dd_rhelp.test.diff
Patch7:		dd_r_version.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
dd_rescue helps when the situation is desperate: your disk has crashed 
and you try to copy it over to another one. While standard Unix tools 
like cp, cat, and dd will abort on every I/O error, dd_rescue does not.
It optimizes copying by using large blocks as long as no errors occur
and falls back to smaller blocks. It supports reverse direction copying
(to approach a bad spot from the top), sparse copying, preallocating
space, splice zerocopy, and bypassing the kernel pagecache with O_DIRECT.

dd_rescue also has some data protection functionality by (multiply)
overwriting files (or disks) with fast random numbers.

dd_rescue supports plugins; currently a hash, an lzo and a crypt plugin 
exist, supporting on the fly hash/HMAC calculation/validation, lzo
de/compression and de/encryption. The lzo plugin is packaged in the 
dd_rescue-lzo, the crypt plugin in the dd_rescue-crypt subpackage.

This RPM also bundles a helper script dd_rhelp from Lab Valentin that
intelligently controls dd_rescue to first copy all blocks from areas 
that work and only then tries to approach the bad spots from both 
sides.

Authors:
--------
    Kurt Garloff <kurt@garloff.de>
    Lab Valentin <vaab@free.fr>

%package crypt 
Summary: crypt plugin for dd_rescue
Group: System/Base
Requires: dd_rescue = %{version}

%description crypt
This plugin allows you do de/encrypt files during recovery copying
with dd_rescue using the AES family of algorithms. The plugin
supports various numbers of bits and rounds and uses the x86 AESNI
CPU support if available.

The plugin does offer a variety of options to handle the keys
and IVs including the generating keys from password and salt. 

The plugin is new as of 1.98 and it despite diligent testing it
might be careful to expect some bugs and future changes.

Authors:
--------
    Kurt Garloff <kurt@garloff.de>

%package lzo
Summary: LZO plugin for dd_rescue
Group: System/Base
Requires: dd_rescue = %{version}

%description lzo
This plugin allows you do de/compress files during recovery copying
with dd_rescue using the lzo family of algorithms. lzo algorithms
are very fast to decompress and most algorithms are very fast to
compress as well -- at the expense of somewhat worse compression than
zlib's deflate.

The plugin does offer a variety of options to handle corrupted .lzo
files with some grace; it does skip over bad blocks (if the block
headers are still intact) by default, but does offer an option (nodiscard)
to allow to attempt decompression on faulty input, hoping to produce
some usable bytes. It can also search for valid block headers after
synchronization has been lost due to a corrupt one.

The plugin also handles sparse files (files with holes) and supports
appending to .lzo files, so it fits neatly into dd_rescue.

Some fuzz testing has been applied to the plugin's decompression routines,
though more will have to be done to feel confident about feeding untrusted
data to the decompressor; the plugin is still young and might expose bugs.

Authors:
--------
    Kurt Garloff <kurt@garloff.de>

%prep
%setup -n dd_rescue-%{ddrescuever} -b10
./autogen.sh
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{SOURCE99} '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{SOURCE99} '+%%b %%e %%Y')
sed -i "s/__TIME__/\"$FAKE_BUILDTIME\"/g" dd_rescue.c
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/g" dd_rescue.c
# dd_rhelp
cd ../dd_rhelp-%{ddrhelpver}
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
for name in FAQ NEWS README THANKS TODO ChangeLog; do
	cp -p $name ${name}.dd_rhelp
done

%build
%if 0%{?suse_version} == 1230
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS -DDO_OWN_DETECT" LIBDIR=%{_libdir}
%else
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" LIBDIR=%{_libdir}
%endif
#cd ../dd_rhelp-%{ddrhelpver}

%install
make install DESTDIR=$RPM_BUILD_ROOT LIB=%{_lib} LIBDIR=%{_libdir} INSTASROOT= INSTALLFLAGS=
cd ../dd_rhelp-%{ddrhelpver}
#make install DESTDIR=$RPM_BUILD_ROOT bindir=/bin
install -m 0755 dd_rhelp $RPM_BUILD_ROOT/usr/bin/

%check
make %{?_smp_mflags} check
cd ../dd_rhelp-%{ddrhelpver}
export PATH=../dd_rescue-%{ddrescuever}:$PATH
%if 0%{?rhel_version} >= 500
alias which="type -p"
./dd_rhelp.test || true
%else
%if 0%{?suse_version} >= 1220
alias which="type -p"
./dd_rhelp.test || true
%else
./dd_rhelp.test
%endif
%endif

%files
%defattr(-,root,root)
/usr/bin/dd_rescue
/usr/bin/dd_rhelp
%{_libdir}/libddr_hash.so
%{_libdir}/libddr_MD5.so
%{_libdir}/libddr_null.so
%doc README.dd_rescue TODO
%doc ../dd_rhelp-%{ddrhelpver}/*.dd_rhelp
%doc ../dd_rhelp-%{ddrhelpver}/doc
%{_mandir}/man1/dd_rescue.1%{ext_man}

%files crypt
%defattr(-,root,root)
%{_mandir}/man1/ddr_crypt.1%{ext_man}
%{_libdir}/libddr_crypt.so
# I'd like to put those two files in dd_rescue docdir not separate
# but there does not seem to be a simple way ...
#% define %_docdir_fmt dd_rescue
%doc PADDING CRYPT_TODO

%files lzo
%defattr(-,root,root)
%{_mandir}/man1/ddr_lzo.1%{ext_man}
#%if 0%{?rhel_version} != 600
%{_libdir}/libddr_lzo.so
#%endif

%changelog
* Fri Oct 15 1999 - garloff@suse.de
- Initial release: 0.98.