From 6fad20a01ca5f0aa28a9943c63bf5f9c104fb566 Mon Sep 17 00:00:00 2001
From: Adam Thorn <alt36@cam.ac.uk>
Date: Mon, 9 Mar 2020 16:33:37 +0000
Subject: [PATCH] spri-shortcuts: improve reg key tidying on removal

---
 packages/spri-shortcuts.xml | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/packages/spri-shortcuts.xml b/packages/spri-shortcuts.xml
index 258e52cc..b4aa9875 100755
--- a/packages/spri-shortcuts.xml
+++ b/packages/spri-shortcuts.xml
@@ -13,7 +13,20 @@
       <upgrade include='install' />
 
       <remove cmd='cscript %WPKGSOFTWARE%\wpkg\tools\delete-shortcut.js /folder:"SPRI" /linkname:"SPRI Wiki"'/>
-      <remove cmd='reg delete HKLM\software\ucam_wpkg.cam.ac.uk /v spri-shortcuts /f'/>
+
+      <!-- NB the chem repo-only version of this package used the ch.cam.ac.uk key, but now we're using
+           the ucam_wpkg.cam.ac.uk variant. Tidy up both versions of removal if they exist -->
+      <remove cmd='reg delete HKLM\software\ucam_wpkg.cam.ac.uk\spri-shortcuts /f'>
+        <condition>
+          <check type='registry' condition='exists' path='HKLM\software\ucam_wpkg.cam.ac.uk\spri-shortcuts' />
+        </condition>
+      </remove>
+
+      <remove cmd='reg delete HKLM\software\ch.cam.ac.uk\WPKG /v spri-shortcuts /f'>
+        <condition>
+          <check type='registry' condition='exists' path='HKLM\software\ch.cam.ac.uk\WPKG\spri-shortcuts' />
+        </condition>
+      </remove>
 
 </package>
 </packages>
-- 
GitLab