2021-10-27 08:47:27 +00:00
|
|
|
@rem This script creates the Rufus appxupload for upload to the Windows Store.
|
|
|
|
@rem It attemps to follow as closely as possible what Visual Studio does.
|
2017-04-20 11:58:04 +00:00
|
|
|
@echo off
|
2018-10-26 13:05:43 +00:00
|
|
|
setlocal EnableExtensions DisableDelayedExpansion
|
2017-05-14 12:22:16 +00:00
|
|
|
|
2021-10-27 08:47:27 +00:00
|
|
|
goto main
|
|
|
|
|
|
|
|
:ReplaceTokenInFile
|
|
|
|
setlocal EnableDelayedExpansion
|
|
|
|
set FILE=%~1
|
|
|
|
set TOKEN=%~2
|
|
|
|
set VALUE=%~3
|
|
|
|
for /f "delims=" %%i in ('type %FILE% ^& break ^> %FILE%') do (
|
|
|
|
set "line=%%i"
|
|
|
|
>>%FILE% echo(!line:%TOKEN%=%VALUE%!
|
|
|
|
)
|
|
|
|
endlocal
|
|
|
|
exit /B 0
|
|
|
|
|
|
|
|
:main
|
2017-05-14 12:22:16 +00:00
|
|
|
del /q *.appx >NUL 2>&1
|
2018-10-26 13:05:43 +00:00
|
|
|
del /q *.appxbundle >NUL 2>&1
|
|
|
|
del /q *.map >NUL 2>&1
|
2017-05-14 12:22:16 +00:00
|
|
|
|
2021-11-22 20:11:10 +00:00
|
|
|
set WDK_PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64
|
2021-10-27 08:47:27 +00:00
|
|
|
set ZIP_PATH=C:\Program Files\7-Zip
|
2022-01-09 15:02:50 +00:00
|
|
|
set SIGNATURE_SHA1=3dbc3a2a0e9ce8803b422cfdbc60acd33164965d
|
2018-10-26 13:05:43 +00:00
|
|
|
set MANIFEST=AppxManifest.xml
|
|
|
|
set ARCHS=x86 x64 arm arm64
|
2021-10-27 08:47:27 +00:00
|
|
|
set DEFAULT_SCALE=200
|
|
|
|
set OTHER_SCALES=100 125 150 400
|
|
|
|
set SCALED_IMAGES=LargeTile SmallTile Square44x44Logo Square150x150Logo StoreLogo Wide310x150Logo
|
2022-08-10 21:50:17 +00:00
|
|
|
rem All the languages listed below *MUST* match the ones from the Resources section of AppManifest.xml
|
2022-08-12 10:09:04 +00:00
|
|
|
rem Oh, and these must be *valid* codes that Microsoft accepts, else your users will get an error
|
|
|
|
rem (that the Microsoft validation and certification process will *NOT* catch) during install.
|
2022-08-10 21:50:17 +00:00
|
|
|
set DEFAULT_LANGUAGE=en-US
|
2022-08-12 10:09:04 +00:00
|
|
|
set ADDITIONAL_LANGUAGES=ar-SA bg-BG zh-CN zh-TW hr-HR cs-CZ da-DK nl-NL fi-FI fr-FR de-DE el-GR he-IL hu-HU id-ID it-IT ja-JP ko-KR lv-LV lt-LT ms-MY nb-NO fa-IR pl-PL pt-BR pt-PT ro-RO ru-RU sr-Latn-RS sk-SK sl-SI es-ES sv-SE th-TH tr-TR uk-UA vi-VN
|
2021-10-27 08:47:27 +00:00
|
|
|
set PACKAGE_IMAGES=^
|
|
|
|
Square44x44Logo.altform-lightunplated_targetsize-16.png^
|
|
|
|
Square44x44Logo.altform-lightunplated_targetsize-24.png^
|
|
|
|
Square44x44Logo.altform-lightunplated_targetsize-256.png^
|
|
|
|
Square44x44Logo.altform-lightunplated_targetsize-32.png^
|
|
|
|
Square44x44Logo.altform-lightunplated_targetsize-48.png^
|
|
|
|
Square44x44Logo.altform-unplated_targetsize-16.png^
|
|
|
|
Square44x44Logo.altform-unplated_targetsize-256.png^
|
|
|
|
Square44x44Logo.altform-unplated_targetsize-32.png^
|
|
|
|
Square44x44Logo.altform-unplated_targetsize-48.png^
|
|
|
|
Square44x44Logo.targetsize-16.png^
|
|
|
|
Square44x44Logo.targetsize-24.png^
|
|
|
|
Square44x44Logo.targetsize-24_altform-unplated.png^
|
|
|
|
Square44x44Logo.targetsize-256.png^
|
|
|
|
Square44x44Logo.targetsize-32.png^
|
|
|
|
Square44x44Logo.targetsize-48.png
|
2018-10-26 13:05:43 +00:00
|
|
|
|
2020-06-18 10:42:57 +00:00
|
|
|
rem if you don't set the temp/tmp you get:
|
|
|
|
rem error MSB6001: Invalid command line switch for "CL.exe". System.ArgumentExcep Key being added: 'TEMP'
|
|
|
|
set temp=
|
|
|
|
set tmp=
|
|
|
|
|
2018-10-26 13:05:43 +00:00
|
|
|
cd /d "%~dp0"
|
2021-10-27 08:47:27 +00:00
|
|
|
|
2018-10-26 13:05:43 +00:00
|
|
|
for %%a in (%ARCHS%) do (
|
2021-10-27 08:47:27 +00:00
|
|
|
if not exist rufus_%%a.exe (
|
|
|
|
echo rufus_%%a.exe is missing from the current directory
|
|
|
|
goto out
|
|
|
|
)
|
2018-10-26 13:05:43 +00:00
|
|
|
)
|
2021-10-27 08:47:27 +00:00
|
|
|
|
|
|
|
rem Populate the version from the executable
|
|
|
|
set target=%~dp0rufus_x64.exe
|
|
|
|
set target=%target:\=\\%
|
|
|
|
wmic datafile where "name='%target%'" get version | find /v "Version" > version.txt
|
|
|
|
set /p VERSION=<version.txt
|
|
|
|
set VERSION=%VERSION: =%
|
|
|
|
del version.txt
|
|
|
|
|
|
|
|
echo Will create %VERSION% AppStore Bundle
|
|
|
|
pause
|
|
|
|
|
2021-11-22 20:11:10 +00:00
|
|
|
"%WDK_PATH%\signtool" sign /v /sha1 %SIGNATURE_SHA1% /fd SHA256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 *.exe
|
2017-04-20 11:58:04 +00:00
|
|
|
if ERRORLEVEL 1 goto out
|
2018-10-26 13:05:43 +00:00
|
|
|
|
|
|
|
echo [Files]> bundle.map
|
|
|
|
|
2022-08-10 21:50:17 +00:00
|
|
|
rem Now who the £$%^&* at Microsoft thought it was a good idea to have MakePri require '/dq lang-en-US_lang-fr-FR-...'
|
|
|
|
rem so that you actually end up with a <qualifier name="Language" value="en-US;fr-FR;..."/> in priconfig.xml?!?
|
|
|
|
rem Oh, and of course, good luck finding this documented ANYWHERE on Microsoft's website!
|
|
|
|
setlocal EnableDelayedExpansion
|
|
|
|
set STUPID_MAKEPRI_LANGUAGES=lang-%DEFAULT_LANGUAGE%
|
|
|
|
for %%l in (%ADDITIONAL_LANGUAGES%) do (
|
|
|
|
set STUPID_MAKEPRI_LANGUAGES=!STUPID_MAKEPRI_LANGUAGES!_lang-%%l
|
|
|
|
)
|
|
|
|
setlocal DisableDelayedExpansion
|
|
|
|
|
2018-10-26 13:05:43 +00:00
|
|
|
for %%a in (%ARCHS%) do (
|
2021-10-27 08:47:27 +00:00
|
|
|
echo.
|
|
|
|
echo Creating Rufus_%VERSION%_%%a.appx...
|
2018-10-26 13:05:43 +00:00
|
|
|
cd /d "%~dp0"
|
2021-10-27 08:47:27 +00:00
|
|
|
echo "Rufus_%VERSION%_%%a.appx" "Rufus_%VERSION%_%%a.appx">> bundle.map
|
2018-10-26 13:05:43 +00:00
|
|
|
mkdir %%a >NUL 2>&1
|
|
|
|
cd %%a
|
2021-10-27 08:47:27 +00:00
|
|
|
mkdir Images >NUL 2>&1
|
|
|
|
for %%i in (%PACKAGE_IMAGES%) do (
|
|
|
|
copy "..\Images\%%i" Images\ >NUL 2>&1
|
|
|
|
)
|
|
|
|
for %%i in (%SCALED_IMAGES%) do (
|
|
|
|
copy "..\Images\%%i.scale-%DEFAULT_SCALE%.png" Images\ >NUL 2>&1
|
2018-10-26 13:05:43 +00:00
|
|
|
)
|
2021-10-27 08:47:27 +00:00
|
|
|
mkdir rufus
|
|
|
|
copy "..\rufus_%%a.exe" "rufus\rufus.exe" >NUL 2>&1
|
|
|
|
copy /y NUL "rufus\rufus.app" >NUL 2>&1
|
|
|
|
rem When invoking MakePri, it is very important that you don't have files such as AppxManifest.xml or priconfig.xml
|
|
|
|
rem in the directory referenced by /pr or you may get ERROR_MRM_DUPLICATE_ENTRY when validating the submission as,
|
|
|
|
rem for instance, the 'AppxManifest.xml' from the 100% scale bundle will conflict the one from the x64 bundle.
|
2022-08-10 21:50:17 +00:00
|
|
|
"%WDK_PATH%\MakePri" createconfig /o /pv 10.0.0 /cf ..\priconfig.xml /dq %STUPID_MAKEPRI_LANGUAGES%_scale-%DEFAULT_SCALE%_theme-light
|
2021-10-27 08:47:27 +00:00
|
|
|
"%WDK_PATH%\MakePri" new /o /pr . /cf ..\priconfig.xml
|
|
|
|
del /q ..\priconfig.xml
|
|
|
|
copy ..\RufusAppxManifest.xml %MANIFEST% >NUL 2>&1
|
|
|
|
call:ReplaceTokenInFile %MANIFEST% @ARCH@ %%a
|
|
|
|
call:ReplaceTokenInFile %MANIFEST% @VERSION@ %VERSION%
|
|
|
|
"%WDK_PATH%\MakeAppx" pack /o /d . /p ..\Rufus_%VERSION%_%%a.appx
|
2018-10-26 13:05:43 +00:00
|
|
|
if ERRORLEVEL 1 goto out
|
|
|
|
)
|
|
|
|
|
2021-10-27 08:47:27 +00:00
|
|
|
for %%a in (%OTHER_SCALES%) do (
|
|
|
|
echo.
|
|
|
|
echo Creating Rufus_%VERSION%_scale-%%a.appx...
|
|
|
|
cd /d "%~dp0"
|
|
|
|
echo "Rufus_%VERSION%_scale-%%a.appx" "Rufus_%VERSION%_scale-%%a.appx">> bundle.map
|
|
|
|
mkdir %%a >NUL 2>&1
|
|
|
|
cd %%a
|
|
|
|
mkdir Images >NUL 2>&1
|
|
|
|
for %%i in (%SCALED_IMAGES%) do (
|
|
|
|
copy "..\Images\%%i.scale-%%a.png" Images\ >NUL 2>&1
|
|
|
|
)
|
2022-08-10 21:50:17 +00:00
|
|
|
"%WDK_PATH%\MakePri" createconfig /o /pv 10.0.0 /cf ..\priconfig.xml /dq %STUPID_MAKEPRI_LANGUAGES%_scale-%%a_theme-light
|
2021-10-27 08:47:27 +00:00
|
|
|
"%WDK_PATH%\MakePri" new /o /pr . /cf ..\priconfig.xml
|
|
|
|
del /q ..\priconfig.xml
|
|
|
|
copy ..\ScaleAppxManifest.xml %MANIFEST% >NUL 2>&1
|
|
|
|
call:ReplaceTokenInFile %MANIFEST% @SCALE@ %%a
|
|
|
|
call:ReplaceTokenInFile %MANIFEST% @VERSION@ %VERSION%
|
|
|
|
"%WDK_PATH%\MakeAppx" pack /o /d . /p ..\Rufus_%VERSION%_scale-%%a.appx
|
|
|
|
)
|
|
|
|
|
|
|
|
setlocal EnableDelayedExpansion
|
|
|
|
set ALL_ARCHS=
|
|
|
|
for %%a in (%ARCHS%) do set ALL_ARCHS=!ALL_ARCHS!_%%a
|
2018-10-26 13:05:43 +00:00
|
|
|
cd /d "%~dp0"
|
2021-10-27 08:47:27 +00:00
|
|
|
"%WDK_PATH%\MakeAppx" bundle /f bundle.map /bv %VERSION% /p Rufus_%VERSION%%ALL_ARCHS%.appxbundle
|
|
|
|
rem Visual Studio zips the appxbundle into an appxupload for store upload, so we do the same...
|
|
|
|
"%ZIP_PATH%\7z" a -tzip Rufus_%VERSION%%ALL_ARCHS%_bundle.appxupload Rufus_%VERSION%%ALL_ARCHS%.appxbundle
|
|
|
|
endlocal
|
2018-10-26 13:05:43 +00:00
|
|
|
|
2017-04-20 11:58:04 +00:00
|
|
|
:out
|
2018-10-26 13:05:43 +00:00
|
|
|
cd /d "%~dp0"
|
|
|
|
for %%a in (%ARCHS%) do (
|
|
|
|
rd /S /Q %%a >NUL 2>&1
|
|
|
|
)
|
2021-10-27 08:47:27 +00:00
|
|
|
for %%a in (%OTHER_SCALES%) do (
|
|
|
|
rd /S /Q %%a >NUL 2>&1
|
|
|
|
)
|
2018-10-26 13:05:43 +00:00
|
|
|
del /q *.map >NUL 2>&1
|
|
|
|
del /q *.appx >NUL 2>&1
|
2021-10-27 08:47:27 +00:00
|
|
|
del /q *.appxbundle >NUL 2>&1
|
2017-04-20 11:58:04 +00:00
|
|
|
pause
|
|
|
|
exit
|