From fc19402c0c2c93e1b46e8d36a6c3e1f63f1ad868 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Tue, 29 Oct 2024 14:09:36 +0100 Subject: [PATCH] Add RPM macros; moved from rpm-config-SUSE --- meson.build | 1 + rpm_macros/macros.permissions | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 rpm_macros/macros.permissions diff --git a/meson.build b/meson.build index b64dc2a..791aaf7 100644 --- a/meson.build +++ b/meson.build @@ -75,3 +75,4 @@ install_data(sources: 'zypper-plugin/permissions.py', install_dir: 'lib/zypp/plu install_data(sources: ['etc/variables.conf', 'etc/permissions', 'profiles/permissions.easy', 'profiles/permissions.secure', 'profiles/permissions.paranoid'], install_dir: 'share/permissions') install_data(sources: 'etc/permissions.local', install_dir: '/etc') install_subdir('permissions.d', install_dir: 'share/permissions') +install_data(sources: 'rpm_macros/macros.permissions', install_dir: 'lib/rpm/macros.d') diff --git a/rpm_macros/macros.permissions b/rpm_macros/macros.permissions new file mode 100644 index 0000000..9ae54e1 --- /dev/null +++ b/rpm_macros/macros.permissions @@ -0,0 +1,17 @@ + +%set_permissions(f:) \ + if [ -x /usr/bin/permctl ]; then \ + /usr/bin/permctl -n --set --system %{**} || : \ + elif [ -x /usr/bin/chkstat ]; then \ + /usr/bin/chkstat -n --set --system %{**} || : \ + fi \ + %nil + +%verify_permissions(e:f:) \ + if [ -x /usr/bin/permctl ]; then \ + /usr/bin/permctl -n --warn --system %{**} 1>&2 \ + else \ + /usr/bin/chkstat -n --warn --system %{**} 1>&2 \ + fi \ + %nil +