File pmount.spec of Package pmount
#
# spec file for package pmount
#
# 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 http://bugs.opensuse.org/
#
%define tar_ver 0.9.99-alpha
Name: pmount
Version: 0.9.99alpha
Release: 0
Summary: Mount arbitrary hotpluggable devices as normal user
License: GPL-2.0+
Group: System/Base
Url: http://alioth.debian.org/projects/pmount
Source0: http://ftp.debian.org/debian/pool/main/p/%{name}/%{name}_%{tar_ver}.orig.tar.bz2
Source1: pmount-bash_completion
Source2: pmount-zsh_completion
Source3: README.SUSE
Source4: system-group-plugdev.conf
Patch0: %{name}-no_root_install.patch
Patch1: %{name}-fixes.patch
Patch2: %{name}-man-plugdev.diff
Patch3: %{name}-alpha-locale-regex.patch
BuildRequires: intltool
BuildRequires: libblkid-devel
BuildRequires: shadow
BuildRequires: sysuser-tools
Requires(pre): permissions
Suggests: cryptsetup
%sysusers_requires
%description
pmount ("policy mount") is a wrapper around the standard mount program which
permits normal users to mount removable devices without a matching %{_sysconfdir}/fstab
entry.
pmount also supports encrypted devices which use dm-crypt and have LUKS
metadata. If a LUKS-capable cryptsetup is installed, pmount will use it to
decrypt the device first and mount the mapped unencrypted device instead.
%lang_package
%prep
%setup -q -n %{name}-%{tar_ver}
%patch0 -p1
%patch1
%patch2 -p1
%patch3
%build
export CFLAGS="%{optflags} -fpie"
export LDFLAGS="-pie"
%configure
make %{?_smp_mflags}
%sysusers_generate_pre %{SOURCE4} plugdev system-group-plugdev.conf
%install
%make_install
%find_lang %{name}
mkdir %{buildroot}/media
install -Dm0644 %{SOURCE1} %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -Dm0644 %{SOURCE2} %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
install -Dm0644 %{SOURCE3} .
install -D -m 0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/system-group-plugdev.conf
%pre -f plugdev.pre
%post
%set_permissions %{_bindir}/pmount
%set_permissions %{_bindir}/pumount
%verifyscript
%verify_permissions -e %{_bindir}/pmount
%verify_permissions -e %{_bindir}/pumount
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING README README.devel README.SUSE TODO
%attr(4750 root plugdev) %{_bindir}/%{name}
%attr(4750 root plugdev) %{_bindir}/pumount
%config(noreplace) %{_sysconfdir}/%{name}.allow
%config(noreplace) %{_sysconfdir}/%{name}.conf
%dir /media
%{_mandir}/man1/%{name}.1%{ext_man}
%{_mandir}/man1/pumount.1%{ext_man}
%{_mandir}/man5/%{name}.conf.5%{ext_man}
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/bash-completion/completions/%{name}
%{_datadir}/zsh/site-functions/_%{name}
%{_sysusersdir}/system-group-plugdev.conf
%files lang -f %{name}.lang
%defattr(-,root,root)
%changelog