File realcrypt.spec of Package realcrypt

#
# spec file for package realcrypt (Version 7.0a)
#

# norootforbuild

%define pkgn   TrueCrypt

Summary:	Free Open-Source Disk Encryption Software
Name:		realcrypt
Version:	7.0a
Release:	3.1
License:	TrueCrypt License v3.0
Group:		Productivity/Security
URL:		http://rpmfusion.org/Package/realcrypt
Source0:	%{pkgn}-%{version}-Source.tar.bz2
Source1:	%{name}.desktop
Source2:	Readme.txt
# Edited versions of images: license requests that all images be
# replaced in modified versions. These images are re-done completely,
# they share only the same dimensions with the originals. -AdamW
# 2008/08
Source11:	TrueCrypt_Wizard_real.bmp.bz2
Source12:	Textual_logo_96dpi_real.bmp.bz2
Source13:	Textual_logo_288dpi_real.bmp.bz2
Source14:	Drive_icon_96dpi_real.bmp.bz2
Source15:	Drive_icon_mask_96dpi_real.bmp.bz2
Source16:	Logo_288dpi_real.bmp.bz2
Source17:	Logo_96dpi_real.bmp.bz2
Source18:	System_drive_icon_96dpi_real.bmp.bz2
Source19:	System_drive_icon_mask_96dpi_real.bmp.bz2
Source20:	TrueCrypt-16x16_real.xpm.bz2
Source21:	Textual_logo_background_real.bmp.bz2
Source22:	%{name}_64.png.bz2
Source100:	%{name}.changes
Patch0:		%{name}-%{version}-rebranding.patch.bz2
### openSUSE 11.4 -thanks to Andreas Stieger
Patch1:         realcrypt-tc_token_err.patch
Patch2:         realcrypt-NULL_PTR-redefinition-warning.patch
Patch3:         realcrypt-undefined-operation-warning.patch
### openSUSE >= 12.2 has more strict requirements...
Patch4:         realcrypt-7.0a-add-ldl.patch

Buildroot:	%{_tmppath}/%{name}-%{version}-%{release}-root

PreReq:		pwdutils

Requires:	fuse device-mapper sudo
%if 0%{?suse_version} > 1130
Requires:       libwx_gtk2u_adv-2_8-0-wxcontainer
%endif

BuildRequires:  gcc-c++ fuse-devel pkcs11-helper-devel nasm update-desktop-files
%if 0%{?suse_version} > 1130
BuildRequires:  wxWidgets-wxcontainer-devel
%else
BuildRequires:  wxGTK-devel
%endif
BuildRequires: tar

# obsolete all older versions of truecrypt
Obsoletes:	truecrypt <  %{version}-%{release}
Provides:	truecrypt == %{version}-%{release}


%description
Based on TrueCrypt, freely available at http://www.truecrypt.org/.

RealCrypt is mainly just a rebrand to allow for modifications to take place,
functionality remains all the same. 

Main Features:
- Creates a virtual encrypted disk within a file and mounts it as a
  real disk.
- Encrypts an entire hard disk partition or a storage device such as
  USB flash drive.
- Encryption is automatic, real-time (on-the-fly) and transparent.
- Provides two levels of plausible deniability, in case an adversary
  forces you to reveal the password:
  1) Hidden volume (steganography).
  2) No RealCrypt volume can be identified (volumes cannot be
  distinguished from random data).
- Encryption algorithms: AES-256, Blowfish (448-bit key), CAST5,
  Serpent, Triple DES, and Twofish. Mode of operation: LRW (CBC
  supported as legacy).




%prep
%setup -q -n truecrypt-%{version}-source
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
# replace Readme.txt
%{__cp} %{SOURCE2} .

# Replace graphics which include the TrueCrypt logo
rm -f `find -name *.bmp`
rm -f ./Resources/Icons/TrueCrypt-16x16.xpm
rm -f ./Resources/Icons/TrueCrypt-48x48.xpm
rm -f ./Release/Setup\ Files/TrueCrypt\ User\ Guide.pdf
bzcat %{SOURCE11} > ./Format/TrueCrypt_Wizard.bmp
bzcat %{SOURCE12} > ./Common/Textual_logo_96dpi.bmp
bzcat %{SOURCE13} > ./Common/Textual_logo_288dpi.bmp
bzcat %{SOURCE14} > ./Mount/Drive_icon_96dpi.bmp
bzcat %{SOURCE15} > ./Mount/Drive_icon_mask_96dpi.bmp
bzcat %{SOURCE16} > ./Mount/Logo_288dpi.bmp
bzcat %{SOURCE17} > ./Mount/Logo_96dpi.bmp
bzcat %{SOURCE18} > ./Mount/System_drive_icon_96dpi.bmp
bzcat %{SOURCE19} > ./Mount/System_drive_icon_mask_96dpi.bmp
bzcat %{SOURCE20} > ./Resources/Icons/TrueCrypt-16x16.xpm
bzcat %{SOURCE21} > ./Common/Textual_logo_background.bmp

%build
CFLAGS="-Wall $RPM_OPT_FLAGS" \
PKCS11_INC="/usr/include/pkcs11-helper-1.0" \
%__make %{?_smp_flags} \
    NOSTRIP=1 \
    VERBOSE=1

%check
Main/%{name} --text --test

%install
%{__mkdir_p} $RPM_BUILD_ROOT%{_bindir}
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/{applications,pixmaps}
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32,48x48,64x64}/apps}
%{__install} -m 0755 Main/%{name} ${RPM_BUILD_ROOT}%{_bindir}

# icon and desktop file
bzcat %{SOURCE22} > $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
%__install -m 644 %{SOURCE1} %{buildroot}/%{_datadir}/applications/%{name}.desktop

%suse_update_desktop_file -n %{name} System Security GTK

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%post
if (grep 'realcrypt' /etc/group) &>/dev/null ; then
	echo '/etc/group already contains an entry for realcrypt'
	echo 'leaving /etc/group untouched'
	else
	echo 'Setting up group realcrypt ..... '
	/usr/sbin/groupadd realcrypt &>/dev/null || :
fi
echo 'Checking /etc/sudoers for realcrypt'
if (grep '%realcrypt' /etc/sudoers) &>/dev/null ; then
	echo '/etc/sudoers already contains a directive for realcrypt'
	echo 'leaving /etc/sudoers untouched' 
	else
	echo 'Configuring /etc/sudoers ....'
	echo '%realcrypt     ALL =  NOPASSWD: /usr/bin/realcrypt' >> /etc/sudoers
fi
echo 'If you want to use realcrypt without having to enter the root password'
echo 'when mounting/umounting a device, add the respective user(s) to the group "realcrypt" .....'

%postun
if [ "$1" = 0 ] ; then
	echo 'Removing group realcrypt ..... '
	/usr/sbin/groupdel realcrypt &>/dev/null || :
	echo 'Removing entry in /etc/sudoers .....'
	sed -i '/%realcrypt/d' /etc/sudoers
fi

%files
%defattr(-,root,root)
%doc License.{html,txt} Readme.txt
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

%changelog
* Sun May 20 2012 seife+obs@b1-systems.com
- fix factory build by adding -ldl explicitly to linker commandline
* Sat Dec  4 2010 AxelKoellhofer@web.de - 7.0a
- reenabled modified version of %%%%postun scriptlet
  This scriptlet now checks if there was a package upgrade and will
  (hopefully) not remove the sudoers-entry.
* Tue Nov 30 2010 packman@links2linux.de - 7.0a
- deactivated (at least temporarily) %%%%postun scriptlet as it removed the sudoers-entry on upgrade
  Thanks to Matthias Andree for reporting this bug
* Tue Nov 23 2010 packman@links2linux.de - 7.0a
- updated to 7.0a
- set wxGTK-devel as BuildRequire for all supported openSUSE versions
- added nasm to BuildRequires
* Sun Jul 18 2010 packman@links2linux.de - 6.3a
- fix BuildRequires for 11.3
* Wed Feb 17 2010 packman@links2linux.de - 6.3a
- some more fixes to the rebranding patch
  thx @Leigh from RPMfusion for cooperation on this
* Thu Feb 11 2010 packman@links2linux.de
- fixed faulty URL in rebranding patch
* Tue Feb  9 2010 packman@links2linux.de - 6.3a
- added post/postun scriptlets for sudo configuration
  and setup of the group realcrypt
* Mon Feb  8 2010 packman@links2linux.de - 6.3a
- initial Packman build
- updated to version 6.3a
- spec adapted to openSUSE
- rebranding.patch refreshed
- images repacked as .bz2
* Sat Oct 31 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.3-1
- update to 6.3 and fix rebranding patches
* Sun Jul 12 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2a-8
- replace README.txt
- fix for help menu (link to rpmfusion wiki)
* Fri Jul 10 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2a-7
- Add patch to remove user guide from menu (patch created by Stewart Adam)
- patch makefile to export APPNAME := realcrypt
- fix description
- add picture to TrueCrypt_Wizard_real.bmp
* Wed Jul  8 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2a-6
- rename truecrypt binary
* Wed Jul  8 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2a-5
- Change source to source0
- fix description
- merge truecrypt changelog
* Sat Jul  4 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2a-4
- temporary fix for help menu (link to mandriva wiki)
- fix some mistakes in spec file
- merge mandriva spec file by Adam Williamson and rebuild
  branding patch
- add -fno-strict-aliasing to C_CXX_FLAGS in patch
* Fri Jul  3 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2a-3
- make the recommended changes to the desktop file.
- change to 48x48 icon and convert it to .png
- add build requires ImageMagick
* Thu Jul  2 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2a-2
- correct licence version
- change summary
- add build requires desktop-file-utils
* Tue Jun 30 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2a-1
- update to version 6.2a
* Fri Jun 12 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2-4
- merge spec file from Dominik Mierzejewski (rpm@greysector.net)
* Fri Jun 12 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2-3
- use spec to add pkcs11.h, pkcs11f.h & pkcs11t.h
* Thu Jun 11 2009 Tom Griffiths <linuxtom68@gmail.com> - 6.2-2
- added PAM authentication support, to alleviate the need for use of sudo
* Thu Jun 11 2009 Leigh Scott <leigh123linux@googlemail.com> - 6.2-1
- update to 6.2
* Sun Dec  7 2008 Leigh Scott <leigh123linux@googlemail.com> - 6.1-1
- update to 6.1 , added pkcs11.h, pkcs11f.h & pkcs11t.h to source
* Thu Jul 10 2008 Leigh Scott <leigh123linux@googlemail.com> - 6.0a-2
- added menu laucher & icon
* Wed Jul  9 2008 Levente Farkas <lfarkas@lfarkas.org> - 6.0a-1
- update to 6.0a
* Tue Feb 19 2008 Levente Farkas <lfarkas@lfarkas.org> - 5.0-1
- update to 5.0a
* Tue Feb 12 2008 Levente Farkas <lfarkas@lfarkas.org> - 5.0-2
- update the build for x86_64 and text mode using Tom Horsley's patches from :
  http://home.att.net/~Tom.Horsley/tah-tc-5.0.tar.gz
* Thu Feb  7 2008 Levente Farkas <lfarkas@lfarkas.org> - 5.0-1
- Update to 5.0
openSUSE Build Service is sponsored by