mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
build(gui-client): add post-install and pre-remove scripts to the deb package (#5011)
Closes #4987 ```[tasklist] ### Before merging - [x] Get an x64 test VM on the Windows laptop and test a CI-built deb ```
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Dir where all the bundles are built
|
||||
BUNDLES_DIR=../target/release/bundle/deb
|
||||
|
||||
# Copy frontend dependencies
|
||||
cp node_modules/flowbite/dist/flowbite.min.js src/
|
||||
|
||||
@@ -11,5 +14,27 @@ pnpm tsc
|
||||
# Compile CSS
|
||||
pnpm tailwindcss -i src/input.css -o src/output.css
|
||||
|
||||
# Get rid of any existing debs, since we need to discover the path later
|
||||
rm -rf "$BUNDLES_DIR"
|
||||
|
||||
# Compile Rust and bundle
|
||||
pnpm tauri build
|
||||
|
||||
# Delete the deb that Tauri built. We're going to modify and rebuild it.
|
||||
rm "$BUNDLES_DIR"/*.deb
|
||||
|
||||
# There should be only one directory in `bundle/deb`, we need to modify
|
||||
# files inside that dir
|
||||
INTERMEDIATE_DIR=$(ls -d "$BUNDLES_DIR"/*/)
|
||||
|
||||
# Add the scripts
|
||||
cp src-tauri/deb_files/postinst src-tauri/deb_files/prerm "$INTERMEDIATE_DIR/control/"
|
||||
|
||||
pushd "$INTERMEDIATE_DIR"
|
||||
# Rebuild the control tarball
|
||||
tar -C "control" -czf "control.tar.gz" control md5sums postinst prerm
|
||||
|
||||
# Rebuild the deb package, and give it a predictable name that
|
||||
# `tauri-rename-ubuntu.sh` can fix
|
||||
ar rcs "../firezone-client-gui.deb" debian-binary control.tar.gz data.tar.gz
|
||||
popd
|
||||
|
||||
@@ -83,9 +83,7 @@ x86_64 only, see issue #2992. Best performed on a clean VM.
|
||||
## Un-install checklist (Linux)
|
||||
|
||||
1. Close the Firezone GUI
|
||||
1. Run `sudo systemctl stop firezone-client-ipc.service`
|
||||
1. Run `sudo apt-get remove firezone-client-gui`
|
||||
1. Run `sudo systemctl daemon-reload`
|
||||
|
||||
## Un-install checklist (Windows)
|
||||
|
||||
|
||||
15
rust/gui-client/src-tauri/deb_files/postinst
Executable file
15
rust/gui-client/src-tauri/deb_files/postinst
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: dpkg will call this after installing our files
|
||||
# This must be idempotent
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SERVICE_NAME="firezone-client-ipc"
|
||||
|
||||
# Creates the system group `firezone-client`
|
||||
sudo systemd-sysusers
|
||||
|
||||
echo "Starting and enabling Firezone IPC service..."
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable "$SERVICE_NAME"
|
||||
sudo systemctl restart "$SERVICE_NAME"
|
||||
9
rust/gui-client/src-tauri/deb_files/prerm
Executable file
9
rust/gui-client/src-tauri/deb_files/prerm
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: dpkg will call this after installing our files
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SERVICE_NAME="firezone-client-ipc"
|
||||
|
||||
sudo systemctl disable "$SERVICE_NAME"
|
||||
sudo systemctl stop "$SERVICE_NAME"
|
||||
@@ -17,7 +17,7 @@ ls ../target/release ../target/release/bundle/deb
|
||||
# Using a glob for the source, there will only be one exe and one deb anyway
|
||||
cp ../target/release/firezone-client-gui "$BINARY_DEST_PATH"
|
||||
cp ../target/release/firezone-gui-client.dwp "$BINARY_DEST_PATH.dwp"
|
||||
cp ../target/release/bundle/deb/*_amd64.deb "$BINARY_DEST_PATH.deb"
|
||||
cp ../target/release/bundle/deb/firezone-client-gui.deb "$BINARY_DEST_PATH.deb"
|
||||
# TODO: Debug symbols for Linux
|
||||
|
||||
function make_hash() {
|
||||
|
||||
@@ -9,19 +9,12 @@ set -euox pipefail
|
||||
# `apt-get` needs either a leading `./` or `/` to recognize a local file path
|
||||
DEB_PATH=$(realpath "$1")
|
||||
GROUP_NAME="firezone-client"
|
||||
SERVICE_NAME="firezone-client-ipc"
|
||||
|
||||
echo "Installing Firezone..."
|
||||
sudo apt-get install --yes "$DEB_PATH"
|
||||
|
||||
echo "Adding your user to the $GROUP_NAME group..."
|
||||
# Creates the system group `firezone-client`
|
||||
sudo systemd-sysusers
|
||||
sudo adduser "$USER" "$GROUP_NAME"
|
||||
|
||||
echo "Starting and enabling Firezone IPC service..."
|
||||
sudo systemctl enable "$SERVICE_NAME"
|
||||
sudo systemctl restart "$SERVICE_NAME"
|
||||
sudo usermod -a -G "$GROUP_NAME" "$USER"
|
||||
|
||||
# Check if the user is already in the group
|
||||
if ! groups | grep "$GROUP_NAME" &>/dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user