Skip to content

Commit

Permalink
Add pacman hooks for systemd
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
  • Loading branch information
sirlucjan committed May 13, 2024
1 parent fa1c146 commit 1fbf4f4
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
19 changes: 19 additions & 0 deletions libalpm/systemd/90-scx-scheds-upgrade.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Trigger]
Type = Path
Operation = Upgrade
Target = etc/default/scx
Target = etc/systemd/journald@sched-ext.conf
Target = usr/bin/scx_*
Target = usr/lib/systemd/system/scx.service

[Trigger]
Type = Package
Operation = Upgrade
Target = scx-scheds
Target = scx-scheds-git

[Action]
Description = Checking scx_scheduler...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/scx-systemd-restart
NeedsTargets
4 changes: 4 additions & 0 deletions libalpm/systemd/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Install the 'scx-systemd-restart' file to the '/usr/share/libalpm/scripts' directory
install_data('scx-systemd-restart', install_dir: '/usr/share/libalpm/scripts')
# Install the '90-scx-scheds-upgrade.hook' file to the '/usr/share/libalpm/hooks' directory
install_data('90-scx-scheds-upgrade.hook', install_dir: '/usr/share/libalpm/hooks')
12 changes: 12 additions & 0 deletions libalpm/systemd/scx-systemd-restart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-only

# Check the status of the service
if systemctl is-active --quiet scx.service; then
echo "The service is active. Restarting..."
systemctl daemon-reload
systemctl restart scx.service
echo "Service has been restarted."
else
echo "The service is not active."
fi
6 changes: 6 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,9 @@ openrc = dependency('openrc', required: get_option('openrc'))
if openrc.found()
subdir('services/openrc')
endif

libalpm = dependency('libalpm', required: get_option('libalpm'))

if libalpm.found() and systemd.found()
subdir('libalpm/systemd')
endif
6 changes: 6 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ option(
value: 'auto',
description: 'openrc init.d service file'
)
option(
'libalpm',
type: 'feature',
value: 'auto',
description: 'install pacman hooks'
)

0 comments on commit 1fbf4f4

Please sign in to comment.