Run the background daemon in user context
This commit is contained in:
parent
1f1a291447
commit
183206b0a3
1 changed files with 31 additions and 10 deletions
|
@ -69,15 +69,36 @@ desktop-file-install --delete-original \
|
||||||
# << files
|
# << files
|
||||||
|
|
||||||
%posttrans
|
%posttrans
|
||||||
systemctl disable --now harbour-batterybuddy-oneshot.service
|
# Remove all service (new and old)
|
||||||
systemctl disable --now harbour-batterybuddy.service
|
systemctl stop %{name}-oneshot.service || true
|
||||||
cp %{_datadir}/%{name}/service/harbour-batterybuddy-oneshot.service /etc/systemd/system/
|
systemctl stop %{name}.service || true
|
||||||
cp %{_datadir}/%{name}/service/harbour-batterybuddy.service /etc/systemd/system/
|
su nemo -c "systemctl --user stop %{name}.service" || true
|
||||||
systemctl enable --now harbour-batterybuddy-oneshot.service
|
|
||||||
systemctl enable --now harbour-batterybuddy.service
|
systemctl disable %{name}-oneshot.service || true
|
||||||
|
systemctl disable %{name}.service || true
|
||||||
|
su nemo -c "systemctl --user disable %{name}.service" || true
|
||||||
|
|
||||||
|
rm %{_unitdir}/%{name}-oneshot.service || true
|
||||||
|
rm %{_unitdir}/%{name}.service || true
|
||||||
|
rm %{_userunitdir}/%{name}.service || true
|
||||||
|
|
||||||
|
# Install/update permission daemon (root)
|
||||||
|
cp %{_datadir}/%{name}/service/%{name}-oneshot.service %{_unitdir}/%{name}-oneshot.service
|
||||||
|
systemctl start %{name}-oneshot.service
|
||||||
|
systemctl enable %{name}-oneshot.service
|
||||||
|
|
||||||
|
# Install/update background daemon (nemo)
|
||||||
|
cp %{_datadir}/%{name}/service/%{name}.service %{_userunitdir}/%{name}.service
|
||||||
|
su nemo -c "systemctl --user start %{name}.service"
|
||||||
|
su nemo -c "systemctl --user enable %{name}.service"
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl reset-failed
|
||||||
|
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
systemctl disable --now harbour-batterybuddy-oneshot.service
|
su nemo -c "systemctl --user disable --now %{name}.service" || true
|
||||||
systemctl disable --now harbour-batterybuddy.service
|
systemctl disable --now %{name}-oneshot.service || true
|
||||||
rm /etc/systemd/system/harbour-batterybuddy-oneshot.service
|
rm %{_unitdir}/%{name}-oneshot.service
|
||||||
rm /etc/systemd/system/harbour-batterybuddy.service
|
rm %{_userunitdir}/%{name}.service
|
||||||
|
|
Loading…
Reference in a new issue