Skip to content

Commit

Permalink
CA-335410: Corrected build script to sign the produced msi files. Cor…
Browse files Browse the repository at this point in the history
…rected utility script.

Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 committed Feb 20, 2020
1 parent dc9d3a5 commit fb31bf6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 33 deletions.
38 changes: 13 additions & 25 deletions mk/build-installers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,36 +100,23 @@ compile_installer()
mkdir -p out${name}

${LIGHT} -nologo obj${name}/$1.wixobj lib/WixUI_InstallDir.wixlib -loc wixlib/wixui_$2.wxl -loc $2.wxl -ext WiXNetFxExtension -out out${name}/${name}.msi
cp out${name}/${name}.msi ${WIX}
}

sign_msi()
{
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ] || [ -z "$6" ] ; then
echo "Some signing parameters are not set; skip signing binaries"
else
cd ${WIX}/out$1 && chmod a+rw $1.msi && ${SIGN_BAT} $1.msi "${SIGN_DESCR}"
fi
}

#create just english msi
if [ "XenCenter" != "${BRANDING_BRAND_CONSOLE}" ]
then
cd ${WIX}
mv XenCenter.wxs ${BRANDING_BRAND_CONSOLE}.wxs
mv XenCenter.l10n.wxs ${BRANDING_BRAND_CONSOLE}.l10n.wxs
fi

compile_installer "${BRANDING_BRAND_CONSOLE}" "en-us" && sign_msi "${BRANDING_BRAND_CONSOLE}"
#create just english msi
compile_installer "${BRANDING_BRAND_CONSOLE}" "en-us"

#then create l10n msi containing all resources
compile_installer "${BRANDING_BRAND_CONSOLE}.l10n" "en-us" && sign_msi "${BRANDING_BRAND_CONSOLE}.l10n"
compile_installer "${BRANDING_BRAND_CONSOLE}.l10n" "ja-jp" && sign_msi "${BRANDING_BRAND_CONSOLE}.l10n.ja-jp"
compile_installer "${BRANDING_BRAND_CONSOLE}.l10n" "zh-cn" && sign_msi "${BRANDING_BRAND_CONSOLE}.l10n.zh-cn"

cp ${WIX}/out${BRANDING_BRAND_CONSOLE}.l10n/${BRANDING_BRAND_CONSOLE}.l10n.msi \
${WIX}/out${BRANDING_BRAND_CONSOLE}.l10n.ja-jp/${BRANDING_BRAND_CONSOLE}.l10n.ja-jp.msi \
${WIX}/out${BRANDING_BRAND_CONSOLE}.l10n.zh-cn/${BRANDING_BRAND_CONSOLE}.l10n.zh-cn.msi \
${WIX}
compile_installer "${BRANDING_BRAND_CONSOLE}.l10n" "en-us"
compile_installer "${BRANDING_BRAND_CONSOLE}.l10n" "ja-jp"
compile_installer "${BRANDING_BRAND_CONSOLE}.l10n" "zh-cn"

cd ${WIX} && cp ${BRANDING_BRAND_CONSOLE}.l10n.msi ${BRANDING_BRAND_CONSOLE}.l10n.zh-tw.msi
cd ${WIX} && cscript /nologo CodePageChange.vbs ZH-TW ${BRANDING_BRAND_CONSOLE}.l10n.zh-tw.msi
Expand All @@ -142,13 +129,14 @@ cd ${WIX} && wscript WiSubStg.vbs ${BRANDING_BRAND_CONSOLE}.l10n.msi ja-jp.mst 1
cd ${WIX} && wscript WiSubStg.vbs ${BRANDING_BRAND_CONSOLE}.l10n.msi zh-cn.mst 2052
cd ${WIX} && wscript WiSubStg.vbs ${BRANDING_BRAND_CONSOLE}.l10n.msi zh-tw.mst 1028

#sign again the combined msi because it seems the embedding breaks the signature
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ] || [ -z "$6" ] ; then
#copy installers to output directory and sign them
cd ${WIX} && chmod a+rw ${BRANDING_BRAND_CONSOLE}.msi ${BRANDING_BRAND_CONSOLE}.l10n.msi

if [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ] || [ -z "$6" ] ; then
echo "Some signing parameters are not set; skip signing binaries"
else
cd ${WIX} && chmod a+rw ${BRANDING_BRAND_CONSOLE}.l10n.msi && ${SIGN_BAT} ${BRANDING_BRAND_CONSOLE}.l10n.msi "${SIGN_DESCR}"
cd ${WIX} && ${SIGN_BAT} ${BRANDING_BRAND_CONSOLE}.msi ${SIGN_DESCR}
cd ${WIX} && ${SIGN_BAT} ${BRANDING_BRAND_CONSOLE}.l10n.msi ${SIGN_DESCR}
fi

#copy the msi installers
cp ${WIX}/out${BRANDING_BRAND_CONSOLE}/${BRANDING_BRAND_CONSOLE}.msi ${OUTPUT_DIR}
cp ${WIX}/${BRANDING_BRAND_CONSOLE}.l10n.msi ${OUTPUT_DIR}
cp ${WIX}/${BRANDING_BRAND_CONSOLE}.msi ${WIX}/${BRANDING_BRAND_CONSOLE}.l10n.msi ${OUTPUT_DIR}
1 change: 1 addition & 0 deletions mk/sign.bat
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ if "%sbe%"=="true" (
--cross-sign --pagehashes yes "%thefile%"
)
%CTXSIGN% --end
echo.

) else (
echo "Self signing"
Expand Down
21 changes: 13 additions & 8 deletions packages/download_packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ Param(
[String]$DOMAIN,

[Parameter(HelpMessage ="Whether to download symbols (*.pdb files)")]
[switch]$SYMBOLS
[switch]$SYMBOLS,

[Parameter(HelpMessage ="Whether to download all packages needed to build the installer")]
[switch]$ZIP
)

$DOMAIN = $DOMAIN.Trim()
$PACKAGE_DIR = Get-Item "$PSScriptRoot" | select -ExpandProperty FullName
$PACKAGE_DIR = Get-Item "$PSScriptRoot\" | select -ExpandProperty FullName
$MK_DIR = Get-Item "$PSScriptRoot\..\mk" | select -ExpandProperty FullName

#dotnet packages
Expand All @@ -56,12 +59,14 @@ foreach($dep in $DEPS_MAP.files) {
$pattern = "https://$DOMAIN/" + $dep.pattern
$filename = Split-Path $pattern -leaf

if (($filename -eq "putty.exe") -or ($filename -like "*.dll")) {
Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$filename"
if (($filename -like "*.dll") -and $SYMBOLS) {
$symbolfile = [IO.Path]::GetFileNameWithoutExtension($filename) + ".pdb"
Write-Output "Downloading $symbolfile"
Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$symbolfile"
}

if ($SYMBOLS) {
$symbolfile = [IO.Path]::GetFileNameWithoutExtension($filename) + ".pdb"
Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$symbolfile"
}
if (($filename -eq "putty.exe") -or ($filename -like "*.dll") -or (($filename -like "*.zip") -and $ZIP)) {
Write-Output "Downloading $filename"
Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$filename"
}
}

0 comments on commit fb31bf6

Please sign in to comment.