File cryptctl.spec of Package cryptctl.3611
#
# spec file for package cryptctl
#
# Copyright (c) 2016 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/
#
Name: cryptctl
Version: 1.2.6
Release: 0
License: GPL-3.0
Summary: A utility for setting up LUKS-based disk encryption
Url: https://www.suse.com/products/sles-for-sap
Group: System/Management
Source0: %{name}-%{version}.tgz
Source1: rpmlintrc
BuildRequires: go systemd udev
Requires: btrfsprogs cryptsetup e2fsprogs rsync util-linux xfsprogs
ExclusiveArch: x86_64 ppc64le
%{?systemd_requires}
%define GONS gitlab.suse.de/guohouzuo
%define SRCDIR src/%{GONS}/%{name}
%description
A disk encryption utility that helps setting up LUKS-based disk encryption using
randomly generated keys, and keep all keys on a dedicated key server.
%prep
mkdir -p %{SRCDIR}
cd %{SRCDIR}
tar xf %{S:0}
%build
export GOPATH=$(pwd)
cd %{SRCDIR}
gzip ospackage/man/cryptctl.8
go build
%install
cd %{SRCDIR}
mkdir -p %{buildroot}/%{_sbindir}
install -m 0755 %{name} %{buildroot}/%{_sbindir}/
# Sysconfig files
mkdir -p %{buildroot}/%{_localstatedir}/adm/fillup-templates/
pushd ospackage/etc/sysconfig
for conf in *; do
install -m 0644 "$conf" "%{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.$conf"
done
popd
# One manual page
install -D -m 0644 ospackage/man/cryptctl.8.gz %{buildroot}/%{_mandir}/man8/cryptctl.8.gz
# Two systemd services
install -D -m 0644 ospackage/svc/cryptctl-auto-unlock@.service %{buildroot}/%{_unitdir}/cryptctl-auto-unlock@.service
install -D -m 0644 ospackage/svc/cryptctl-server.service %{buildroot}/%{_unitdir}/cryptctl-server.service
ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rccryptctl-server
# One udev rule
install -D -m 0644 ospackage/udev/99-cryptctl-auto-unlock.rules %{buildroot}/%{_libexecdir}/udev/rules.d/99-cryptctl-auto-unlock.rules
# Runtime and TLS certificate dir
install -d -m 0700 %{buildroot}/%{_localstatedir}/lib/%{name}
install -d -m 0700 %{buildroot}/%{_sysconfdir}/%{name}/servertls
%pre
%service_add_pre cryptctl-server.service
%post
%service_add_post cryptctl-server.service
%fillup_only -n cryptctl-server
%fillup_only -n cryptctl-client
%preun
%service_del_preun cryptctl-server.service
%postun
%service_del_postun cryptctl-server.service
%files
%defattr(-,root,root)
%config %{_localstatedir}/adm/fillup-templates/*
%dir %{_localstatedir}/lib/%{name}
%dir %{_sysconfdir}/%{name}/
%dir %{_sysconfdir}/%{name}/servertls
%{_sbindir}/%{name}
%{_sbindir}/rccryptctl-server
%{_mandir}/man8/*
%{_unitdir}/cryptctl-server.service
%{_unitdir}/cryptctl-auto-unlock@.service
%{_libexecdir}/udev/rules.d/99-cryptctl-auto-unlock.rules