File john.spec of Package john
%define realname john
%define realver 1.8.0
%undefine extraver
%define srcext tar.xz
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
%if ! %{defined _rundir}
%define _rundir /var/run
%endif
# Common info
Name: %{realname}
Version: 1.8.0
Release: wiz%{?extraver:0.}1%{?dist}
License: GPL-2.0+
Group: Productivity/Security
URL: http://www.openwall.com/john/
Summary: Fast password cracker
# Build-time parameters
BuildRequires: pkgconfig xz
BuildRequires: yasm
BuildRequires: openssl-devel libpcap-devel gmp-devel
BuildRequires: ocl-icd-devel
BuildRequires: zlib-devel
%if 0%{?suse_version}
BuildRequires: libbz2-devel
BuildRequires: fdupes
%else
BuildRequires: bzip2-devel
%endif
# SLE 11 and older doesn't has support of pkgconfig in RPM
%if 0%{?sles_version}
BuildRequires: mozilla-nss-devel
%else
BuildRequires: pkgconfig(nss)
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source: http://www.openwall.com/john/j/%{realname}-%{version}%{?extraver}.%{srcext}
%description
John the Ripper is a fast password cracker. Its primary purpose is to detect
weak Unix passwords. Besides several crypt(3) password hash types most
commonly found on various Unix flavors, supported out of the box are
Kerberos/AFS and Windows LM hashes, as well as DES-based tripcodes, plus
many more hashes and ciphers in "community enhanced" -jumbo versions
and/or with other contributed patches.
The jumbo patch, which has been applied to this source tree of John the
Ripper, adds a lot of code, documentation, and data contributed by the
user community. This is not "official" John the Ripper code. It is
very easy for new code to be added to the jumbo patch: the quality
requirements are low. This means that you get a lot of functionality
that is not "mature" enough or is otherwise inappropriate for the
official JtR, which in turn also means that bugs in this code are to be
expected, etc.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%build
_CFLAGS='%{optflags}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro'
cd src
%{__sed} -ri 's|\$prefix/share/john|%{_sysconfdir}/john|' configure
%configure \
--disable-native-tests \
--with-systemwide \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
# Install completion rules for bash
## Disabled because of errors
##%{__install} -D -m644 run/john.bash_completion %{buildroot}/etc/bash_completion.d/john.sh
# Install binaries
for binfile in $(%{__make} -C src -p | awk -F= '/^PROJ / {print $2}'); do
if [ -L ${binfile#../} ]; then
%{__ln_s} -f john %{buildroot}%{_bindir}/${binfile#../run/}
else
%{__install} -D -m755 ${binfile#../} %{buildroot}%{_bindir}/${binfile#../run/}
fi
done
# Install character lists, rules and configs
%{__install} -d -m755 %{buildroot}%{_sysconfdir}/john
%{__install} -d -m755 %{buildroot}%{_datadir}/john
%{__install} -d -m755 %{buildroot}%{_datadir}/john/rules
for configs in run/*.conf; do
%{__install} -m644 ${configs} %{buildroot}%{_sysconfdir}/john/${configs#run/}
done
for chars in run/*.chr run/password.lst; do
%{__install} -m644 ${chars} %{buildroot}%{_datadir}/john/${chars#run/}
done
for rule in run/rules/*.rule; do
%{__install} -m644 ${chars} %{buildroot}%{_datadir}/john/${rule#run/}
done
# Fix paths
%{__sed} -ri \
-e '/^Wordlist/ s|\$JOHN|%{_datadir}/john|' \
-e '/^Statsfile/ s|\$JOHN|/var/lib/john|' \
-e '/^File/ s|\$JOHN|%{_datadir}/john|' \
%{buildroot}%{_sysconfdir}/john/john.conf
# OpenCL code
%{__install} -d -m755 %{buildroot}%{_datadir}/john/opencl
%{__cp} run/opencl/* %{buildroot}%{_datadir}/john/opencl/
%{__ln_s} ../../%{_datadir}/john/opencl %{buildroot}%{_sysconfdir}/john/
%{__ln_s} ../../%{_datadir}/john/rules %{buildroot}%{_sysconfdir}/john/
# Stats
%{__install} -d -m755 %{buildroot}/var/lib/john/
touch %{buildroot}/var/lib/john/stats
# Remove file duplicates
%if 0%{?suse_version}
%fdupes %{buildroot}%{_datadir}/john/
%endif
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc doc/* README.md
##%config(noreplace) /etc/bash_completion.d/john.sh
%dir %{_sysconfdir}/john/
%config(noreplace) %{_sysconfdir}/john/*.conf
%{_sysconfdir}/john/opencl
%{_sysconfdir}/john/rules
%{_bindir}/*
%dir %{_datadir}/john/
%{_datadir}/john/*
%dir %ghost %attr(0755,root,root) %{_rundir}/john/
%dir /var/lib/john/
%ghost /var/lib/john/stats
%changelog