#!/bin/bash
set -x
WINDDK="/cygdrive/c/Program Files (x86)/Windows Kits/10/bin/10.0.16299.0/x86/"
INF2CAT="${WINDDK}/Inf2Cat.exe"
SIGNTOOL="${WINDDK}/SignTool.exe"
SIGN_NAME="NoMachine S.a.r.l."
CER_PATH="C:\CodeSigning\VeriSign Class 3 Public Primary Certification Authority - G5.cer"
TS_APP="http://timestamp.digicert.com"

# Windows version 5:

cd NT5/i386
"${INF2CAT}" /driver:. /os:2000,XP_X86,Server2003_X86
cd ../amd64
"${INF2CAT}" /driver:. /os:XP_X64,Server2003_X64
cd ../ia64
"${INF2CAT}" /driver:. /os:Server2003_IA64

# Windows version 6:

cd ../../NT6/i386
"${INF2CAT}" /driver:. /os:Vista_X86,Server2008_X86,7_X86
cd ../amd64
"${INF2CAT}" /driver:. /os:Vista_X64,Server2008_X64,7_X64,Server2008R2_X64
cd ../ia64
"${INF2CAT}" /driver:. /os:Server2008_IA64,Server2008R2_IA64

cd ../..

"${SIGNTOOL}" sign /debug /v /as /sha1  D2D7D82A0B690E601FD670F1C3F87721DF8BD231 /s my /n "${SIGN_NAME}" /tr "${TS_APP}" /fd sha1 /td sha1 \
            NT5/amd64/nxtun.cat \
            NT5/amd64/nxtun.sys \
            NT5/ia64/nxtun.cat \
            NT5/ia64/nxtun.sys \
            NT5/i386/nxtun.cat \
            NT5/i386/nxtun.sys \
            NT6/amd64/nxtun.cat \
            NT6/amd64/nxtun.sys \
            NT6/ia64/nxtun.cat \
            NT6/ia64/nxtun.sys \
            NT6/i386/nxtun.cat \
            NT6/i386/nxtun.sys 
