diff --git a/package.json b/package.json index f7cabdd0..7ff4e118 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "defguard-client", "private": false, - "version": "1.6.3", + "version": "1.6.4", "type": "module", "scripts": { "dev": "npm-run-all --parallel vite typesafe-i18n", diff --git a/resources-linux/postinst b/resources-linux/postinst index 64779ffd..1dac4b2b 100644 --- a/resources-linux/postinst +++ b/resources-linux/postinst @@ -4,21 +4,43 @@ set -e GROUP_NAME="defguard" SERVICE_NAME="defguard-service" +# Get the name of user who is installing the client +get_installing_user() { + # Method 1: Check standard environment variables when installing with CLI + if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then + INSTALLING_USER="$SUDO_USER" + elif [ -n "$USER" ] && [ "$USER" != "root" ]; then + INSTALLING_USER="$USER" + fi + if [ -n "$INSTALLING_USER" ]; then + echo "$INSTALLING_USER" + return 0 + fi + + # Method 2: Check loginctl for latest session + SESSION_ID=$(loginctl show-seat seat0 -p ActiveSession --value) + username=$(loginctl show-session "$SESSION_ID" -p Name --value) + if [ -n "$username" ]; then + echo "$username" + return 0 + fi + + return 1 +} + case "$1" in 1|configure) # Create the group if it doesn't exist if ! getent group "$GROUP_NAME" >/dev/null; then groupadd --system "$GROUP_NAME" echo "Created group $GROUP_NAME" + else + echo "Group $GROUP_NAME exists already." fi # Determine target user - TARGET_USER="" - if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then - TARGET_USER="$SUDO_USER" - elif [ -n "$USER" ] && [ "$USER" != "root" ]; then - TARGET_USER="$USER" - fi + TARGET_USER=$(get_installing_user) + echo "Installation triggered by user $TARGET_USER" # Add user to group if we found a valid target if [ -n "$TARGET_USER" ]; then @@ -40,10 +62,14 @@ case "$1" in exit 1 fi fi + else + echo "User $TARGET_USER is not a valid target. Not adding the user to group $GROUP_NAME" fi # Handle systemd service if [ -d /run/systemd/system ]; then + echo "Updating systemd service $SERVICE_NAME" + # Reload systemd to recognize new service file systemctl daemon-reload @@ -58,6 +84,7 @@ case "$1" in abort-upgrade|abort-remove|abort-deconfigure) # On failed operations, ensure service is running if it should be if [ -d /run/systemd/system ]; then + echo "Restarting systemd service $SERVICE_NAME" systemctl daemon-reload if systemctl is-enabled "$SERVICE_NAME" >/dev/null 2>&1; then systemctl start "$SERVICE_NAME" || true diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 838d633e..d6b20f70 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -990,7 +990,7 @@ dependencies = [ [[package]] name = "common" -version = "1.6.3" +version = "1.6.4" dependencies = [ "nix", ] @@ -1363,7 +1363,7 @@ checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" [[package]] name = "defguard-client" -version = "1.6.3" +version = "1.6.4" dependencies = [ "anyhow", "async-stream", @@ -1433,7 +1433,7 @@ dependencies = [ [[package]] name = "defguard-dg" -version = "1.6.3" +version = "1.6.4" dependencies = [ "clap", "common", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 36519efc..b9503398 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -31,7 +31,7 @@ edition = "2021" homepage = "https://github.com/DefGuard/client" license-file = "../LICENSE.md" rust-version = "1.85" -version = "1.6.3" +version = "1.6.4" [package] name = "defguard-client" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f58453bc..a3a8cdd7 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -86,7 +86,7 @@ "productName": "Defguard", "mainBinaryName": "defguard-client", "identifier": "net.defguard", - "version": "1.6.3", + "version": "1.6.4", "app": { "security": { "capabilities": [ diff --git a/swift/extension/VPNExtension.xcodeproj/project.pbxproj b/swift/extension/VPNExtension.xcodeproj/project.pbxproj index f0d34342..f62b7893 100644 --- a/swift/extension/VPNExtension.xcodeproj/project.pbxproj +++ b/swift/extension/VPNExtension.xcodeproj/project.pbxproj @@ -322,7 +322,7 @@ ); LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MACOSX_DEPLOYMENT_TARGET = 13.5; - MARKETING_VERSION = 1.6.3; + MARKETING_VERSION = 1.6.4; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -417,7 +417,7 @@ ); LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MACOSX_DEPLOYMENT_TARGET = 13.5; - MARKETING_VERSION = 1.6.3; + MARKETING_VERSION = 1.6.4; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = net.defguard.VPNExtension;