Alternativize shutdown command et al. 80/244680/2
authorMateusz Majewski <m.majewski2@samsung.com>
Thu, 17 Sep 2020 05:50:10 +0000 (07:50 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Mon, 28 Sep 2020 13:49:50 +0000 (15:49 +0200)
Change-Id: I43030af64c1791ffbc99aeb3906a5517edbd3670

packaging/systemd.spec

index d183cfe..8ebb8fc 100644 (file)
@@ -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