Replace signtool with osslsigncode

This commit is contained in:
Janek Bevendorff 2017-12-14 18:17:43 +01:00
parent f257145ee0
commit b457c8c1fa

View File

@ -303,10 +303,10 @@ checkTransifexCommandExists() {
fi fi
} }
checkSigntoolCommandExists() { checkOsslsigncodeCommandExists() {
command -v signtool > /dev/null command -v osslsigncode > /dev/null
if [ 0 -ne $? ]; then if [ 0 -ne $? ]; then
exitError "signtool command not found on the PATH! Please check that you have correctly installed the Windows SDK." exitError "osslsigncode command not found on the PATH! Please install it using 'pacman -S mingw-w64-osslsigncode'."
fi fi
} }
@ -851,7 +851,7 @@ appsign() {
exit 1 exit 1
fi fi
checkSigntoolCommandExists checkOsslsigncodeCommandExists
if [[ ! -f "${signtool_key}" ]]; then if [[ ! -f "${signtool_key}" ]]; then
exitError "Key file was not found!" exitError "Key file was not found!"
@ -862,12 +862,18 @@ appsign() {
for f in "${sign_files[@]}"; do for f in "${sign_files[@]}"; do
if [[ ${f: -4} == '.exe' ]]; then if [[ ${f: -4} == '.exe' ]]; then
logInfo "Signing file '${f}' using signtool..." logInfo "Signing file '${f}' using osslsigncode..."
signtool sign -f "${signtool_key}" -p "${password}" -v -t "http://timestamp.comodoca.com/authenticode" "${f}" # output a signed exe; we have to use a different name due to osslsigntool limitations
osslsigncode sign -pkcs12 "${signtool_key}" -pass "${password}" \
-t "http://timestamp.comodoca.com/authenticode" -in "${f}" -out "${f}.signed"
if [ 0 -ne $? ]; then if [ 0 -ne $? ]; then
rm -f "${f}.signed"
exitError "Signing failed!" exitError "Signing failed!"
fi fi
# overwrite the original exe with the signed exe
mv -f "${f}.signed" "${f}"
else else
logInfo "Skipping non-EXE file '${f}'..." logInfo "Skipping non-EXE file '${f}'..."
fi fi