Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix service name on FreeBSD/OPNsense #143

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
outPath: ${{ matrix.asset_name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz

- name: Upload release archive
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -134,7 +134,7 @@ jobs:

- name: Upload DEB
if: matrix.build != 'freebsd'
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -152,7 +152,7 @@ jobs:

- name: Upload RPM
if: matrix.build == 'linux'
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -165,12 +165,16 @@ jobs:
if: matrix.build == 'freebsd'
uses: defGuard/fpm-action@main
with:
fpm_args: "${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/local/sbin/defguard-gateway defguard-gateway.service.freebsd=/usr/local/etc/rc.d/defguard-gateway example-config.toml=/etc/defguard/gateway.toml.sample defguard-rc.conf=/etc/rc.conf.d/defguard-gateway"
fpm_args:
"${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/local/sbin/defguard-gateway
defguard-gateway.service.freebsd=/usr/local/etc/rc.d/defguard_gateway
example-config.toml=/etc/defguard/gateway.toml.sample
defguard-rc.conf=/etc/rc.conf.d/defguard_gateway"
fpm_opts: "--architecture ${{ matrix.arch }} --debug --output-type freebsd --version ${{ env.VERSION }} --package defguard-gateway_${{ env.VERSION }}_${{ matrix.target }}.pkg --freebsd-osversion '*'"

- name: Upload FreeBSD
if: matrix.build == 'freebsd'
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -185,9 +189,9 @@ jobs:
with:
fpm_args:
"${{ matrix.asset_name }}-${{ github.ref_name }}=/usr/local/sbin/defguard-gateway
defguard-gateway.service.freebsd=/etc/rc.d/defguard-gateway
defguard-gateway.service.freebsd=/usr/local/etc/rc.d/defguard_gateway
example-config.toml=/etc/defguard/gateway.toml.sample
defguard-rc.conf=/etc/rc.conf.d/defguard-gateway
defguard-rc.conf=/etc/rc.conf.d/defguard_gateway
opnsense/src/opnsense/mvc/app/controllers/OPNsense/DefguardGateway/=/usr/local/opnsense/mvc/app/controllers/OPNsense/DefguardGateway
opnsense/src/opnsense/mvc/app/models/OPNsense/DefguardGateway/=/usr/local/opnsense/mvc/app/models/OPNsense/DefguardGateway
opnsense/src/opnsense/mvc/app/views/OPNsense/DefguardGateway/=usr/local/opnsense/mvc/app/views/OPNsense/DefguardGateway
Expand All @@ -197,7 +201,7 @@ jobs:

- name: Upload OPNsense package
if: matrix.build == 'freebsd'
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
4 changes: 2 additions & 2 deletions defguard-gateway.service.freebsd
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

. /etc/rc.subr

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

defguard_start()
defguard_gateway_start()
{
${command} --config ${config} &
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ $( document ).ready(function() {

$("#startAct").click(function () {
stdDialogConfirm(
'{{ lang._("Confirm gateway restart") }}',
'{{ lang._("Do you want to restart Defguard Gateway?") }}',
'{{ lang._("Confirm gateway (re)start") }}',
'{{ lang._("Do you want to (re)start Defguard Gateway?") }}',
'{{ lang._("Yes") }}', '{{ lang._("Cancel") }}', function () {
$("#startAct").addClass("fa fa-spinner");
$("#responseMsg").removeClass("hidden");
ajaxCall(url="/api/defguardgateway/service/restart", sendData={}, callback=function(data,status) {
ajaxCall(url="/api/defguardgateway/service/restart", sendData={}, callback=function(data, status) {
$("#startAct").removeClass("fa fa-spinner fa-pulse");
$("#responseMsg").html(data['status']);
updateServiceControlUI("defguardgateway");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[start]
command:service defguard start
command:/usr/local/etc/rc.d/defguard_gateway start
parameters:
type:script
message:starting Defguard Gateway

[stop]
command:service defguard stop
command:/usr/local/etc/rc.d/defguard_gateway stop
parameters:
type:script
message:stopping Defguard Gateway

[restart]
command:service defguard restart
command:/usr/local/etc/rc.d/defguard_gateway restart
parameters:
type:script
message:restarting Defguard Gateway

[status]
command:service defguard status
command:/usr/local/etc/rc.d/defguard_gateway status
parameters:
type:script
message:Defguard Gateway
message:request Defguard Gateway status
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
config.toml:/etc/defguard/gateway.toml
rc.conf.d:/etc/rc.conf.d/defguard
rc.conf.d:/etc/rc.conf.d/defguard_gateway
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if helpers.exists("OPNsense.defguardgateway.general.Enabled") and OPNsense.defguardgateway.general.Enabled == '1' %}
defguard_enable="YES"
defguard_gateway_enable="YES"
{% else %}
defguard_enable="NO"
defguard_gateway_enable="NO"
{% endif %}