Skip to content

Commit

Permalink
feat: create freeBSD service
Browse files Browse the repository at this point in the history
  • Loading branch information
dzania committed Aug 3, 2023
1 parent 39894c9 commit c0f877f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
if: matrix.build == 'freebsd'
uses: bpicode/github-action-fpm@master
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/sbin/defguard-gateway defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service example-config.toml=/etc/defguard/gateway.toml"
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/sbin/defguard-gateway defguard-gateway.service.freebsd=/usr/local/etc/rc.d/defguard example-config.toml=/etc/defguard/gateway.toml defguard-rc.conf=/etc/rc.conf.d/defguard"
fpm_opts: "--debug -t freebsd --version=${{ env.VERSION }} -p defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.txz"

- name: Upload freebsd
Expand Down
21 changes: 21 additions & 0 deletions defguard-gateway.service.freebsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
!/bin/sh

# PROVIDE: defguard
# REQUIRE: NETWORKING wireguard
# KEYWORD: shutdown

. /etc/rc.subr

name="defguard"
rcvar=defguard_enable
command="/usr/local/sbin/defguard-gateway"
config="/etc/defguard/gateway.toml"
start_cmd="${name}_start"

defguard_start()
{
${command} --config ${config} &
}

load_rc_config $name
run_rc_command "$1"
1 change: 1 addition & 0 deletions defguard-rc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defguard_enable="YES"

0 comments on commit c0f877f

Please sign in to comment.