diff options
Diffstat (limited to 'testing/zapret/zapret.initd')
-rw-r--r-- | testing/zapret/zapret.initd | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testing/zapret/zapret.initd b/testing/zapret/zapret.initd new file mode 100644 index 00000000000..2be4cd3742b --- /dev/null +++ b/testing/zapret/zapret.initd @@ -0,0 +1,52 @@ +#!/sbin/openrc-run + +. "$ZAPRET_BASE"/init.d/sysv/functions + +extra_commands="start_fw stop_fw start_daemons stop_daemons" + +name="zapret" +description="DPI bypass toolkit" +description_start_fw="Apply firewall rules" +description_stop_fw="Remove firewall rules" +description_start_daemons="Run daemons" +description_stop_daemons="Stop daemons" + +depend() { + need net + use dns logger netmount +} + +start() { + start_daemons + [ "$INIT_APPLY_FW" != "1" ] || start_fw +} + +stop() { + stop_daemons + [ "$INIT_APPLY_FW" != "1" ] || stop_fw +} + +start_fw() { + ebegin "Applying firewall rules" + zapret_apply_firewall + eend $? "Failed to apply firewall rules" +} + +stop_fw() { + ebegin "Removing firewall rules" + zapret_unapply_firewall + eend $? "Failed to remove firewall rules" +} + +start_daemons() { + ebegin "Starting daemons" + zapret_run_daemons + eend $? "Failed to start daemons" +} + +stop_daemons() { + ebegin "Stopping daemons" + zapret_stop_daemons + eend $? "Failed to stop daemons" +} + |