فهرست منبع

Make it possible to use issigverify on other build files, starting with Compil32.exe.

Martijn Laan 4 ماه پیش
والد
کامیت
553cd5bd71
4فایلهای تغییر یافته به همراه28 افزوده شده و 19 حذف شده
  1. 8 4
      build-ce.bat
  2. 6 2
      build.bat
  3. 13 12
      issig.bat
  4. 1 1
      setup.iss

+ 8 - 4
build-ce.bat

@@ -33,7 +33,7 @@ if not exist files\issigtool.exe (
   echo Missing ISSigTool
   echo Now open Projects\Projects.groupproj and build ISSigTool in Release mode
 
-  echo Waiting for file...
+  echo - Waiting for file...
   call :waitforfile files\issigtool.exe
   echo Compiling ISSigTool done
 )
@@ -55,7 +55,7 @@ call :deletefile ishelp\ishelpgen\ishelpgen.exe
 echo Clearing compilation output done
 echo Now open Projects\Projects.groupproj and build all projects in Release mode
 
-echo Waiting for files...
+echo - Waiting for files...
 call :waitforfile files\compil32.exe
 call :waitforfile files\iscc.exe
 call :waitforfile files\iscmplr.dll
@@ -69,11 +69,15 @@ echo Found all, waiting 2 seconds more...
 timeout /t 2 /nobreak >nul
 echo Compiling Inno Setup done
 
+set signfiles=files\compil32.exe files\iscmplr.dll files\ispp.dll
+
 if exist .\setup-presign.bat (
-  call .\setup-presign.bat Files\ISCmplr.dll Files\ISPP.dll
+  echo - Presigning
+  call .\setup-presign.bat %signfiles%
+  echo Presign done
 )
 
-call .\issig.bat sign
+call .\issig.bat sign %signfiles%
 if errorlevel 1 goto failed
 echo ISSigTool sign done
 pause

+ 6 - 2
build.bat

@@ -63,11 +63,15 @@ call .\compile.bat
 if errorlevel 1 goto failed
 echo Compiling Inno Setup done
 
+set signfiles=files\compil32.exe files\iscmplr.dll files\ispp.dll
+
 if exist .\setup-presign.bat (
-  call .\setup-presign.bat Files\ISCmplr.dll Files\ISPP.dll
+  echo - Presigning
+  call .\setup-presign.bat %signfiles%
+  echo Presign done
 ) 
 
-call .\issig.bat sign
+call .\issig.bat sign %signfiles%
 if errorlevel 1 goto failed
 echo ISSigTool sign done
 pause

+ 13 - 12
issig.bat

@@ -8,7 +8,7 @@ rem
 rem  Batch file to embed the public key in TrustFunc.AllowedPublicKeys.inc (before compilation) or to create ISCmplr.dll.issig and ISPP.dll.issig (after compilation)
 rem  Also generates a new private key if needed
 
-setlocal
+setlocal enabledelayedexpansion
 
 cd /d %~dp0
 
@@ -27,9 +27,6 @@ if "%ISSIGTOOL_KEY_FILE%"=="" goto compilesettingserror
 
 rem -------------------------------------------------------------------------
 
-cd Files
-if errorlevel 1 goto failed
-
 if not exist "%ISSIGTOOL_KEY_FILE%" (
   echo Missing key file
   ISSigTool.exe generate-private-key
@@ -43,26 +40,30 @@ if "%1"=="sign" goto sign
 if not "%1"=="" goto failed
 
 :embed
-set targetfile=..\Components\TrustFunc.AllowedPublicKeys.inc
+set targetfile=Components\TrustFunc.AllowedPublicKeys.inc
 if not exist "%targetfile%" goto failed
-set publickeyfile=_temp.ispublickey
-ISSigTool.exe export-public-key "%publickeyfile%"
+set publickeyfile=Files\_temp.ispublickey
+Files\ISSigTool.exe export-public-key "%publickeyfile%"
 if errorlevel 1 goto failed
 if not exist "%publickeyfile%" goto failed
 powershell.exe -NoProfile -Command "$filePath = '%targetfile%'; $replacementFilePath = '%publickeyfile%'; $startMarker = 'AllowedPublicKey2Text :='; $endMarker = ';'; try { $content = Get-Content -Raw -Path $filePath; $replacementText = Get-Content -Raw -Path $replacementFilePath; $replacementText = $replacementText -replace \"`r`n\", \"' + #13#10 +`r`n'\"; $replacementText = \"'\" + $replacementText + \"'\"; $replacementText = $replacementText -replace \" \+`r`n''\", \"\"; [string] $pattern = '(?s)' + [regex]::Escape($startMarker) + '.*?' + [regex]::Escape($endMarker); if ($content -match $pattern) { $replacement = $startMarker + \"`r`n\" + $replacementText  + $endMarker; $newContent = $content -replace $pattern, $replacement; $utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($false); [System.IO.File]::WriteAllText($filePath, $newContent, $utf8NoBomEncoding); Write-Host 'Embedded key.'; } else { Write-Host 'Markers not found.'; exit 1; } } catch { Write-Error ('Error: ' + $_.Exception.Message); exit 1; }"
 if errorlevel 1 goto failed
 del "%publickeyfile%"
 if errorlevel 1 goto failed
-cd ..
-if errorlevel 1 goto failed
 
 echo Success!
 goto exit
 
 :sign
-ISSigTool.exe sign ISCmplr.dll ISPP.dll
-if errorlevel 1 goto failed
-cd ..
+set signfiles=
+shift  
+:signfilesloop  
+if "%1"=="" goto signfilesdone  
+set "signfiles=!signfiles! %1"  
+shift  
+goto signfilesloop
+:signfilesdone
+Files\ISSigTool.exe sign %signfiles%
 if errorlevel 1 goto failed
 
 echo Success!

+ 1 - 1
setup.iss

@@ -120,7 +120,7 @@ Name: mykey2; KeyID: def020edee3c4835fd54d85eff8b66d4d899b22a777353ca4a114b652e5
 Source: "license.txt"; DestDir: "{app}"; Flags: ignoreversion touch
 Source: "files\ISetup.chm"; DestDir: "{app}"; Flags: ignoreversion touch
 Source: "files\ISetup-dark.chm"; DestDir: "{app}"; Flags: ignoreversion touch
-Source: "files\Compil32.exe"; DestDir: "{app}"; Flags: ignoreversion signonce touch
+Source: "files\Compil32.exe"; DestDir: "{app}"; Flags: ignoreversion issigverify signcheck touch
 Source: "files\isscint.dll"; DestDir: "{app}"; Flags: ignoreversion issigverify signcheck touch
 Source: "files\isscint.dll.issig"; DestDir: "{app}"; Flags: ignoreversion touch
 #ifndef isccexe