Browse Source

initial package creation

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 6 months ago
commit
d97de60b2a
  1. 63
      SOURCES/greetd-0.10.0-Unbundle-greetd_ipc.patch
  2. 251
      SPECS/greetd.spec

63
SOURCES/greetd-0.10.0-Unbundle-greetd_ipc.patch

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
From 6e7b5a796afb2342150c7995d57a817eae1bb939 Mon Sep 17 00:00:00 2001
From: Aleksei Bavshin <alebastr89@gmail.com>
Date: Sat, 20 Apr 2024 10:25:41 -0700
Subject: [PATCH greetd] Unbundle greetd_ipc

---
Cargo.toml | 2 +-
agreety/Cargo.toml | 2 +-
fakegreet/Cargo.toml | 2 +-
greetd/Cargo.toml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 6ce029c..35fa7f0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,4 +9,4 @@ incremental = false
codegen-units = 1
[workspace]
-members = ["inish", "greetd_ipc", "greetd", "agreety", "fakegreet"]
+members = ["inish", "greetd", "agreety", "fakegreet"]
diff --git a/agreety/Cargo.toml b/agreety/Cargo.toml
index 31457e1..ce49e4c 100644
--- a/agreety/Cargo.toml
+++ b/agreety/Cargo.toml
@@ -8,7 +8,7 @@ homepage = "https://kl.wtf/projects/agreety"
repository = "https://git.sr.ht/~kennylevinsen/greetd/"
[dependencies]
-greetd_ipc = { path = "../greetd_ipc", features = ["sync-codec"]}
+greetd_ipc = { version = "0.10.0", features = ["sync-codec"]}
inish = { path = "../inish"}
rpassword = "5.0"
getopts = "0.2"
diff --git a/fakegreet/Cargo.toml b/fakegreet/Cargo.toml
index a2e7e75..79fd76b 100644
--- a/fakegreet/Cargo.toml
+++ b/fakegreet/Cargo.toml
@@ -9,6 +9,6 @@ repository = "https://git.sr.ht/~kennylevinsen/greetd/"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
-greetd_ipc = { path = "../greetd_ipc", features = ["tokio-codec"] }
+greetd_ipc = { version = "0.10.0", features = ["tokio-codec"] }
tokio = { version = "1.5", features = ["process", "macros", "time", "net", "rt"] }
thiserror = "1.0"
diff --git a/greetd/Cargo.toml b/greetd/Cargo.toml
index ec0c6e6..73d32ef 100644
--- a/greetd/Cargo.toml
+++ b/greetd/Cargo.toml
@@ -15,7 +15,7 @@ nix = { version = "0.27", features = ["ioctl", "signal", "user", "fs", "mman"] }
pam-sys = "0.5.6"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
-greetd_ipc = { path = "../greetd_ipc", features = ["tokio-codec"] }
+greetd_ipc = { version = "0.10.0", features = ["tokio-codec"] }
inish = { path = "../inish" }
libc = "0.2"
tokio = { version = "1", features = ["net", "sync", "macros", "signal", "rt", "io-util", "time"] }
--
2.44.0

251
SPECS/greetd.spec

@ -0,0 +1,251 @@ @@ -0,0 +1,251 @@
## START: Set by rpmautospec
## (rpmautospec version 0.6.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 1;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global doc_commit 1bbd4fec
%global username greetd
%global selinuxtype targeted
%global forgeurl https://git.sr.ht/~kennylevinsen/greetd

%bcond_without check
%bcond_without selinux

Name: greetd
Version: 0.10.0
Release: %autorelease
Summary: A generic greeter daemon

# Apache-2.0
# Apache-2.0 OR BSL-1.0
# Apache-2.0 OR MIT
# GPL-3.0-only
# MIT
# MIT OR Apache-2.0
# Unlicense
License: GPL-3.0-only AND Apache-2.0 AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND MIT AND Unlicense
URL: https://kl.wtf/projects/greetd
Source0: %{forgeurl}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Better offline documentation file
Source1: %{forgeurl}-docs/blob/%{doc_commit}/index.md#/%{name}-docs-%{doc_commit}.md

# SELinux file labels
Source100: %{name}.fc
# Pam configs for greeter and user sessions
Source101: %{name}.pam
Source102: %{name}-greeter.pam
# User definition
Source103: %{name}.sysusers
# /var/lib/greetd contents and ownership
Source104: %{name}.tmpfiles

Patch: greetd-0.10.0-Unbundle-greetd_ipc.patch

Provides: service(graphical-login) = greetd

BuildRequires: cargo-rpm-macros >= 24
BuildRequires: make
BuildRequires: scdoc >= 1.10
BuildRequires: sed
BuildRequires: systemd-rpm-macros
%{?sysusers_requires_compat}

%if %{with selinux}
# This ensures that the *-selinux package and all it’s dependencies are not pulled
# into containers and other systems that do not use SELinux
Requires: (%{name}-selinux = %{version}-%{release} if selinux-policy-%{selinuxtype})
%endif

%description
greetd is a minimal and flexible login manager daemon
that makes no assumptions about what you want to launch.


%package fakegreet
Summary: Test utility for greeter development

%description fakegreet
fakegreet is a test utility that allows launching greeters
without greetd daemon.


%if %{with selinux}
# SELinux subpackage
%package selinux
Summary: SELinux policy for %{name}
BuildArch: noarch
Requires: selinux-policy-%{selinuxtype}
Requires(post): selinux-policy-%{selinuxtype}
BuildRequires: selinux-policy-devel
%{?selinux_requires}

%description selinux
Custom SELinux policy module for %{name}
%endif

%prep
%autosetup -p1
%cargo_prep
# patch greetd daemon user
sed -i 's/"greeter"/"%{username}"/' config.toml
# replace README with a better documentation file
cp %{SOURCE1} README.md


%generate_buildrequires
%cargo_generate_buildrequires


%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%make_build -C man

%if %{with selinux}
# SELinux policy
mkdir selinux
pushd selinux
# generate the type enforcement file as it has no other content
echo 'policy_module(%{name},1.0)' >%{name}.te
cp %{SOURCE100} %{name}.fc
make -f %{_datadir}/selinux/devel/Makefile %{name}.pp
bzip2 -9 %{name}.pp
popd
%endif


%install
for name in greetd agreety fakegreet; do
install -D -m755 -vp target/release/$name %{buildroot}%{_bindir}/$name
done
%make_install PREFIX=%{_prefix} -C man
install -D -m644 -vp greetd.service %{buildroot}%{_unitdir}/%{name}.service
install -D -m644 -vp config.toml %{buildroot}%{_sysconfdir}/%{name}/config.toml
install -D -m644 -vp %{SOURCE101} %{buildroot}%{_sysconfdir}/pam.d/%{name}
install -D -m644 -vp %{SOURCE102} %{buildroot}%{_sysconfdir}/pam.d/%{name}-greeter
install -D -m644 -vp %{SOURCE103} %{buildroot}%{_sysusersdir}/%{name}.conf
install -D -m644 -vp %{SOURCE104} %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -d -m750 -vp %{buildroot}%{_sharedstatedir}/%{name}

%if %{with selinux}
install -D -m 0644 -vp selinux/%{name}.pp.bz2 \
%{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2
%endif


%if %{with check}
%check
%cargo_test
%endif


%pre
%sysusers_create_compat %{SOURCE103}

%post
%systemd_post %{name}.service
# block unwanted systemd user services for greetd user
XDG_CONFIG_DIR=%{_sharedstatedir}/%{name}/.config
if [ ! -d $XDG_CONFIG_DIR/systemd ]; then
mkdir -p $XDG_CONFIG_DIR/systemd/user
ln -sf /dev/null $XDG_CONFIG_DIR/systemd/user/xdg-desktop-portal.service
chown -R %{username}:%{username} $XDG_CONFIG_DIR
fi
exit 0

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun %{name}.service

%if %{with selinux}
%pre selinux
# SELinux contexts are saved so that only affected files can be
# relabeled after the policy module installation
%selinux_relabel_pre -s %{selinuxtype}

%post selinux
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2
%selinux_relabel_post -s %{selinuxtype}

%postun selinux
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} %{name}
%selinux_relabel_post -s %{selinuxtype}
fi
%endif


%files
%license LICENSE
%license LICENSE.dependencies
%doc README.md
%attr(-,%{username},%{username}) %dir %{_sharedstatedir}/%{name}
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/config.toml
%config(noreplace) %{_sysconfdir}/pam.d/%{name}
%config(noreplace) %{_sysconfdir}/pam.d/%{name}-greeter
%{_bindir}/%{name}
%{_bindir}/agreety
%{_mandir}/man1/agreety.1*
%{_mandir}/man1/greetd.1*
%{_mandir}/man5/greetd.5*
%{_mandir}/man7/greetd-ipc.7*
%{_sysusersdir}/%{name}.conf
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/%{name}.service

%files fakegreet
%license LICENSE
%license LICENSE.dependencies
%{_bindir}/fakegreet

%if %{with selinux}
%files selinux
%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.*
%ghost %verify(not md5 size mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{name}
%endif

%changelog
## START: Generated by rpmautospec
* Sat Apr 20 2024 Aleksei Bavshin <alebastr@fedoraproject.org> - 0.10.0-1
- Update to 0.10.0 (#2276200)

* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Wed May 03 2023 Fabio Valentini <decathorpe@gmail.com> - 0.9.0-4
- Rebuild for tokio crate >= v1.24.2 (RUSTSEC-2023-0005)

* Sun Feb 05 2023 Fabio Valentini <decathorpe@gmail.com> - 0.9.0-3
- Rebuild for fixed frame pointer compiler flags in Rust RPM macros.

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Thu Jan 05 2023 Aleksei Bavshin <alebastr@fedoraproject.org> - 0.9.0-1
- Update to 0.9.0 (#2158656)
- Fix /var/lib/greetd ownership on ostree systems
- Convert to SPDX license format
- Drop patch for 1891682 - fixed in all supported releases.

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Tue May 03 2022 Aleksei Bavshin <alebastr@fedoraproject.org> - 0.8.0-1
- Initial import (#2052407)

## END: Generated by rpmautospec
Loading…
Cancel
Save