diff --git a/fedora-sway-configs.spec.rpkg b/fedora-sway-configs.spec.rpkg new file mode 100644 index 0000000..81ccec4 --- /dev/null +++ b/fedora-sway-configs.spec.rpkg @@ -0,0 +1,80 @@ +# vim: ft=spec +Name: {{{ git_name }}} +Version: {{{ git_version }}} +Release: {{{ git_release }}}%{?dist} +Summary: Configuration files for Fedora Sway Spin + +License: MIT +URL: https://git.alebastr.su/alebastr/fedora-sway-configs +Source0: {{{ git_pack path=$(git rev-parse --show-toplevel) }}} + +BuildArch: noarch + +%description +%{summary}. + +%package -n sway-config-fedora +Summary: Configuration of Sway for Fedora Sway Spin +BuildArch: noarch +Requires: sway >= 1.7 +Provides: sway-config = %{version}-%{release} +Conflicts: sway-config + +# By default the Fedora background is used +# Weak dependency here may cause a swaynag warning during the configuration load +Requires: desktop-backgrounds-compat +# Lack of graphical drivers may hurt the common use case +Requires: mesa-dri-drivers +# Logind needs polkit to create a graphical session +Requires: polkit +# swaybg is used in the default config +Requires: swaybg +# dmenu (as well as rxvt any many others) requires XWayland on Sway +Requires: xorg-x11-server-Xwayland + +# Sway binds the terminal shortcut to one specific terminal. In our case foot +Recommends: foot +# grim is the recommended way to take screenshots on sway 1.0+ +Recommends: grim +# Dmenu is the default launcher in sway +Recommends: dmenu +# In addition, xargs is recommended for use in such a launcher arrangement +Recommends: findutils +# Install configs and scripts for better integration with systemd user session +Recommends: sway-systemd +# Both utilities are suggested in the default configuration +Recommends: swayidle +Recommends: swaylock + +# Minimal installation doesn't include Qt Wayland backend +Recommends: (qt5-qtwayland if qt5-qtbase-gui) +Recommends: (qt6-qtwayland if qt6-qtbase-gui) + +# Default config dependencies +Recommends: libnotify +Recommends: light +Recommends: playerctl +Recommends: pulseaudio-utils + +%description -n sway-config-fedora +%{summary}. + + +%prep +{{{ git_setup_macro path=$(git rev-parse --show-toplevel) }}} + + +%install +install -D -m 0644 -pv -t %{buildroot}%{_sysconfdir}/sway sway/config +install -D -m 0644 -pv -t %{buildroot}%{_sysconfdir}/sway/config.d sway/50-fedora.conf +install -D -m 0644 -pv -t %{buildroot}%{_datadir}/sway/config.d sway/config.d/* + + +%files -n sway-config-fedora +%license LICENSE +%config(noreplace) %{_sysconfdir}/sway/config +%config(noreplace) %{_sysconfdir}/sway/config.d/50-fedora.conf +%{_datadir}/sway/config.d + +%changelog +{{{ git_changelog }}} diff --git a/rpkg.conf b/rpkg.conf new file mode 100644 index 0000000..957dc05 --- /dev/null +++ b/rpkg.conf @@ -0,0 +1,2 @@ +[rpkg] +user_macros = "${git_props:root}/rpkg.macros" diff --git a/rpkg.macros b/rpkg.macros new file mode 100644 index 0000000..06a6bc3 --- /dev/null +++ b/rpkg.macros @@ -0,0 +1,36 @@ +#!/bin/bash +# vim ft:sh + +function git_tag { + git describe --tags --abbrev=0 2>/dev/null | head -n 1 +} + +function git_version { + tag="$(git_tag)" + tag_version="$(echo "$tag" | sed -E -n "s/^v?([^-]+)/\1/p")" + if [ -z "$tag_version" ]; then + tag_version=0 + fi + output "$tag_version" +} + +function git_release { + latest_tag="$(git_tag)" + if [ -n "$latest_tag" ]; then + commit_count="$(git rev-list "$latest_tag"..HEAD --count 2>/dev/null)" + commit_count=$(( commit_count + 1 )) + else + commit_count="$(git rev-list HEAD --count 2>/dev/null || printf 0)" + fi + if [ -n "$latest_tag" ] && [ "$commit_count" -eq 1 ]; then + output "0.1" + else + snap_date="$(date +%+4Y%m%d)" + shortcommit="$(git rev-parse --short HEAD)" + output "0.$commit_count.${snap_date}git${shortcommit}" + fi +} + +function git_dir_release { + git_release "$@" +}