Skip to content

Commit

Permalink
Update for systemd
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Green committed Dec 8, 2017
1 parent f78ccea commit c0f8d0b
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 35 deletions.
File renamed without changes.
25 changes: 0 additions & 25 deletions Makefile

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion srpm/cron_update-motd → SOURCES/cron_update-motd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Delay a random time between 0 and 360 minutes (6 hours) to avoid having all
# instances update at the same time.
RANDOM_DELAY=360
@daily root /sbin/start --quiet update-motd
@daily root /usr/bin/systemctl --quiet restart update-motd
File renamed without changes.
11 changes: 11 additions & 0 deletions SOURCES/update-motd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Dynamically Generate Message Of The Day
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/update-motd
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
File renamed without changes.
File renamed without changes.
20 changes: 13 additions & 7 deletions srpm/update-motd.spec → SPECS/update-motd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ Group: System Environment/Base
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: bash coreutils
Requires: upstart
BuildRequires: systemd-devel
%{?systemd_requires}

Source0: sbin_update-motd
Source1: cron_update-motd
Source2: upstart_update-motd.conf
Source2: update-motd.service
Source3: yum_update-motd.py
Source4: yum_update-motd.conf

Expand All @@ -24,7 +25,7 @@ rm -rf %{buildroot}
install -d %{buildroot}/etc/update-motd.d
install -D -m 0755 %{SOURCE0} %{buildroot}/usr/sbin/update-motd
install -D -m 0644 %{SOURCE1} %{buildroot}/etc/cron.d/update-motd
install -D -m 0644 %{SOURCE2} %{buildroot}/etc/init/update-motd.conf
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/update-motd.service
install -D -m 0644 %{SOURCE3} %{buildroot}/usr/lib/yum-plugins/update-motd.py
install -D -m 0644 %{SOURCE4} %{buildroot}/etc/yum/pluginconf.d/update-motd.conf
# for %ghost
Expand All @@ -51,16 +52,21 @@ elif [ "$1" = "2" ]; then
ln -snf /var/lib/update-motd/motd /etc/motd
fi
fi
# We don't run update-motd on install because the various update-motd.d scripts
# are not installed yet (since their packages will depend on this one).
# This could also be the case in an upgrade situation, so we leave it to cron.
%systemd_post update-motd.service sshd.socket

%preun
%systemd_preun update-motd.service sshd.socket

%postun
%systemd_postun_with_restart update-motd.service


%files
%defattr(-,root,root,-)
%dir /etc/update-motd.d
%dir /var/lib/update-motd
%config /etc/cron.d/update-motd
%config /etc/init/update-motd.conf
%config %{_unitdir}/update-motd.service
%config /etc/yum/pluginconf.d/update-motd.conf
/usr/sbin/update-motd
/usr/lib/yum-plugins/update-motd.py*
Expand Down
2 changes: 0 additions & 2 deletions srpm/upstart_update-motd.conf

This file was deleted.

0 comments on commit c0f8d0b

Please sign in to comment.