Skip to content

Commit

Permalink
Replace yunohost-firewall.service with an override on nftables.servic…
Browse files Browse the repository at this point in the history
…e to call yunohost hooks on start/reload
  • Loading branch information
Salamandar committed Dec 20, 2024
1 parent 574ae08 commit f666cc1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
14 changes: 0 additions & 14 deletions conf/yunohost/yunohost-firewall.service

This file was deleted.

8 changes: 8 additions & 0 deletions conf/yunohost/yunohost-nftables-hooks-override.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This override config calls yunohost hooks when nftables is started/reloaded

[Service]
ExecStart=yunohost hook callback post_nftables
ExecReload=yunohost hook callback post_nftables
# This one is legacy, apps should use the new post_nftables hook
ExecStart=yunohost hook callback post_iptable_rules
ExecReload=yunohost hook callback post_iptable_rules
8 changes: 4 additions & 4 deletions hooks/conf_regen/01-yunohost
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ do_init_regen() {
# YunoHost services
cp yunohost-api.service /etc/systemd/system/yunohost-api.service
cp yunohost-portal-api.service /etc/systemd/system/yunohost-portal-api.service
cp yunohost-firewall.service /etc/systemd/system/yunohost-firewall.service
cp yunoprompt.service /etc/systemd/system/yunoprompt.service

systemctl daemon-reload
Expand Down Expand Up @@ -278,8 +277,9 @@ ConditionVirtualization=!container
EOF
fi

# Delete legacy conflict between yunohost and nftables
mkdir -p ${pending_dir}/etc/systemd/system/nftables.service.d/
cp yunohost-nftables-hooks-override.conf ${pending_dir}/etc/systemd/system/nftables.service.d/yunohost-nftables-hooks.conf
# Delete legacy conflict between yunohost and nftables
touch ${pending_dir}/etc/systemd/system/nftables.service.d/ynh-override.conf

# Don't suspend computer on LidSwitch
Expand All @@ -293,9 +293,10 @@ EOF

cp yunohost-api.service ${pending_dir}/etc/systemd/system/yunohost-api.service
cp yunohost-portal-api.service ${pending_dir}/etc/systemd/system/yunohost-portal-api.service
cp yunohost-firewall.service ${pending_dir}/etc/systemd/system/yunohost-firewall.service
cp yunoprompt.service ${pending_dir}/etc/systemd/system/yunoprompt.service
cp proc-hidepid.service ${pending_dir}/etc/systemd/system/proc-hidepid.service
# Delete legacy yunohost-firewall service
touch ${pending_dir}/etc/systemd/system/yunohost-firewall.service

mkdir -p ${pending_dir}/etc/dpkg/origins/
cp dpkg-origins ${pending_dir}/etc/dpkg/origins/yunohost
Expand Down Expand Up @@ -359,7 +360,6 @@ do_post_regen() {
systemctl daemon-reload
systemctl restart systemd-logind
}
[[ ! "$regen_conf_files" =~ "yunohost-firewall.service" ]] || systemctl daemon-reload
[[ ! "$regen_conf_files" =~ "yunohost-api.service" ]] || systemctl daemon-reload
[[ ! "$regen_conf_files" =~ "yunohost-portal-api.service" ]] || systemctl daemon-reload

Expand Down

0 comments on commit f666cc1

Please sign in to comment.