Skip to content

Commit

Permalink
Build RPM package (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
moubctez authored Nov 28, 2024
1 parent 38219dd commit c559759
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,23 @@ jobs:
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev unzip protobuf-compiler libprotobuf-dev
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev unzip protobuf-compiler libprotobuf-dev rpm
- name: Build packages
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create RPM
run: |
rpmbuild --build-in-place --define "_topdir $(pwd)" --define "version ${{ env.VERSION }}" -bb resources-linux/defguard-client.spec
- name: Upload RPM
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: RPMS/${{ matrix.binary_arch }}/defguard-client-${{ env.VERSION }}-1.${{ matrix.binary_arch }}.rpm
asset_name: defguard-client-${{ env.VERSION }}-1.${{ matrix.binary_arch }}.rpm
asset_content_type: application/octet-stream
- name: Upload DEB
uses: actions/[email protected]
env:
Expand Down
41 changes: 41 additions & 0 deletions resources-linux/defguard-client.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Name: defguard-client
Version: %{version}
Release: 1%{?dist}
Summary: Defguard desktop client

License: Apache-2.0
URL: https://defguard.net/
Requires: libappindicator-gtk3 webkit2gtk4.0

%description
Desktop client for managing WireGuard VPN connections

%install
%{__mkdir} -p %{buildroot}/%{_bindir} %{buildroot}/%{_sbindir} %{buildroot}/%{_prefix}/lib/systemd/system
%{__install} -m 755 src-tauri/target/release/defguard-client %{buildroot}/%{_bindir}/
%{__install} -m 755 src-tauri/target/release/defguard-service %{buildroot}/%{_sbindir}/
%{__install} -m 644 resources-linux/defguard-service.service %{buildroot}/%{_prefix}/lib/systemd/system/

%post
# %{systemd_post} defguard-service.service
if [ $1 -eq 1 ]; then
systemctl daemon-reload
systemctl enable defguard-service.service
systemctl start defguard-service.service
fi

%preun
# %{systemd_preun} defguard-service.service
if [ $1 -eq 0 ]; then
systemctl stop defguard-service.service
systemctl disable defguard-service.service
fi

%postun
# %{systemd_postun} defguard-service.service
systemctl daemon-reload

%files
%{_bindir}/defguard-client
%{_sbindir}/defguard-service
%{_prefix}/lib/systemd/system/defguard-service.service
2 changes: 1 addition & 1 deletion src-tauri/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ fn close_service_handle(
// so `handle_connection_for_location` and `handle_connection_for_tunnel` are not
// partially duplicated here.
#[cfg(target_os = "windows")]
pub(crate) async fn sync_connections(app_handle: &AppHandle) -> Result<(), Error> {
pub async fn sync_connections(app_handle: &AppHandle) -> Result<(), Error> {
debug!("Synchronizing active connections with the systems' state...");
let appstate = app_handle.state::<AppState>();
let all_locations = Location::all(&appstate.db).await?;
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"resources": ["resources/*"],
"shortDescription": "",
"targets": ["deb", "app", "appimage"],
"targets": ["deb", "app"],
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
Expand Down

0 comments on commit c559759

Please sign in to comment.