diff --git a/.gitignore b/.gitignore index 25c4d46e..0d2c59ba 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,5 @@ /build/temp_zip* /distrib/Notepad2-mod.*.exe /res/Notepad2.exe.manifest -/signinfo_notepad2-mod.txt +/signinfo.txt /src/VersionRev.h diff --git a/build/make_installer.bat b/build/make_installer.bat index 526b5a7c..0f1757be 100644 --- a/build/make_installer.bat +++ b/build/make_installer.bat @@ -53,7 +53,7 @@ IF "%~1" == "" ( :START -IF EXIST "%~dp0..\signinfo_notepad2-mod.txt" SET "SIGN=True" +IF EXIST "%~dp0..\signinfo.txt" SET "SIGN=True" SET INPUTDIRx86=bin\%COMPILER%\Release_x86 SET INPUTDIRx64=bin\%COMPILER%\Release_x64 diff --git a/build/make_zip.bat b/build/make_zip.bat index 987e3c4f..838c8954 100644 --- a/build/make_zip.bat +++ b/build/make_zip.bat @@ -46,7 +46,7 @@ IF "%~1" == "" ( :START -IF EXIST "%~dp0..\signinfo_notepad2-mod.txt" SET "SIGN=True" +IF EXIST "%~dp0..\signinfo.txt" SET "SIGN=True" SET INPUTDIRx86=bin\%COMPILER%\Release_x86 SET INPUTDIRx64=bin\%COMPILER%\Release_x64 diff --git a/build/sign.bat b/build/sign.bat index 3c97df75..79bef43f 100644 --- a/build/sign.bat +++ b/build/sign.bat @@ -16,6 +16,7 @@ rem **************************************************************************** SETLOCAL +SET "FILE_DIR=%~dp0" IF "%~1" == "" ( ECHO %~nx0: No input specified! @@ -29,18 +30,12 @@ IF NOT DEFINED VS140COMNTOOLS ( GOTO END ) -IF NOT EXIST "%~dp0..\signinfo_notepad2-mod.txt" ( - ECHO %~nx0: %~dp0..\signinfo_notepad2-mod.txt is not present! +IF NOT EXIST "%FILE_DIR%..\signinfo.txt" ( + ECHO %~nx0: %FILE_DIR%..\signinfo.txt is not present! SET SIGN_ERROR=True GOTO END ) -SET SIGN_CMD= -SET /P SIGN_CMD=<%~dp0..\signinfo_notepad2-mod.txt - -TITLE Signing "%~1"... -ECHO. & ECHO Signing "%~1"... - signtool /? 2>NUL || CALL "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" 2>NUL IF %ERRORLEVEL% NEQ 0 ( ECHO vcvarsall.bat call failed. @@ -48,22 +43,8 @@ IF %ERRORLEVEL% NEQ 0 ( ) REM Repeat n times when signing fails -SET REPEAT=3 -SET TRY=0 - -:SIGN -signtool sign %SIGN_CMD% "%~1" -SET /A TRY+=1 -IF %ERRORLEVEL% NEQ 0 ( - IF TRY LSS REPEAT ( - REM Wait 5 seconds before next try - PING -n 5 127.0.0.1 >NUL - GOTO SIGN - ) - SET SIGN_ERROR=True - GOTO END -) - +SET REPEAT=5 +FOR /F "delims=" %%A IN (%FILE_DIR%..\signinfo.txt) DO (SET "SIGN_CMD=%%A" && CALL :START_SIGN %1) :END IF /I "%SIGN_ERROR%" == "True" ( @@ -73,3 +54,21 @@ IF /I "%SIGN_ERROR%" == "True" ( ) ENDLOCAL EXIT /B + +:START_SIGN +IF /I "%SIGN_ERROR%" == "True" EXIT /B +REM %1 is name of the file to sign +TITLE Signing "%~1"... +ECHO. & ECHO Signing "%~1"... +SET TRY=0 + +:SIGN +SET /A TRY+=1 +signtool sign %SIGN_CMD% %1 +IF %ERRORLEVEL% EQU 0 EXIT /B +IF %TRY% LSS %REPEAT% ( + REM Wait 5 seconds before next try + PING -n 5 127.0.0.1 > NUL + GOTO SIGN +) +SET SIGN_ERROR=True diff --git a/distrib/notepad2_setup.iss b/distrib/notepad2_setup.iss index e1eebb25..f570c193 100644 --- a/distrib/notepad2_setup.iss +++ b/distrib/notepad2_setup.iss @@ -97,7 +97,7 @@ MinVersion=5.1sp3 #endif ArchitecturesAllowed=x86 x64 ArchitecturesInstallIn64BitMode=x64 -#ifexist "..\signinfo_notepad2-mod.txt" +#ifexist "..\signinfo.txt" SignTool=MySignTool #endif CloseApplications=true