From d521cad48512fec7f5d25d0d3c3b346a040fdffa Mon Sep 17 00:00:00 2001
From: Adam Thorn <alt36@cam.ac.uk>
Date: Tue, 18 Feb 2025 13:56:12 +0000
Subject: [PATCH 1/5] mathematica -> 14.2.0

---
 packages/mathematica.xml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/packages/mathematica.xml b/packages/mathematica.xml
index 10c3acf0..25160a70 100755
--- a/packages/mathematica.xml
+++ b/packages/mathematica.xml
@@ -3,7 +3,7 @@
 
   <package id="mathematica" name="Mathematica" revision="%version%.1" reboot="false" priority="0">
     <variable name="major" value="14" />
-    <variable name="minor" value="1" />
+    <variable name="minor" value="2" />
     <variable name="sub" value="0" />
     <variable name="version" value="%major%.%minor%.%sub%" />
     <check type="uninstall" condition="versiongreaterorequal" path="Wolfram %major%.+" value="%version%" />
@@ -44,6 +44,12 @@
       </condition>
     </remove>
 
+    <remove cmd='"%ProgramFiles%\Wolfram Research\Mathematica\14.1\SystemFiles\UninstallFiles\Windows\unins000.exe" /VERYSILENT /suppressmsgboxes'>
+      <condition>
+        <check type="file" condition="exists" path="%ProgramFiles%\Wolfram Research\Mathematica\14.1\SystemFiles\UninstallFiles\Windows\unins000.exe" />
+      </condition>
+    </remove>
+
       <!-- Uninstall this Mathematica -->
     <remove cmd='"%ProgramFiles%\Wolfram Research\Wolfram\%major%.%minor%\SystemFiles\UninstallFiles\Windows\unins000.exe" /VERYSILENT /suppressmsgboxes'>
       <condition>
-- 
GitLab


From 04c371d181b658a34e3891106f4733ea0592430e Mon Sep 17 00:00:00 2001
From: Adam Thorn <alt36@cam.ac.uk>
Date: Wed, 19 Feb 2025 11:00:26 +0000
Subject: [PATCH 2/5] mathematica: fix commands to remove v14.1

---
 packages/mathematica.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/mathematica.xml b/packages/mathematica.xml
index 25160a70..5ae72068 100755
--- a/packages/mathematica.xml
+++ b/packages/mathematica.xml
@@ -44,9 +44,9 @@
       </condition>
     </remove>
 
-    <remove cmd='"%ProgramFiles%\Wolfram Research\Mathematica\14.1\SystemFiles\UninstallFiles\Windows\unins000.exe" /VERYSILENT /suppressmsgboxes'>
+    <remove cmd='"%ProgramFiles%\Wolfram Research\Wolfram\14.1\SystemFiles\UninstallFiles\Windows\unins000.exe" /VERYSILENT /suppressmsgboxes'>
       <condition>
-        <check type="file" condition="exists" path="%ProgramFiles%\Wolfram Research\Mathematica\14.1\SystemFiles\UninstallFiles\Windows\unins000.exe" />
+        <check type="file" condition="exists" path="%ProgramFiles%\Wolfram Research\Wolfram\14.1\SystemFiles\UninstallFiles\Windows\unins000.exe" />
       </condition>
     </remove>
 
-- 
GitLab


From 8b38832b6ff7f751c05568b8018ac3f38e98f595 Mon Sep 17 00:00:00 2001
From: Adam Thorn <alt36@cam.ac.uk>
Date: Wed, 19 Feb 2025 11:00:41 +0000
Subject: [PATCH 3/5] mathematica: use more specific uninstall check

This changed when they rebranded the package from "Mathematica" to
"Wolfram". I suspect I stuck with a more generic pattern when it wasn't
yet clear what the new naming conventions were going to be.
---
 packages/mathematica.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/mathematica.xml b/packages/mathematica.xml
index 5ae72068..c21d9393 100755
--- a/packages/mathematica.xml
+++ b/packages/mathematica.xml
@@ -6,7 +6,7 @@
     <variable name="minor" value="2" />
     <variable name="sub" value="0" />
     <variable name="version" value="%major%.%minor%.%sub%" />
-    <check type="uninstall" condition="versiongreaterorequal" path="Wolfram %major%.+" value="%version%" />
+    <check type="uninstall" condition="versiongreaterorequal" path="Wolfram %major%.%minor%.+" value="%version%" />
 
     <install cmd='%WPKGSOFTWARE%\wolfram\mathematica\%version%\setup.exe /verysilent /suppressmsgboxes' />
 
-- 
GitLab


From f0429a4c141971989ec80c5d2e0f7f66f898581a Mon Sep 17 00:00:00 2001
From: Adam Thorn <alt36@cam.ac.uk>
Date: Wed, 19 Feb 2025 11:04:22 +0000
Subject: [PATCH 4/5] mathematica: also uninstall wolframscript

---
 packages/mathematica.xml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/packages/mathematica.xml b/packages/mathematica.xml
index c21d9393..1959e58c 100755
--- a/packages/mathematica.xml
+++ b/packages/mathematica.xml
@@ -56,6 +56,8 @@
         <check type="file" condition="exists" path="%ProgramFiles%\Wolfram Research\Wolfram\%major%.%minor%\SystemFiles\UninstallFiles\Windows\unins000.exe" />
       </condition>
     </remove>
+    <!-- uninstall wolframscript -->
+    <remove cmd='msiexec /qn /x {2DF07200-A7A7-11EF-BD38-00155D3D8248}' />
 
   </package>
 </packages:packages>
-- 
GitLab


From e138450549d1149825eb1a84f5111249919a7f1b Mon Sep 17 00:00:00 2001
From: Adam Thorn <alt36@cam.ac.uk>
Date: Wed, 19 Feb 2025 11:55:26 +0000
Subject: [PATCH 5/5] mathematica: check for wolframscript before uninstalling

---
 packages/mathematica.xml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/packages/mathematica.xml b/packages/mathematica.xml
index 1959e58c..d0e7af6d 100755
--- a/packages/mathematica.xml
+++ b/packages/mathematica.xml
@@ -57,7 +57,11 @@
       </condition>
     </remove>
     <!-- uninstall wolframscript -->
-    <remove cmd='msiexec /qn /x {2DF07200-A7A7-11EF-BD38-00155D3D8248}' />
+    <remove cmd='msiexec /qn /x {2DF07200-A7A7-11EF-BD38-00155D3D8248}'>
+      <condition>
+        <check type="uninstall" condition="versiongreaterorequal" path="WolframScript.+" value="%version" />
+      </condition>
+    </remove>
 
   </package>
 </packages:packages>
-- 
GitLab