From 4ce1c834dfcd5cb864d0c2a6cc99610fbc3391e9 Mon Sep 17 00:00:00 2001 From: Mateusz Majewski Date: Thu, 17 Sep 2020 07:50:10 +0200 Subject: Alternativize shutdown command et al. Change-Id: I43030af64c1791ffbc99aeb3906a5517edbd3670 --- packaging/systemd.spec | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/packaging/systemd.spec b/packaging/systemd.spec index d183cfe9b7..8ebb8fc86d 100644 --- a/packaging/systemd.spec +++ b/packaging/systemd.spec @@ -305,8 +305,16 @@ install -m 755 -d %{buildroot}/%{_prefix}/lib/systemd/system rm -rf %{buildroot}/%{_docdir}/%{name} -# Allow replacing systemd-shutdown with tizen-specific variant +# Allow replacing systemd-shutdown and some scripts with tizen-specific variant mv %{buildroot}%{_prefix}/lib/systemd/systemd-shutdown %{buildroot}%{_prefix}/lib/systemd/systemd-shutdown-original +mv %{buildroot}%{_sbindir}/reboot %{buildroot}%{_sbindir}/reboot-original +mv %{buildroot}%{_sbindir}/halt %{buildroot}%{_sbindir}/halt-original +mv %{buildroot}%{_sbindir}/poweroff %{buildroot}%{_sbindir}/poweroff-original +mv %{buildroot}%{_sbindir}/shutdown %{buildroot}%{_sbindir}/shutdown-original +touch %{buildroot}%{_sbindir}/reboot +touch %{buildroot}%{_sbindir}/halt +touch %{buildroot}%{_sbindir}/poweroff +touch %{buildroot}%{_sbindir}/shutdown # Disable some useless services in Tizen rm -rf %{buildroot}/%{_prefix}/lib/systemd/system/sysinit.target.wants/dev-hugepages.mount @@ -448,6 +456,10 @@ if [ $1 -eq 0 ] ; then systemd-readahead-collect.service >/dev/null 2>&1 || : update-alternatives --remove systemd-shutdown %{_prefix}/lib/systemd/systemd-shutdown-original + update-alternatives --remove reboot %{_sbindir}/reboot-original + update-alternatives --remove halt %{_sbindir}/halt-original + update-alternatives --remove poweroff %{_sbindir}/poweroff-original + update-alternatives --remove shutdown %{_sbindir}/shutdown-original fi %posttrans @@ -458,6 +470,10 @@ fi # https://fedoraproject.org/wiki/Packaging:Scriptlets#Ordering if [ $1 -eq 0 ]; then update-alternatives --install %{_prefix}/lib/systemd/systemd-shutdown systemd-shutdown %{_prefix}/lib/systemd/systemd-shutdown-original 100 || : + update-alternatives --install %{_sbindir}/reboot reboot %{_sbindir}/reboot-original 100 || : + update-alternatives --install %{_sbindir}/halt halt %{_sbindir}/halt-original 100 || : + update-alternatives --install %{_sbindir}/poweroff poweroff %{_sbindir}/poweroff-original 100 || : + update-alternatives --install %{_sbindir}/shutdown shutdown %{_sbindir}/shutdown-original 100 || : fi %post -n libsystemd -p /sbin/ldconfig @@ -634,10 +650,14 @@ fi %{_prefix}/lib/tmpfiles.d/static-nodes-permissions.conf %{_prefix}/lib/tmpfiles.d/systemd-tmp.conf %{_sbindir}/init -%{_sbindir}/reboot -%{_sbindir}/halt -%{_sbindir}/poweroff -%{_sbindir}/shutdown +%ghost %{_sbindir}/reboot +%ghost %{_sbindir}/halt +%ghost %{_sbindir}/poweroff +%ghost %{_sbindir}/shutdown +%{_sbindir}/reboot-original +%{_sbindir}/halt-original +%{_sbindir}/poweroff-original +%{_sbindir}/shutdown-original %{_sbindir}/telinit %{_sbindir}/runlevel %{_sbindir}/udevadm -- cgit v1.2.3