Skip to content

Commit

Permalink
Installer cleanup
Browse files Browse the repository at this point in the history
Added support for signing the binaries and the installer to the build script.

Added product name and version to the installer.
  • Loading branch information
JoeLudwig committed Aug 29, 2020
1 parent f96c7f9 commit 7c9fa41
Show file tree
Hide file tree
Showing 4 changed files with 41,572 additions and 12,406 deletions.
58 changes: 58 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ let bldDir = path.resolve( srcDir, "build" );

let verbose = false;
let buildVersion = null;
let certPath = null;
let certPassword = null;

for( let argIndex = 0; argIndex < process.argv.length; )
{
Expand All @@ -29,13 +31,24 @@ for( let argIndex = 0; argIndex < process.argv.length; )
}
buildVersion = process.argv[ argIndex++ ];
}
else if( arg == "--sign" || arg == "-s" )
{
if( ( process.argv.length - argIndex ) < 2 )
{
console.log( "Usage: --sign|-s <cert file path> <password>" );
process.exit( 1 );
}
certPath = process.argv[ argIndex++ ];
certPassword = process.argv[ argIndex++ ];
}
}

if( verbose )
{
console.log( "Web directory is", webDir );
console.log( "Src directory is", srcDir );
console.log( "data directory is", dataDir );
console.log( "cert path is", certPath );
}

function runCommand( command, args, cwd, expectedTime, name )
Expand Down Expand Up @@ -292,9 +305,17 @@ Unicode True
# define installer name
OutFile "aardvarkinstaller_${ buildVersion }.exe"
LoadLanguageFile "\${NSISDIR}\\Contrib\\Language files\\English.nlf"
# set desktop as install directory
InstallDir $PROGRAMFILES64\\Aardvark
VIProductVersion "${ buildVersion }.0"
VIAddVersionKey /LANG=\${LANG_ENGLISH} "ProductName" "Aardvark Installer"
VIAddVersionKey /LANG=\${LANG_ENGLISH} "CompanyName" "Aardvark Team"
VIAddVersionKey /LANG=\${LANG_ENGLISH} "FileDescription" "Aardvark Installer"
VIAddVersionKey /LANG=\${LANG_ENGLISH} "FileVersion" "${ buildVersion }"
# default section start
Section
Expand Down Expand Up @@ -360,6 +381,41 @@ async function buildInstaller()

}

async function signFile( path )
{
runCommand(
"signtool",
[ "sign",
"/f", certPath,
"/p", certPassword,
"/t", "http://timestamp.digicert.com",
path],
__dirname, 1, "Signing " + path );
}


async function signExes()
{
if( !subDir || !certPath )
return;

let buildDir = path.resolve( __dirname, subDir );

await signFile( buildDir + "\\avrenderer.exe" );
await signFile( buildDir + "\\crashpad_handler.exe" );
}


async function signInstaller()
{
if( !subDir || !certPath )
return;

let installerPath = path.resolve( __dirname, `aardvarkinstaller_${ buildVersion }.exe` );
await signFile( installerPath );
}


async function runBuild()
{
if( buildVersion )
Expand All @@ -377,8 +433,10 @@ async function runBuild()
await unzipCef();
await cppBuild();
await copyRelease();
await signExes();
await buildArchive();
await buildInstaller();
await signInstaller();

console.log( "build finished" );
}
Expand Down
Loading

0 comments on commit 7c9fa41

Please sign in to comment.