Loading projects/browser/build +14 −7 Original line number Original line Diff line number Diff line Loading @@ -285,9 +285,14 @@ done export PATH="/var/tmp/dist/nsis/bin:$PATH" export PATH="/var/tmp/dist/nsis/bin:$PATH" mv $rootdir/windows-installer $distdir/windows-installer mv $rootdir/windows-installer $distdir/windows-installer cat > $distdir/windows-installer/browser.nsi << 'BROWSER_NSI' cat > $distdir/windows-installer/browser-portable.nsi << 'BROWSER_NSI' [% INCLUDE 'windows-installer.nsi' %] [% INCLUDE 'windows-installer.nsi' %] BROWSER_NSI BROWSER_NSI [% IF c('var/privacy-browser') -%] cat > $distdir/windows-installer/browser-system.nsi << 'BROWSER_NSI' [% INCLUDE 'windows-installer.nsi' system_install_mode = 1 %] BROWSER_NSI [% END -%] mv ${TB_STAGE_DIR} $distdir/windows-installer/"[% c('var/Project_Name') %]" mv ${TB_STAGE_DIR} $distdir/windows-installer/"[% c('var/Project_Name') %]" mv $distdir/windows-installer ${TB_STAGE_DIR} mv $distdir/windows-installer ${TB_STAGE_DIR} [% END %] [% END %] Loading Loading @@ -357,13 +362,15 @@ cd $distdir [% ELSIF c("var/windows") %] [% ELSIF c("var/windows") %] find "$PKG_DIR" -exec [% c("touch") %] {} \; find "$PKG_DIR" -exec [% c("touch") %] {} \; pushd "$PKG_DIR" pushd "$PKG_DIR" makensis browser.nsi makensis browser-portable.nsi # Working around NSIS braindamage # Working around NSIS braindamage mv [% c("var/projectname") %]-install.exe browser-install-tmp.exe python3 $rootdir/pe_checksum_fix.py browser-install.exe python3 $rootdir/pe_checksum_fix.py mv browser-install.exe $OUTDIR/[% c("var/projectname") %]-install[% IF c("var/windows-x86_64") %]-win64[% END %]-[% c("var/torbrowser_version") %]_${PKG_LOCALE}.exe mv browser-install-tmp2.exe [% c("var/projectname") %]-install.exe [% IF c('var/privacy-browser') -%] rm browser-install-tmp.exe makensis browser-system.nsi mv [% c("var/projectname") %]-install.exe $OUTDIR/[% c("var/projectname") %]-install[% IF c("var/windows-x86_64") %]-win64[% END %]-[% c("var/torbrowser_version") %]_${PKG_LOCALE}.exe python3 $rootdir/pe_checksum_fix.py browser-install.exe mv browser-install.exe $OUTDIR/[% c("var/projectname") %]-systeminstall[% IF c("var/windows-x86_64") %]-win64[% END %]-[% c("var/torbrowser_version") %]_${PKG_LOCALE}.exe [% END -%] popd popd [% END %] [% END %] rm -rf $distdir/${PKG_DIR} rm -rf $distdir/${PKG_DIR} Loading projects/browser/pe_checksum_fix.py +12 −6 Original line number Original line Diff line number Diff line Loading @@ -43,14 +43,20 @@ recalculates the PE-file checksum. Details of the discussion can be found in bug Thanks to a cypherpunk for this workaround idea. Thanks to a cypherpunk for this workaround idea. """ """ import pefile; import pefile import sys f = open('browser-install-tmp.exe', 'rb') if len(sys.argv) < 2: print('Usage: {} exe-name'.format(sys.argv[0])) sys.exit(1) exename = sys.argv[1] with open(exename, 'rb') as f: exe = f.read() exe = f.read() f.close() remainder = len(exe) % 8 remainder = len(exe) % 8 if remainder > 0: if remainder > 0: exe += bytes('\0' * (8 - remainder), 'utf-8') exe += b'\0' * (8 - remainder) pef = pefile.PE(data=exe, fast_load=True) pef = pefile.PE(data=exe, fast_load=True) pef.OPTIONAL_HEADER.CheckSum = pef.generate_checksum() pef.OPTIONAL_HEADER.CheckSum = pef.generate_checksum() pef.write(filename='browser-install-tmp2.exe') pef.write(filename=exename) projects/browser/windows-installer.nsi +53 −7 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,7 @@ ;-------------------------------- ;-------------------------------- ;Modern UI ;Modern UI !include "FileFunc.nsh" !include "MUI2.nsh" !include "MUI2.nsh" !include "LogicLib.nsh" !include "LogicLib.nsh" !include "WinVer.nsh" !include "WinVer.nsh" Loading @@ -12,25 +13,38 @@ ;-------------------------------- ;-------------------------------- ;General ;General ; location of Tor/Base/Privacy Browser to put into installer ;Location of Tor/Base/Privacy Browser to put into installer !define PROGRAM_SOURCE ".\[% c('var/Project_Name') %]\" !define PROGRAM_SOURCE ".\[% c('var/Project_Name') %]\" Name "[% c('var/Project_Name') %]" Name "[% c('var/Project_Name') %]" OutFile "[% c('var/projectname') %]-install.exe" OutFile "browser-install.exe" ;Default installation folder ;Default installation folder [% IF system_install_mode -%] InstallDir "$PROGRAMFILES\[% c('var/Project_Name') %]" [% ELSE -%] InstallDir "$DESKTOP\[% c('var/Project_Name') %]" InstallDir "$DESKTOP\[% c('var/Project_Name') %]" [% END -%] ;Best (but slowest) compression ;Best (but slowest) compression SetCompressor /SOLID lzma SetCompressor /SOLID lzma SetCompressorDictSize 32 SetCompressorDictSize 32 ;Request application privileges for Windows Vista ;Request application privileges for Windows Vista [% IF system_install_mode -%] RequestExecutionLevel admin [% ELSE -%] RequestExecutionLevel user RequestExecutionLevel user [% END -%] ;Support HiDPI displays ;Support HiDPI displays ManifestDPIAware true ManifestDPIAware true [% IF system_install_mode -%] ;Registry keys to uninstall system-wide installs !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\[% c('var/ProjectName') %]" [% END -%] ;-------------------------------- ;-------------------------------- ;Interface Configuration ;Interface Configuration Loading Loading @@ -133,16 +147,49 @@ Section "[% c('var/Project_Name') %]" SecBrowser Section "[% c('var/Project_Name') %]" SecBrowser SetOutPath "$INSTDIR" SetOutPath "$INSTDIR" [% IF !system_install_mode -%] File /r "${PROGRAM_SOURCE}\*.*" File /r "${PROGRAM_SOURCE}\*.*" SetOutPath "$INSTDIR\Browser" CreateShortCut "$INSTDIR\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe" CreateShortCut "$INSTDIR\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe" [% ELSE -%] File /r "${PROGRAM_SOURCE}\Browser\*.*" ;Enable system-wide install in the browser FileOpen $0 "$INSTDIR\system-install" w FileClose $0 ;Write the uninstaller WriteUninstaller $INSTDIR\uninstall.exe ;Add the uninstaller to the control panel WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "[% c('var/Project_Name') %]" WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$\"$INSTDIR\[% c('var/exe_name') %].exe$\"" WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" "1" WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" "1" ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0" [% END -%] SectionEnd SectionEnd Function CreateShortcuts [% IF system_install_mode -%] Section "Uninstall" RMDir /r "$INSTDIR" DeleteRegKey HKLM "${UNINST_KEY}" SetShellVarContext all Delete "$SMPROGRAMS\[% c('var/Project_Name') %].lnk" Delete "$DESKTOP\[% c('var/Project_Name') %].lnk" SectionEnd [% END -%] CreateShortCut "$SMPROGRAMS\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe" Function CreateShortcuts CreateShortCut "$DESKTOP\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe" [% IF system_install_mode -%] SetShellVarContext all [% END -%] CreateShortCut "$SMPROGRAMS\[% c('var/Project_Name') %].lnk" "$INSTDIR\[% IF !system_install_mode -%]Browser\[% END -%][% c('var/exe_name') %].exe" CreateShortCut "$DESKTOP\[% c('var/Project_Name') %].lnk" "$INSTDIR\[% IF !system_install_mode -%]Browser\[% END -%][% c('var/exe_name') %].exe" FunctionEnd FunctionEnd ;-------------------------------- ;-------------------------------- Loading Loading @@ -181,7 +228,6 @@ ${If} ${FileExists} "$INSTDIR\*.*" ${EndIf} ${EndIf} FunctionEnd FunctionEnd Function StartBrowser Function StartBrowser ExecShell "open" "$INSTDIR/Start [% c('var/Project_Name') %].lnk" ExecShell "open" "$INSTDIR/Start [% c('var/Project_Name') %].lnk" FunctionEnd FunctionEnd Loading Loading
projects/browser/build +14 −7 Original line number Original line Diff line number Diff line Loading @@ -285,9 +285,14 @@ done export PATH="/var/tmp/dist/nsis/bin:$PATH" export PATH="/var/tmp/dist/nsis/bin:$PATH" mv $rootdir/windows-installer $distdir/windows-installer mv $rootdir/windows-installer $distdir/windows-installer cat > $distdir/windows-installer/browser.nsi << 'BROWSER_NSI' cat > $distdir/windows-installer/browser-portable.nsi << 'BROWSER_NSI' [% INCLUDE 'windows-installer.nsi' %] [% INCLUDE 'windows-installer.nsi' %] BROWSER_NSI BROWSER_NSI [% IF c('var/privacy-browser') -%] cat > $distdir/windows-installer/browser-system.nsi << 'BROWSER_NSI' [% INCLUDE 'windows-installer.nsi' system_install_mode = 1 %] BROWSER_NSI [% END -%] mv ${TB_STAGE_DIR} $distdir/windows-installer/"[% c('var/Project_Name') %]" mv ${TB_STAGE_DIR} $distdir/windows-installer/"[% c('var/Project_Name') %]" mv $distdir/windows-installer ${TB_STAGE_DIR} mv $distdir/windows-installer ${TB_STAGE_DIR} [% END %] [% END %] Loading Loading @@ -357,13 +362,15 @@ cd $distdir [% ELSIF c("var/windows") %] [% ELSIF c("var/windows") %] find "$PKG_DIR" -exec [% c("touch") %] {} \; find "$PKG_DIR" -exec [% c("touch") %] {} \; pushd "$PKG_DIR" pushd "$PKG_DIR" makensis browser.nsi makensis browser-portable.nsi # Working around NSIS braindamage # Working around NSIS braindamage mv [% c("var/projectname") %]-install.exe browser-install-tmp.exe python3 $rootdir/pe_checksum_fix.py browser-install.exe python3 $rootdir/pe_checksum_fix.py mv browser-install.exe $OUTDIR/[% c("var/projectname") %]-install[% IF c("var/windows-x86_64") %]-win64[% END %]-[% c("var/torbrowser_version") %]_${PKG_LOCALE}.exe mv browser-install-tmp2.exe [% c("var/projectname") %]-install.exe [% IF c('var/privacy-browser') -%] rm browser-install-tmp.exe makensis browser-system.nsi mv [% c("var/projectname") %]-install.exe $OUTDIR/[% c("var/projectname") %]-install[% IF c("var/windows-x86_64") %]-win64[% END %]-[% c("var/torbrowser_version") %]_${PKG_LOCALE}.exe python3 $rootdir/pe_checksum_fix.py browser-install.exe mv browser-install.exe $OUTDIR/[% c("var/projectname") %]-systeminstall[% IF c("var/windows-x86_64") %]-win64[% END %]-[% c("var/torbrowser_version") %]_${PKG_LOCALE}.exe [% END -%] popd popd [% END %] [% END %] rm -rf $distdir/${PKG_DIR} rm -rf $distdir/${PKG_DIR} Loading
projects/browser/pe_checksum_fix.py +12 −6 Original line number Original line Diff line number Diff line Loading @@ -43,14 +43,20 @@ recalculates the PE-file checksum. Details of the discussion can be found in bug Thanks to a cypherpunk for this workaround idea. Thanks to a cypherpunk for this workaround idea. """ """ import pefile; import pefile import sys f = open('browser-install-tmp.exe', 'rb') if len(sys.argv) < 2: print('Usage: {} exe-name'.format(sys.argv[0])) sys.exit(1) exename = sys.argv[1] with open(exename, 'rb') as f: exe = f.read() exe = f.read() f.close() remainder = len(exe) % 8 remainder = len(exe) % 8 if remainder > 0: if remainder > 0: exe += bytes('\0' * (8 - remainder), 'utf-8') exe += b'\0' * (8 - remainder) pef = pefile.PE(data=exe, fast_load=True) pef = pefile.PE(data=exe, fast_load=True) pef.OPTIONAL_HEADER.CheckSum = pef.generate_checksum() pef.OPTIONAL_HEADER.CheckSum = pef.generate_checksum() pef.write(filename='browser-install-tmp2.exe') pef.write(filename=exename)
projects/browser/windows-installer.nsi +53 −7 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,7 @@ ;-------------------------------- ;-------------------------------- ;Modern UI ;Modern UI !include "FileFunc.nsh" !include "MUI2.nsh" !include "MUI2.nsh" !include "LogicLib.nsh" !include "LogicLib.nsh" !include "WinVer.nsh" !include "WinVer.nsh" Loading @@ -12,25 +13,38 @@ ;-------------------------------- ;-------------------------------- ;General ;General ; location of Tor/Base/Privacy Browser to put into installer ;Location of Tor/Base/Privacy Browser to put into installer !define PROGRAM_SOURCE ".\[% c('var/Project_Name') %]\" !define PROGRAM_SOURCE ".\[% c('var/Project_Name') %]\" Name "[% c('var/Project_Name') %]" Name "[% c('var/Project_Name') %]" OutFile "[% c('var/projectname') %]-install.exe" OutFile "browser-install.exe" ;Default installation folder ;Default installation folder [% IF system_install_mode -%] InstallDir "$PROGRAMFILES\[% c('var/Project_Name') %]" [% ELSE -%] InstallDir "$DESKTOP\[% c('var/Project_Name') %]" InstallDir "$DESKTOP\[% c('var/Project_Name') %]" [% END -%] ;Best (but slowest) compression ;Best (but slowest) compression SetCompressor /SOLID lzma SetCompressor /SOLID lzma SetCompressorDictSize 32 SetCompressorDictSize 32 ;Request application privileges for Windows Vista ;Request application privileges for Windows Vista [% IF system_install_mode -%] RequestExecutionLevel admin [% ELSE -%] RequestExecutionLevel user RequestExecutionLevel user [% END -%] ;Support HiDPI displays ;Support HiDPI displays ManifestDPIAware true ManifestDPIAware true [% IF system_install_mode -%] ;Registry keys to uninstall system-wide installs !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\[% c('var/ProjectName') %]" [% END -%] ;-------------------------------- ;-------------------------------- ;Interface Configuration ;Interface Configuration Loading Loading @@ -133,16 +147,49 @@ Section "[% c('var/Project_Name') %]" SecBrowser Section "[% c('var/Project_Name') %]" SecBrowser SetOutPath "$INSTDIR" SetOutPath "$INSTDIR" [% IF !system_install_mode -%] File /r "${PROGRAM_SOURCE}\*.*" File /r "${PROGRAM_SOURCE}\*.*" SetOutPath "$INSTDIR\Browser" CreateShortCut "$INSTDIR\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe" CreateShortCut "$INSTDIR\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe" [% ELSE -%] File /r "${PROGRAM_SOURCE}\Browser\*.*" ;Enable system-wide install in the browser FileOpen $0 "$INSTDIR\system-install" w FileClose $0 ;Write the uninstaller WriteUninstaller $INSTDIR\uninstall.exe ;Add the uninstaller to the control panel WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "[% c('var/Project_Name') %]" WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$\"$INSTDIR\[% c('var/exe_name') %].exe$\"" WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" "1" WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" "1" ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0" [% END -%] SectionEnd SectionEnd Function CreateShortcuts [% IF system_install_mode -%] Section "Uninstall" RMDir /r "$INSTDIR" DeleteRegKey HKLM "${UNINST_KEY}" SetShellVarContext all Delete "$SMPROGRAMS\[% c('var/Project_Name') %].lnk" Delete "$DESKTOP\[% c('var/Project_Name') %].lnk" SectionEnd [% END -%] CreateShortCut "$SMPROGRAMS\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe" Function CreateShortcuts CreateShortCut "$DESKTOP\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe" [% IF system_install_mode -%] SetShellVarContext all [% END -%] CreateShortCut "$SMPROGRAMS\[% c('var/Project_Name') %].lnk" "$INSTDIR\[% IF !system_install_mode -%]Browser\[% END -%][% c('var/exe_name') %].exe" CreateShortCut "$DESKTOP\[% c('var/Project_Name') %].lnk" "$INSTDIR\[% IF !system_install_mode -%]Browser\[% END -%][% c('var/exe_name') %].exe" FunctionEnd FunctionEnd ;-------------------------------- ;-------------------------------- Loading Loading @@ -181,7 +228,6 @@ ${If} ${FileExists} "$INSTDIR\*.*" ${EndIf} ${EndIf} FunctionEnd FunctionEnd Function StartBrowser Function StartBrowser ExecShell "open" "$INSTDIR/Start [% c('var/Project_Name') %].lnk" ExecShell "open" "$INSTDIR/Start [% c('var/Project_Name') %].lnk" FunctionEnd FunctionEnd Loading