From f838130be2f259590642ab3a9a56c4a05c415a29 Mon Sep 17 00:00:00 2001 From: rdw Date: Wed, 9 May 2012 11:02:15 +0000 Subject: [PATCH] Keygen no longer throws a command window up. Add TODOs to mirror documentation. Add missed vbs file git-svn-id: https://svn.shibboleth.net/cpp-sp/branches/REL_2@3651 cb58f699-b61c-0410-a6fe-9272a202ed29 --- configs/keygen.bat-wix | 1 + msi/WiX/Compile.bat | 4 +-- msi/WiX/MergeModules/OpenSAML-schemas.wxs | 1 + msi/WiX/MergeModules/OpenSAML-x64.wxs | 2 +- msi/WiX/MergeModules/OpenSAML-x86.wxs | 1 + msi/WiX/ShibbolethSP-noarch.wxs | 14 ++++---- msi/scripts/shib_edit_catalog.vbs | 54 ++++++++++++++++++++++++++++++ msi/scripts/shib_edit_config_files.vbs-wix | 25 +------------- 8 files changed, 68 insertions(+), 34 deletions(-) create mode 100644 msi/scripts/shib_edit_catalog.vbs diff --git a/configs/keygen.bat-wix b/configs/keygen.bat-wix index 2a3c3f3..45c9e11 100644 --- a/configs/keygen.bat-wix +++ b/configs/keygen.bat-wix @@ -29,6 +29,7 @@ set /a DAYS=%YEARS%*365 if not defined FQDN goto guess_fqdn :generate +set PATH=%PATH%;%ProgramFiles%\Shibboleth\SP\lib\ set CNF="%PREFIX%sp-cert.cnf" echo # OpenSSL configuration file for creating sp-cert.pem >%CNF% echo [req] >>%CNF% diff --git a/msi/WiX/Compile.bat b/msi/WiX/Compile.bat index 41e5f69..f8df921 100644 --- a/msi/WiX/Compile.bat +++ b/msi/WiX/Compile.bat @@ -15,10 +15,10 @@ candle ShibbolethSP-registry-x86.wxs wixcop -indent:2 ShibbolethSP-main-x64.wxs candle ShibbolethSP-main-x64.wxs -light -sw1055 -sice:ICE82 -o ShibbolethSP-main-x64.msi ShibbolethSP-main-x64.wixobj ShibbolethSP-exe-x64.wixobj ShibbolethSP-registry-x64.wixobj ShibbolethSP-noarch.wixobj ShibbolethSP-exe-x86.wixobj ShibbolethSP-registry-x86.wixobj +light -sw1055 -sice:ICE82 -o ShibbolethSP-main-x64.msi ShibbolethSP-main-x64.wixobj ShibbolethSP-exe-x64.wixobj ShibbolethSP-registry-x64.wixobj ShibbolethSP-noarch.wixobj ShibbolethSP-exe-x86.wixobj ShibbolethSP-registry-x86.wixobj -ext WixUtilExtension.dll wixcop -indent:2 ShibbolethSP-main-x86.wxs candle ShibbolethSP-main-x86.wxs -light -sw1055 -sice:ICE82 -o ShibbolethSP-main-x86.msi ShibbolethSP-main-x86.wixobj ShibbolethSP-noarch.wixobj ShibbolethSP-exe-x86.wixobj ShibbolethSP-registry-x86.wixobj +light -sw1055 -sice:ICE82 -o ShibbolethSP-main-x86.msi ShibbolethSP-main-x86.wixobj ShibbolethSP-noarch.wixobj ShibbolethSP-exe-x86.wixobj ShibbolethSP-registry-x86.wixobj -ext WixUtilExtension.dll diff --git a/msi/WiX/MergeModules/OpenSAML-schemas.wxs b/msi/WiX/MergeModules/OpenSAML-schemas.wxs index d5591ea..8791265 100644 --- a/msi/WiX/MergeModules/OpenSAML-schemas.wxs +++ b/msi/WiX/MergeModules/OpenSAML-schemas.wxs @@ -1,5 +1,6 @@ + - + - + - - - - + + + + diff --git a/msi/scripts/shib_edit_catalog.vbs b/msi/scripts/shib_edit_catalog.vbs new file mode 100644 index 0000000..b30dff6 --- /dev/null +++ b/msi/scripts/shib_edit_catalog.vbs @@ -0,0 +1,54 @@ +Function ReadFile( filePath ) + Dim theFile + + 'OpenTextFile args: , 1 = ForReading + 'If you read an empty file, VBScript throws an error for some reason + if (FileSystemObj.FileExists(filePath)) then + Set theFile = FileSystemObj.GetFile(filePath) + if (theFile.size > 0) then + Set theFile = FileSystemObj.OpenTextFile(filePath, 1) + ReadFile = theFile.ReadAll + else + ReadFile = "" + end if + else + ReadFile = "" + end if +End Function + +Sub WriteFile( filePath, contents ) + Dim theFile + + 'OpenTextFile args: , 2 = ForWriting, True = create if not exist + Set theFile = FileSystemObj.OpenTextFile(filePath, 2, True) + theFile.Write contents +End Sub + +Sub ReplaceInFile( filePath, lookForStr, replaceWithStr ) + Dim buffer + + buffer = ReadFile(filePath) + if (buffer <> "") then + buffer = Replace(buffer, lookForStr, replaceWithStr) + WriteFile filePath, buffer + end if +End Sub + + +Dim FileSystemObj, ConfigFile, ConfigFileName, XMLDir, WshShell + +on error resume next +Set FileSystemObj = CreateObject("Scripting.FileSystemObject") +if (Err = 0) then + + 'Get the parameters via CustomActionData + customData = Session.Property("CustomActionData") + msiProperties = split(customData,";@;") + XMLDir = msiProperties(0) ' \programdata\shibboleth\sp\xml\opensaml\ + ConfigFileName = msiProperties(1) 'catalog + + ConfigFile = XMLDir & ConfigFileName + ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir + +'Last End If +End If \ No newline at end of file diff --git a/msi/scripts/shib_edit_config_files.vbs-wix b/msi/scripts/shib_edit_config_files.vbs-wix index cbc6bd6..a9ecb9b 100644 --- a/msi/scripts/shib_edit_config_files.vbs-wix +++ b/msi/scripts/shib_edit_config_files.vbs-wix @@ -47,7 +47,7 @@ if (Err = 0) then msiProperties = split(customData,";@;") InstallDir = msiProperties(0) ShibdPort = msiProperties(1) - ProgramFiles = msiProperties(2) + ProgramData = msiProperties(2) 'Remove all trailing backslashes to normalize do while (mid(InstallDir,Len(InstallDir),1) = "\") @@ -65,11 +65,6 @@ if (Err = 0) then 'Afterwards, if the config file doesn't already exist, copy up to etc/shibboleth 'Also strip *.in for files in dist - 'Keygen.bat is updated in placehowever - Keygen = ConfigDir & "keygen.bat" - ReplaceInFile Keygen, "@-PROGRAMFILES-@", ProgramFiles - - ConfigFile = DistDir & "shibd.logger.in" ReplaceInFile ConfigFile, "@-PKGLOGDIR-@", ConvertedDir & "/var/log/shibboleth" If (NOT FileSystemObj.FileExists(ConfigDir & "shibd.logger")) then @@ -193,23 +188,5 @@ if (Err = 0) then FileSystemObj.CopyFile DistDir & "protocols.xml", ConfigDir, false End If - 'Finally, fix up schema catalogs. - - XMLDir = InstallDir & "\share\xml\xmltooling\" - ConfigFile = XMLDir & "catalog.xml" - ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir - - XMLDir = InstallDir & "\share\xml\opensaml\" - ConfigFile = XMLDir & "saml20-catalog.xml" - ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir - ConfigFile = XMLDir & "saml11-catalog.xml" - ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir - ConfigFile = XMLDir & "saml10-catalog.xml" - ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir - - XMLDir = InstallDir & "\share\xml\shibboleth\" - ConfigFile = XMLDir & "catalog.xml" - ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir - 'Last End If End If \ No newline at end of file -- 2.1.4