File deckrypt.spec of Package deckrypt

#
# spec file for package deckrypt
#
# Copyright (c) 2024 Tobias Görgens
#
# 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.

Name:           deckrypt
Version:        0.4.4
Release:        0
Summary:        Unlock a LUKS-encrypted root partition with game controller combinations
License:        GPL-3.0
URL:            https://github.com/TobiPeterG/deckrypt
Source0:        %{name}-%{version}.tar.xz
Source1:        vendor.tar.zst
BuildRequires:  cargo
BuildRequires:  cargo-packaging
BuildRequires:  rust
BuildRequires:  libevdev-devel
BuildRequires:  kbd-devel
BuildRequires:  pkgconfig
BuildRequires:  rpm-config-SUSE
BuildRequires:  pkgconfig(dracut)
BuildRequires:  pkgconfig(libudev)

%description
Unlock a LUKS-encrypted root partition with game controller combinations.
This is meant for people who want full disk encryption for devices like the Steam Deck.
It consists of a Rust program that translates game controller combinations to a character sequence
and then induces events as if the sequence was typed on a real keyboard.
This sequence can then be added to a LUKS slot.
The advantage of this approach is that you can either use a controller combination
to unlock the device or a regular password/keyboard.

%prep
%autosetup -p1 -a1

%build
%{cargo_build}

%check
cargo test --release

%install
install -D -m 0755 target/release/deckrypt %{buildroot}%{_bindir}/deckrypt
mkdir -p %{buildroot}%{_prefix}/lib/dracut/modules.d/50deckrypt
for i in $(find dracut -type f); do
    cp "$i" %{buildroot}%{_prefix}/lib/dracut/modules.d/50deckrypt
done

mkdir -p %{buildroot}%{_prefix}/share/deckrypt
for i in $(find configs -type f); do
    cp "$i" %{buildroot}%{_prefix}/share/deckrypt
done

mkdir -p %{buildroot}/etc/deckrypt

%post
%{?regenerate_initrd_post}

%posttrans
%{?regenerate_initrd_posttrans}

%postun
%{?regenerate_initrd_post}


%files
%license LICENSE
%doc README.md
%dir %{_prefix}/lib/dracut
%dir %{_prefix}/lib/dracut/modules.d
%dir /etc/deckrypt
%{_prefix}/lib/dracut/modules.d/50deckrypt
%{_prefix}/share/deckrypt
%{_bindir}/deckrypt

%changelog

openSUSE Build Service is sponsored by