Skip to content

Commit e8f6a0c

Browse files
authored
Merge pull request #6 from amazonlinux/dev
Introduce a switch to select yum or dnf to be used for yum-based distros
2 parents cc5ca50 + 0954807 commit e8f6a0c

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
DEST_DIR?=/
22
PREFIX?=/usr/bin
33
HOOK_DIR=
4-
DIST?=$(shell cut -d ":" -f6 /etc/system-release-cpe)
54

65
MAJOR=0
7-
MINOR=1
8-
RELEASE=1
6+
MINOR=2
97

10-
VERSION=$(MAJOR).$(MINOR)-$(RELEASE)
8+
VERSION=v$(MAJOR).$(MINOR)
119

1210
$(info Building version $(VERSION))
1311

@@ -16,7 +14,7 @@ $(info Building version $(VERSION))
1614
HOOK_DIR=/etc/dnf/plugins/post-transaction-actions.d
1715
HOOK_COMMAND=in
1816

19-
ifeq ($(PKG_MANAGER),yum)
17+
ifeq ($(pkg_manager),yum)
2018
HOOK_DIR=/etc/yum/post-actions
2119
HOOK_COMMAND=install
2220
endif

smart-restart.spec

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,52 @@
1+
%define _trivial .0
2+
%define _buildid .3
13
Name: smart-restart
2-
Version: 0.1
4+
Version: 0.2
35
Release: 1%{?dist}
46
Summary: Restarts services after the libs they link against have changed.
57

68
License: Apache 2.0
79

8-
%if "%{dist}" == ".amzn2023"
9-
Requires: dnf-utils
10-
Requires: dnf-plugin-post-transaction-actions
11-
%define _plugin_path dnf/plugins/post-transaction-actions.d/
10+
%if 0%{?amzn2}
11+
%bcond_without yum
1212
%else
13-
%if "%{dist}" == ".amzn2"
13+
%bcond_with yum
14+
%endif
15+
16+
%if %{with yum}
1417
Requires: yum-utils
1518
Requires: yum-plugin-post-transaction-actions
1619
%define _plugin_path yum/post-actions/
20+
%define pkg_manager yum
1721
%else
18-
%{error Distribution "%{expand:%{?dist}}" not supported}
19-
%endif
22+
Requires: dnf-utils
23+
Requires: dnf-plugin-post-transaction-actions
24+
%define _plugin_path dnf/plugins/post-transaction-actions.d/
25+
%define pkg_manager dnf
2026
%endif
2127

22-
Source: %{name}-%{version}-%{release}.tar.gz
28+
29+
URL: https://github.com/amazonlinux/smart-restart/archive/v%{version}/
30+
Source0: %{name}-v%{version}.tar.gz
31+
2332
%description
24-
Hooks dnf and automatically restarts services after updates to their dependencies
33+
Hooks dnf/yum and automatically restarts services after updates to their dependencies
2534

2635
%prep
27-
%setup -n %{name}-%{version}-%{release}
36+
%autosetup -n %{name}-v%{version}
2837

29-
$install
30-
# The makefile uses DNF as the default package manager, we can override with yum using PKG_MANAGER=yum
31-
make DEST_DIR=$RPM_BUILD_ROOT DIST=%{?dist} PREFIX=%{_bindir} install
38+
%install
39+
make DEST_DIR=$RPM_BUILD_ROOT pkg_manager=%{pkg_manager} PREFIX=%{_bindir} install
3240

3341

3442
%files
3543
%defattr(-,root,root,-)
3644
%{_bindir}/%{name}.sh
3745
%config %{_sysconfdir}/%{_plugin_path}/install.action
3846
%config %{_sysconfdir}/smart-restart-conf.d/default-denylist
39-
%doc /usr/share/man/man1/smart-restart.man1
40-
41-
# Update man db
42-
# %post
43-
# /usr/bin/mandb
47+
%doc %{_mandir}/man1/smart-restart.man1.gz
4448

49+
%changelog
50+
* Wed Mar 06 2024 Stanislav Uschakow <suschako@amazon.de> - 0.1-1.amzn2023.0.1
51+
- Initial release of smart-restart-v0.1-1 for al2023
4552

0 commit comments

Comments
 (0)