diff --git a/Makefile b/Makefile index 0f92670..a19c2eb 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,11 @@ DEST_DIR?=/ PREFIX?=/usr/bin HOOK_DIR= -DIST?=$(shell cut -d ":" -f6 /etc/system-release-cpe) MAJOR=0 -MINOR=1 -RELEASE=1 +MINOR=2 -VERSION=$(MAJOR).$(MINOR)-$(RELEASE) +VERSION=v$(MAJOR).$(MINOR) $(info Building version $(VERSION)) @@ -16,7 +14,7 @@ $(info Building version $(VERSION)) HOOK_DIR=/etc/dnf/plugins/post-transaction-actions.d HOOK_COMMAND=in -ifeq ($(PKG_MANAGER),yum) +ifeq ($(pkg_manager),yum) HOOK_DIR=/etc/yum/post-actions HOOK_COMMAND=install endif diff --git a/smart-restart.spec b/smart-restart.spec index 318fc29..68c60e1 100644 --- a/smart-restart.spec +++ b/smart-restart.spec @@ -1,34 +1,42 @@ +%define _trivial .0 +%define _buildid .3 Name: smart-restart -Version: 0.1 +Version: 0.2 Release: 1%{?dist} Summary: Restarts services after the libs they link against have changed. License: Apache 2.0 -%if "%{dist}" == ".amzn2023" -Requires: dnf-utils -Requires: dnf-plugin-post-transaction-actions -%define _plugin_path dnf/plugins/post-transaction-actions.d/ +%if 0%{?amzn2} +%bcond_without yum %else -%if "%{dist}" == ".amzn2" +%bcond_with yum +%endif + +%if %{with yum} Requires: yum-utils Requires: yum-plugin-post-transaction-actions %define _plugin_path yum/post-actions/ +%define pkg_manager yum %else -%{error Distribution "%{expand:%{?dist}}" not supported} -%endif +Requires: dnf-utils +Requires: dnf-plugin-post-transaction-actions +%define _plugin_path dnf/plugins/post-transaction-actions.d/ +%define pkg_manager dnf %endif -Source: %{name}-%{version}-%{release}.tar.gz + +URL: https://github.com/amazonlinux/smart-restart/archive/v%{version}/ +Source0: %{name}-v%{version}.tar.gz + %description -Hooks dnf and automatically restarts services after updates to their dependencies +Hooks dnf/yum and automatically restarts services after updates to their dependencies %prep -%setup -n %{name}-%{version}-%{release} +%autosetup -n %{name}-v%{version} -$install -# The makefile uses DNF as the default package manager, we can override with yum using PKG_MANAGER=yum -make DEST_DIR=$RPM_BUILD_ROOT DIST=%{?dist} PREFIX=%{_bindir} install +%install +make DEST_DIR=$RPM_BUILD_ROOT pkg_manager=%{pkg_manager} PREFIX=%{_bindir} install %files @@ -36,10 +44,9 @@ make DEST_DIR=$RPM_BUILD_ROOT DIST=%{?dist} PREFIX=%{_bindir} install %{_bindir}/%{name}.sh %config %{_sysconfdir}/%{_plugin_path}/install.action %config %{_sysconfdir}/smart-restart-conf.d/default-denylist -%doc /usr/share/man/man1/smart-restart.man1 - -# Update man db -# %post -# /usr/bin/mandb +%doc %{_mandir}/man1/smart-restart.man1.gz +%changelog +* Wed Mar 06 2024 Stanislav Uschakow - 0.1-1.amzn2023.0.1 +- Initial release of smart-restart-v0.1-1 for al2023