File dd_rescue.spec of Package dd_rescue

# spec file for package dd_rescue
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           dd_rescue
Version:        1.99.7
Release:        0
Summary:        Data copying in the presence of I/O Errors
License:        GPL-2.0 or GPL-3.0
Group:          System/Base
Source2:        %{name}.keyring
Source99:       %{name}.changes
Patch0:         dd_rescue-openssl11.patch
BuildRequires:  autoconf
BuildRequires:  libattr-devel
%if 0%{?is_opensuse}
BuildRequires:  libfallocate-devel
BuildRequires:  lzo-devel
BuildRequires:  lzop
BuildRequires:  pkgconfig
BuildRequires:  python
Requires:       bc
Recommends:     dd_rescue-crypt
Recommends:     dd_rescue-lzo
Recommends:     dd_rhelp
Recommends:     libfallocate0
# ddrescue was last used in openSUSE 11.4 (version 1.14_0.0.6)
Provides:       ddrescue = %{version}
Obsoletes:      ddrescue < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  pkgconfig(libcrypto)

dd_rescue helps when nothing else can: 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.

dd_rescue has many other goodies; optimization by using large blocks
as long as no errors are in sight and falling back to small ones; reverse
direction copy; splice in-kernel zerocopy; O_DIRECT support; preallocation
with fallocate().

dd_rescue also provides data protection features by overwriting files
or disks with fast random numbers, optionally multiple times.

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.

%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.

%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.

%setup -q
if pkg-config --atleast-version=1.1.0 libssl; then
%patch0 -p1

# Remove build time references so build-compare can do its work
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

make RPM_OPT_FLAGS="%{optflags}" LIBDIR=%{_libdir} LIB=%{_lib} %{?_smp_mflags}

%make_install RPM_OPT_FLAGS="%{optflags}" INSTALLDIR=%{buildroot}/%{_bindir} LIB=%{_lib} LIBDIR=%{_libdir} \

mkdir %{buildroot}/bin
ln -sf %{_bindir}/dd_rescue %{buildroot}/bin

make %{?_smp_mflags} check

%doc COPYING README.dd_rescue TODO

%files crypt

%files lzo

openSUSE Build Service is sponsored by