Progress on Windows installer.
authorRod Widdowson <rdw@steadingsoftware.com>
Thu, 10 May 2012 14:36:36 +0000 (14:36 +0000)
committerRod Widdowson <rdw@steadingsoftware.com>
Thu, 10 May 2012 14:36:36 +0000 (14:36 +0000)
msi/WiX/ShibbolethSP-exe-x86.wxs
msi/WiX/ShibbolethSP-main-x64.wxs
msi/WiX/ShibbolethSP-main-x86.wxs
msi/WiX/ShibbolethSP-noarch.wxs
msi/WiX/ShibbolethSP-properties.wxi
msi/scripts/shib_edit_config_files.vbs-wix
msi/scripts/shib_install_isapi_filter.vbs-wix [new file with mode: 0644]
msi/scripts/shib_uninstall_isapi_filter.vbs-wix [new file with mode: 0644]

index 4cbdc0c..e8834ee 100644 (file)
                  FileSource='$(var.BuildDirectory)\cvs\2.0\cpp-sp\Release' >\r
         <Component Id='shibd.exe' Guid='{2476BB80-9384-4026-86F5-E1569A685187}'>\r
           <File Name='shibd.exe' KeyPath='yes' />\r
-          <!-- TODO this should not happen on an upgrade (install/uninstall) -->\r
+          <!-- NOTE - whether this actually happens is predicated in noarch on whether this is an upgrade or not -->\r
           <ServiceInstall Id='shibd' Name='shibd_Default' \r
                           DisplayName='Shibboleth 2 Daemon (Default)' Type='ownProcess' \r
                           Start='auto' ErrorControl='ignore' />\r
index 20976b8..7ce4e49 100644 (file)
@@ -25,6 +25,9 @@
     <Package Description='Installer for Shibboleth SP (x86 and x64)' Compressed='yes'\r
              Manufacturer='Shibboleth Consortium' InstallerVersion='300' Platform='x64'/>\r
 \r
+    <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." \r
+                  MigrateFeatures="yes"  Schedule="afterInstallExecute" />\r
+\r
     <PropertyRef Id='SHIB_OLDVERSION_64'/>\r
     <PropertyRef Id='SHIB_OLDVERSION'/>\r
 \r
       </Component>\r
     </DirectoryRef><!-- etc_shibboleth -->\r
 \r
-    <!-- TODO use QtExecCmdLine to execute SetX64Shibd -->\r
-\r
     <Feature Id='Shibboleth' Title='Shibboleth' Level='1' Display='hidden' \r
              ConfigurableDirectory='INSTALLDIR'>\r
       <MergeRef Id='CurlMergeModule_x86'/>\r
index 9e08c35..a9c7868 100644 (file)
@@ -25,6 +25,9 @@
     <Package Description='Installer for Shibboleth SP (x86 and x64)' Compressed='yes'\r
              Manufacturer='Shibboleth Consortium' InstallerVersion='300'/>\r
 \r
+    <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." \r
+                  MigrateFeatures="yes"  Schedule="afterInstallExecute" />\r
+\r
     <PropertyRef Id='SHIB_OLDVERSION'/>\r
 \r
     <Condition Message='Shibboleth requires Windows XP SP2 or later.'>NOT VersionNT OR (VersionNT &gt;= 501)</Condition>\r
index 6e4d0f9..fda3ae9 100644 (file)
@@ -1,5 +1,4 @@
 <?xml version='1.0' encoding='UTF-8'?>\r
-<!-- TODO etc is uninstallable, etc\dist isn't -->\r
 <!-- Licensed to the University Corporation for Advanced Internet\r
      Development, Inc. (UCAID) under one or more contributor license\r
      agreements.  See the NOTICE file distributed with this work for\r
 \r
     <CustomAction Id='KeyGen' BinaryKey='WixCA' DllEntry='CAQuietExec' Execute='deferred' Impersonate='no' />\r
     <CustomAction Id='SetKeyGen' Property='KeyGen' Value='&quot;[INSTALLDIR]etc\shibboleth\keygen.bat&quot;' />\r
-    \r
-    <!-- TODO IIS Install (if not ALREADYINSTALLED)\r
-         TODO IIS Uninstalll (if UGRADINGPRODUCTCODE) -->\r
+\r
+    <Binary Id='install_isapi' \r
+            SourceFile='$(var.BuildDirectory)\cvs\2.0\cpp-sp\msi\scripts\shib_install_isapi_filter.vbs-wix'/>\r
+    <Binary Id='uninstall_isapi' \r
+            SourceFile='$(var.BuildDirectory)\cvs\2.0\cpp-sp\msi\scripts\shib_uninstall_isapi_filter.vbs-wix'/>\r
+\r
+    <CustomAction Id='SetShibInstallISAPIFilter32' Property='ShibInstallISAPIFilter' \r
+                  Value='[INSTALLDIR];@;[INSTALLDIR]lib\shibboleth\isapi_shib.dll;@;[SHIB_FILE_EXTENSION]' />\r
+    <CustomAction Id='SetShibInstallISAPIFilter64' Property='ShibInstallISAPIFilter' \r
+                  Value='[INSTALLDIR];@;[INSTALLDIR]lib64\shibboleth\isapi_shib.dll;@;[SHIB_FILE_EXTENSION]' />\r
+    <CustomAction Id='ShibInstallISAPIFilter' BinaryKey='install_isapi' \r
+                  VBScriptCall='' Execute='deferred' Impersonate='no' />\r
+\r
+    <CustomAction Id='SetShibUninstallISAPIFilter' Property='ShibUninstallISAPIFilter' \r
+                  Value='[INSTALLDIR]'/>\r
+    <CustomAction Id='ShibUninstallISAPIFilter' BinaryKey='uninstall_isapi' \r
+                  VBScriptCall='' Execute='deferred' Impersonate='no' />\r
+\r
+    <CustomAction Id='ServicePath64' BinaryKey='WixCA' DllEntry='CAQuietExec' Execute='deferred' Impersonate='no' />\r
+    <CustomAction Id='SetServicePath64' Property='ServicePath64' Value='&quot;[INSTALLDIR]etc\shibboleth\SetService64.bat&quot;' />\r
+\r
+\r
     <InstallExecuteSequence>\r
       <Custom Action='SetEditConfigFiles' Before='CostInitialize'>NOT Installed</Custom>\r
       <Custom Action='EditConfigFiles' After='InstallFiles'>NOT Installed</Custom>\r
+\r
       <Custom Action='SetKeyGen' Before='CostInitialize'>NOT Installed</Custom>\r
       <!-- Run KeyGen after WriteEnvironmentStrings so the path is set -->\r
       <Custom Action='KeyGen' After='WriteEnvironmentStrings'>NOT Installed</Custom>\r
+\r
+      <!-- Install IIS if\r
+           - this is an install\r
+           - AND we were told to\r
+           - AND this is NOT an upgrade\r
+        -->\r
+      <Custom Action='SetShibInstallISAPIFilter32' \r
+              Before='CostInitialize'>(NOT Installed) AND (INSTALL_ISAPI_FILTER = "TRUE") AND (NOT ALREADYINSTALLED) AND (INSTALL_32BIT)</Custom>\r
+      <Custom Action='SetShibInstallISAPIFilter64' \r
+              Before='CostInitialize'>(NOT Installed) AND (INSTALL_ISAPI_FILTER = "TRUE") AND (NOT ALREADYINSTALLED) AND (NOT INSTALL_32BIT)</Custom>\r
+      <Custom Action='ShibInstallISAPIFilter' \r
+              After='InstallFiles'>(NOT Installed) AND (INSTALL_ISAPI_FILTER = "TRUE") AND (NOT ALREADYINSTALLED)</Custom>\r
+\r
+      <!-- (try to) Uninstall IIS if\r
+           - this is an uninstall\r
+           - this is not an upgrade\r
+           -->\r
+      <Custom Action='SetShibUninstallISAPIFilter' \r
+              After='CostFinalize'>(REMOVE="ALL") AND (NOT UPGRADINGPRODUCTCODE)</Custom>\r
+      <Custom Action='ShibUninstallISAPIFilter' \r
+              Before='RemoveFiles'>(REMOVE="ALL") AND (NOT UPGRADINGPRODUCTCODE)</Custom>\r
+      <!-- set service path to 64 bit one if this is an install and if we werre told to -->\r
+\r
+      <Custom Action='SetServicePath64' \r
+              Before='CostInitialize'>(NOT Installed) AND (INSTALL_SHIBD_SERVICE = "TRUE") AND (NOT ALREADYINSTALLED) AND (NOT INSTALL_32BIT)</Custom>\r
+      <Custom Action='ServicePath64' \r
+              After='InstallServices'>(NOT Installed) AND (INSTALL_SHIBD_SERVICE = "TRUE") AND (NOT ALREADYINSTALLED) AND (NOT INSTALL_32BIT)</Custom>\r
+\r
+\r
+      <!-- Do not mess with SCM if this is an upgrade -->\r
+\r
+      <InstallServices>(NOT Installed) AND (NOT ALREADYINSTALLED) AND (INSTALL_SHIBD_SERVICE = "TRUE")</InstallServices>\r
+      <DeleteServices>(REMOVE="ALL") AND (NOT UPGRADINGPRODUCTCODE)</DeleteServices>\r
+\r
     </InstallExecuteSequence>\r
     \r
     <!-- Components\r
index ccb2a50..36ad5d0 100644 (file)
 <Include>\r
 \r
   <!-- Are we installing IIS, if so what extension to used -->\r
-  <Property Id="SHIB_FILE_EXTENSION" Value=".sso" Secure="yes">\r
-    <RegistrySearch Id="AppReg" Root="HKLM" Key="SOFTWARE\Shibboleth" Name="FileExtension" Type="raw" />\r
+  <Property Id='SHIB_FILE_EXTENSION' Value='.sso' Secure='yes'>\r
+    <RegistrySearch Id='AppReg' Root='HKLM' Key='SOFTWARE\Shibboleth' Name='FileExtension' Type='raw' />\r
   </Property>\r
   \r
   <!-- IIS install -->\r
-  <Property Id="INSTALL_ISAPI_FILTER" Value="TRUE" Secure="yes" />\r
+  <Property Id='INSTALL_ISAPI_FILTER' Value='TRUE' Secure='yes' />\r
   <!-- Install shibd_service -->\r
-  <Property Id="INSTALL_SHIBD_SERVICE" Value="TRUE" Secure="yes" />\r
+  <Property Id='INSTALL_SHIBD_SERVICE' Value='TRUE' Secure='yes' />\r
   <!-- 64 bit or 32bit service and DLLS, also used to swap in the 64 bit service -->\r
-  <Property Id="INSTALL_32BIT" Secure="yes" />\r
-  <Property Id="SHIBD_PORT" Value="1600" Secure="yes" />\r
+  <Property Id='INSTALL_32BIT' Secure='yes' />\r
+  <Property Id='SHIBD_PORT' Value='1600' Secure='yes' />\r
 \r
-  <Property Id="ARPCONTACT" Value="contact@shibboleth.net" />\r
-  <Property Id="ARPHELPLINK" Value="https://wiki.shibboleth.net/confluence/display/SHIB2/Installation+and+Configuration" />\r
-  <Property Id="ARPURLUPDATEINFO" Value="https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPWindowsUpgrade" />\r
-  <Property Id="ARPURLINFOABOUT" Value="http://www.shibboleth.net/" />\r
+  <Property Id='ARPCONTACT' Value='contact@shibboleth.net' />\r
+  <Property Id='ARPHELPLINK' Value='https://wiki.shibboleth.net/confluence/display/SHIB2/Installation+and+Configuration' />\r
+  <Property Id='ARPURLUPDATEINFO' Value='https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPWindowsUpgrade' />\r
+  <Property Id='ARPURLINFOABOUT' Value='http://www.shibboleth.net/' />\r
 \r
   <!-- UPGRADINGPRODUCTCODE set in the uninstall if this is an upgrade uninstall -->\r
 \r
   <Upgrade Id='$(var.ShibbolethUpgradeCode)'>\r
-    <UpgradeVersion ExcludeLanguages="yes" IncludeMaximum="yes" Maximum="2.5.0" Minimum="0.0.1" OnlyDetect="yes" Property="ALREADYINSTALLED"/>\r
+    <UpgradeVersion ExcludeLanguages='yes' IncludeMaximum='yes' Maximum='127.255.255' Minimum='0.0.1' OnlyDetect='yes' Property='ALREADYINSTALLED'/>\r
   </Upgrade>\r
 </Include>\r
 \r
index 86f7dc8..e32b307 100644 (file)
@@ -36,7 +36,7 @@ End Sub
 \r
 \r
 Dim FileSystemObj, ConvertedDir, ConfigFile, XMLDir, WshShell\r
-Dim customData, msiProperties, InstallDir, ShibdPort\r
+Dim customData, msiProperties, InstallDir, ShibdPort, LogFile\r
 \r
 on error resume next\r
 Set FileSystemObj = CreateObject("Scripting.FileSystemObject")\r
@@ -47,7 +47,12 @@ if (Err = 0) then
   msiProperties = split(customData,";@;")\r
   InstallDir = msiProperties(0)\r
   ShibdPort = msiProperties(1)\r
-  ProgramData = msiProperties(2)\r
+\r
+  Set LogFile = FileSystemObj.OpenTextFile(InstallDir & "\var\log\shibboleth\Installer.log", 8, true)\r
+\r
+  If (LogFile) then\r
+     LogFile.WriteLine "Edit Config Files to " & InstallDir & ", Port = " & ShibdPort\r
+  End If\r
 \r
   'Remove all trailing backslashes to normalize\r
   do while (mid(InstallDir,Len(InstallDir),1) = "\")\r
diff --git a/msi/scripts/shib_install_isapi_filter.vbs-wix b/msi/scripts/shib_install_isapi_filter.vbs-wix
new file mode 100644 (file)
index 0000000..375a97c
--- /dev/null
@@ -0,0 +1,180 @@
+Dim FilterObj\r
+Dim LoadOrder\r
+Dim FilterName\r
+Dim FilterPath\r
+Dim FilterDesc\r
+Dim WebObj, WebSite, WebSiteRoot\r
+Dim existsFlag\r
+Dim ScriptMaps\r
+Dim newScriptLine\r
+Dim line, lineArray, lineIndex\r
+Dim WebSvcExts\r
+Dim FileSystemObj\r
+Dim newWebSvcExtLine\r
+Dim customData, msiProperties, InstallDir, ShibFileExtension, LogFile\r
+\r
+'Get the INSTALLDIR and SHIB_FILE_EXTENSION values via CustomActionData\r
+customData = Session.Property("CustomActionData")\r
+msiProperties = split(customData,";@;")\r
+InstallDir= msiProperties(0)\r
+ShibISAPIPath = msiProperties(1)\r
+ShibFileExtension = msiProperties(2)\r
+\r
+Set FileSystemObj = CreateObject("Scripting.FileSystemObject")\r
+\r
+Set LogFile = FileSystemObj.OpenTextFile(InstallDir & "\var\log\shibboleth\Installer.log", 8, true)\r
+\r
+LogFile.WriteLine "Configure IIS plugin DLL " & ShibISAPIPath & ", Extension = " & ShibFileExtension\r
+\r
+On Error Resume Next\r
+Set WebObj = GetObject("IIS://LocalHost/W3SVC")\r
+if (Err = 0) then\r
+\r
+  'Remove all trailing backslashes to normalize\r
+  do while (mid(InstallDir,Len(InstallDir),1) = "\")\r
+    InstallDir = mid(InstallDir,1,Len(InstallDir)-1)\r
+  loop\r
+  ' ShibISAPIPath = InstallDir & "\lib\shibboleth\isapi_shib.dll"\r
+  'Make sure ShibFileExtension is in proper format\r
+  'First, strip any preceding periods\r
+  do while (mid(ShibFileExtension,1,1) = ".")\r
+    ShibFileExtension = mid(ShibFileExtension,2,Len(ShibFileExtension)-1)\r
+  loop\r
+  'If there is nothing left (or was nothing to begin with), use the default\r
+  if (ShibFileExtension = "") then\r
+    ShibFileExtension = ".sso"\r
+  else\r
+    'Add preceding period\r
+    ShibFileExtension = "." & ShibFileExtension\r
+  end if\r
+\r
+  'Specify other ISAPI Filter details\r
+  FilterName = "Shibboleth"\r
+  FilterPath = ShibISAPIPath\r
+  FilterDesc = ""\r
+\r
+  Set FiltersObj = GetObject("IIS://LocalHost/W3SVC/Filters")\r
+  LoadOrder = FiltersObj.FilterLoadOrder\r
+  'Check to see if 'Shibboleth' is already sequenced\r
+  existsFlag = "not_exist"\r
+  lineArray = split(LoadOrder, ",")\r
+  for each line in lineArray\r
+    if (line = FilterName) then\r
+      existsFlag = "exists"\r
+    end if\r
+  next\r
+  if (existsFlag = "not_exist") then\r
+    If LoadOrder <> "" Then\r
+      LoadOrder = LoadOrder & ","\r
+    End If\r
+    LoadOrder = LoadOrder & FilterName\r
+    FiltersObj.FilterLoadOrder = LoadOrder\r
+    FiltersObj.SetInfo\r
+  else\r
+    'msgbox "Shib Filter already sequenced"\r
+  end if\r
+\r
+  Set FilterObj = FiltersObj.Create("IIsFilter", FilterName)\r
+  If (Err <> 0) then\r
+    'Open existing filter for updating\r
+    Err = 0\r
+    Set FilterObj = GetObject("IIS://LocalHost/W3SVC/Filters/" & FilterName)\r
+  End If\r
+  FilterObj.FilterPath = FilterPath\r
+  FilterObj.FilterDescription = FilterDesc\r
+  FilterObj.SetInfo\r
+\r
+  'Create file extension mapping to ISAPI filter\r
+  newScriptLine = ShibFileExtension & "," & ShibISAPIPath & ",1"\r
+  ScriptMaps = WebObj.ScriptMaps\r
+  'Check if exists\r
+  existsFlag = "not_exist"\r
+  lineIndex = 0\r
+  for each line in ScriptMaps\r
+    lineArray = split(line,",")\r
+    if (lineArray(0) = ShibFileExtension) then\r
+      existsFlag = "exists"\r
+      Exit For\r
+    end if\r
+    lineIndex = lineIndex + 1\r
+  next\r
+  if (existsFlag = "not_exist") then\r
+    redim preserve ScriptMaps(UBound(ScriptMaps)+1)\r
+    ScriptMaps(UBound(ScriptMaps)) = newScriptLine\r
+    WebObj.ScriptMaps = ScriptMaps\r
+    WebObj.SetInfo\r
+  else\r
+    'msgbox ".sso already exists: " & lineIndex\r
+    'We already warned user in dialog that this value would be updated\r
+    ScriptMaps(lineIndex) = newScriptLine\r
+    WebObj.ScriptMaps = ScriptMaps\r
+    WebObj.SetInfo\r
+  end if\r
+\r
+  'Create file extension mapping to filter on each web site root\r
+  For Each WebSite in WebObj\r
+    Set WebSiteRoot = GetObject(WebSite.ADsPath & "/ROOT")\r
+    if (Err = 0) then\r
+      ScriptMaps = WebSiteRoot.ScriptMaps\r
+      'Check if exists\r
+      existsFlag = "not_exist"\r
+      lineIndex = 0\r
+      for each line in ScriptMaps\r
+        lineArray = split(line,",")\r
+        if (lineArray(0) = ShibFileExtension) then\r
+          existsFlag = "exists"\r
+          Exit For\r
+        end if\r
+        lineIndex = lineIndex + 1\r
+      next\r
+      if (existsFlag = "not_exist") then\r
+        redim preserve ScriptMaps(UBound(ScriptMaps)+1)\r
+        ScriptMaps(UBound(ScriptMaps)) = newScriptLine\r
+        WebSiteRoot.ScriptMaps = ScriptMaps\r
+        WebSiteRoot.SetInfo\r
+      else\r
+        'msgbox ".sso already exists: " & lineIndex\r
+        'We already warned user in dialog that this value would be updated\r
+        ScriptMaps(lineIndex) = newScriptLine\r
+        WebSiteRoot.ScriptMaps = ScriptMaps\r
+        WebSiteRoot.SetInfo\r
+      end if\r
+    End If\r
+  Next\r
+\r
+\r
+  'Web Services Extension\r
+  Err = 0\r
+  WebSvcExts = WebObj.WebSvcExtRestrictionList\r
+  if (Err = 0) then\r
+    newWebSvcExtLine = "1," & ShibISAPIPath & ",1,ShibGroup,Shibboleth Web Service Extension"\r
+\r
+    existsFlag = "not_exist"\r
+    lineIndex = 0\r
+    for each line in WebSvcExts\r
+      lineArray = split(line,",")\r
+      if (lineArray(1) = ShibISAPIPath) then\r
+        existsFlag = "exists"\r
+        Exit For\r
+      end if\r
+      lineIndex = lineIndex + 1\r
+    next\r
+\r
+    if (existsFlag = "not_exist") then\r
+      redim preserve WebSvcExts(UBound(WebSvcExts)+1)\r
+      WebSvcExts(UBound(WebSVCExts)) = newWebSvcExtLine\r
+      WebObj.WebSvcExtRestrictionList = WebSvcExts\r
+      WebObj.SetInfo\r
+    else\r
+      'msgbox "Shibboleth Web Services Extension already exists: " & lineIndex\r
+      'We already warned user in dialog that this value would be updated\r
+      WebSvcExts(lineIndex) = newWebSvcExtLine\r
+      WebObj.WebSvcExtRestrictionList = WebSvcExts\r
+      WebObj.SetInfo\r
+    end if\r
+\r
+  end if\r
+else\r
+   LogFile.WriteLine "  Could not locate IIS adaptor"\r
+'final end if\r
+end if
\ No newline at end of file
diff --git a/msi/scripts/shib_uninstall_isapi_filter.vbs-wix b/msi/scripts/shib_uninstall_isapi_filter.vbs-wix
new file mode 100644 (file)
index 0000000..77810bb
--- /dev/null
@@ -0,0 +1,147 @@
+Sub DeleteISAPIFilters(IISPath,dllPath)\r
+\r
+  Dim filter, FiltersObj, LoadOrder, FilterArray, FilterItem\r
+\r
+  Set FiltersObj = GetObject(IISPath & "/Filters")\r
+  LoadOrder = FiltersObj.FilterLoadOrder\r
+\r
+  for each filter in FiltersObj\r
+    if (filter.Class = "IIsFilter") then\r
+      if (filter.FilterPath = dllPath) then\r
+\r
+        'Delete the found filter here\r
+        'If there's anything to potentially delete...\r
+        if (LoadOrder <> "") then\r
+          FilterArray = split(LoadOrder,",")\r
+          LoadOrder = ""\r
+          for each FilterItem in FilterArray\r
+            if (FilterItem <> filter.Name) then\r
+              LoadOrder = LoadOrder & FilterItem & ","\r
+            end if\r
+          next\r
+          'Remove trailing comma if any filters were kept\r
+          if (LoadOrder <> "") then\r
+            LoadOrder = mid(LoadOrder,1,len(LoadOrder)-1)\r
+          end if\r
+\r
+          'Set the Load Order to the new shibboleth-less order\r
+          if (FiltersObj.FilterLoadOrder <> LoadOrder) then\r
+            FiltersObj.FilterLoadOrder = LoadOrder\r
+            FiltersObj.SetInfo\r
+          end if\r
+        end if\r
+\r
+        'Delete the actual IISFilter object\r
+        FiltersObj.Delete "IIsFilter",filter.Name\r
+\r
+      end if\r
+    end if\r
+  next\r
+\r
+End Sub\r
+\r
+\r
+Sub DeleteFileExtensions(siteObj, dllPath)\r
+\r
+Dim ScriptMaps, newScriptMaps\r
+Dim line, lineArray, lineIndex\r
+Dim fileExtension\r
+Dim existsFlag\r
+\r
+  ScriptMaps = siteObj.ScriptMaps\r
+  redim newScriptMaps(0)\r
+  lineIndex = 0\r
+  'copy each entry from the old ScriptMaps to newScriptMaps\r
+  'unless it is for dllPath\r
+  for each line in ScriptMaps\r
+    lineArray = split(line,",")\r
+    if (lineArray(1) <> dllPath) then\r
+      redim preserve newScriptMaps(lineIndex)\r
+      newScriptMaps(lineIndex) = line\r
+      lineIndex = lineIndex + 1\r
+    else\r
+      existsFlag = "exists"\r
+    end if\r
+  next\r
+  'If we found dllPath, then use the newScriptMaps instead\r
+  if (existsFlag = "exists") then\r
+    siteObj.ScriptMaps = newScriptMaps\r
+    siteObj.SetInfo\r
+  end if\r
+\r
+End Sub\r
+\r
+\r
+'*** Begin Main Code ***\r
+Dim WebObj\r
+Dim InstallDir\r
+Dim FileSystemObj\r
+Dim ShibISAPIPath\r
+Dim site, siteObj, sitePath, LogFile\r
+\r
+' First of all look for the FileExtension\r
+Set WshShell = CreateObject("WScript.Shell")\r
+\r
+'Get the INSTALLDIR value via CustomActionData\r
+InstallDir = Session.Property("CustomActionData")\r
+\r
+Set FileSystemObj = CreateObject("Scripting.FileSystemObject")\r
+\r
+'Set LogFile = FileSystemObj.OpenTextFile(InstallDir & "\var\log\shibboleth\Installer.log", 8, true)\r
+\r
+On Error Resume Next\r
+regValue = WshShell.RegRead("HKLM\SOFTWARE\Shibboleth\FileExtension")\r
+if (Err = 0) then\r
+\r
+ ' If (LogFile) then\r
+  '   LogFile.WriteLine "Uninstall IIS plugin - upgrade detected by uninstall script, skipping"\r
+  'End If\r
+  ' Registry key is still there - this is an upgrade, so exit\r
+\r
+else \r
+  ' Key is gone - a pure uninstall\r
+  'If (LogFile) then\r
+   '  LogFile.WriteLine "Uninstall IIS plugin"\r
+  'End If\r
\r
+  'Don't show errors, we'll handle anything important\r
+  On Error Resume Next\r
+\r
+  'Attempt to get W3SVC.  If failure, end script (e.g. IIS isn't available)\r
+  Set WebObj = GetObject("IIS://LocalHost/W3SVC")\r
+  if (Err = 0) then\r
+\r
+    'Remove all trailing backslashes to normalize\r
+    do while (mid(InstallDir,Len(InstallDir),1) = "\")\r
+      InstallDir = mid(InstallDir,1,Len(InstallDir)-1)\r
+    loop\r
+    ShibISAPIPath = InstallDir & "\lib\shibboleth\isapi_shib.dll"\r
+\r
+    'Delete ISAPI Filter\r
+    'First do the master service\r
+    DeleteISAPIFilters "IIS://LocalHost/W3SVC",ShibISAPIPath\r
+    'Now do the websites\r
+    for each site in WebObj\r
+      if (site.Class = "IIsWebServer") then\r
+        sitePath = "IIS://LocalHost/W3SVC/" & site.Name\r
+        DeleteISAPIFilters sitePath,ShibISAPIPath\r
+      end if\r
+    next\r
+\r
+    'Delete File Extensions\r
+    'First do the master service\r
+    DeleteFileExtensions WebObj,ShibISAPIPath\r
+    'Now do the websites\r
+    for each site in WebObj\r
+      if (site.Class = "IIsWebServer") then\r
+        set siteObj = GetObject("IIS://LocalHost/W3SVC/" & site.Name & "/ROOT")\r
+        DeleteFileExtensions siteObj,ShibISAPIPath\r
+      end if\r
+    next\r
+\r
+    'Delete Web Services Extension (universal, no need to do for each site)\r
+    WebObj.DeleteExtensionFileRecord ShibISAPIPath\r
+  ' Got the IIS Object\r
+  End If\r
+' Sense whether this is an upgrade\r
+end if
\ No newline at end of file