From 1aa69f73a2097ffa93a5b719104f22f1d491b5e2 Mon Sep 17 00:00:00 2001
From: Alexandr Stelnykovych <alexandr.stelnykovych@ivpn.net>
Date: Thu, 3 Apr 2025 17:45:11 +0300
Subject: [PATCH] [packaging] fix: remove leftover installer migration
 artifacts

---
 desktop/tauri/src-tauri/templates/nsis/install_hooks.nsh | 3 +++
 packaging/linux/postinst                                 | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/desktop/tauri/src-tauri/templates/nsis/install_hooks.nsh b/desktop/tauri/src-tauri/templates/nsis/install_hooks.nsh
index 7e79cdd6..d198be9c 100644
--- a/desktop/tauri/src-tauri/templates/nsis/install_hooks.nsh
+++ b/desktop/tauri/src-tauri/templates/nsis/install_hooks.nsh
@@ -173,6 +173,9 @@ var dataDir
   Delete /REBOOTOK "$COMMONPROGRAMDATA\Portmaster\intel\news.yaml"
   RMDir /r /REBOOTOK "$COMMONPROGRAMDATA\Portmaster\intel"
 
+  ; Remove PMv1 migration flag
+  Delete /REBOOTOK "$COMMONPROGRAMDATA\Safing\Portmaster\migrated.txt"
+
   ${If} $DeleteAppDataCheckboxState = 1
     RMDir /r /REBOOTOK "$COMMONPROGRAMDATA\Portmaster"
     RMDir /r /REBOOTOK "$COMMONPROGRAMDATA\Safing"
diff --git a/packaging/linux/postinst b/packaging/linux/postinst
index c99f8b4c..a54ee8e5 100644
--- a/packaging/linux/postinst
+++ b/packaging/linux/postinst
@@ -28,6 +28,9 @@ if [ -d "$OLD_INSTALLATION_DIR" ]; then
         echo "[ ] V1 migration: Removing V1 shortcuts"
         rm /etc/xdg/autostart/portmaster_notifier.desktop
         rm /usr/share/applications/portmaster_notifier.desktop
+        # app V1 shortcut
+        # NOTE: new V2 shortcut registered as "Portmaster.desktop" (first letter uppercase), so we can distinguish between V1 and V2 shortcuts.
+        rm /usr/share/applications/portmaster.desktop 
 
         # Remove V1 files (except configuration)
         # (keeping V1 configuration for a smooth downgrade, if needed)