Skip to content
This repository has been archived by the owner on Aug 12, 2018. It is now read-only.

Commit

Permalink
Change sign filename.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Sep 3, 2016
1 parent b193301 commit 2db3008
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
/build/temp_zip*
/distrib/Notepad2-mod.*.exe
/res/Notepad2.exe.manifest
/signinfo_notepad2-mod.txt
/signinfo.txt
/src/VersionRev.h
2 changes: 1 addition & 1 deletion build/make_installer.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/make_zip.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 23 additions & 24 deletions build/sign.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rem ****************************************************************************


SETLOCAL
SET "FILE_DIR=%~dp0"

IF "%~1" == "" (
ECHO %~nx0: No input specified!
Expand All @@ -29,41 +30,21 @@ 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.
GOTO End
)

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" (
Expand All @@ -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
2 changes: 1 addition & 1 deletion distrib/notepad2_setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2db3008

Please sign in to comment.