msi: respect user's choice of terminal emulator
The MSI now knows how to respect the user's choice of terminal emulator. A few notes about the changes to files in this commit: - In generating GitComponents.wxs, the File element for git-bash.exe needed to have an Id that could be used to reference this file later on in the installation when modifying its string resources. - `edit-git-bash.exe` does not need to have any imports binded. I added a dummy DoNotBind attribute right after the opening of its associated File element to prevent the sed script which adds the `@BindPath` attribute from matching. Then later, this dummy attribute is removed. - The implementation of the TERMINAL property in `GitProduct.wxs` looks a bit different from the rest of the properties implemented earlier. That's because after thinking this through and looking at the previous property implementations, I discovered I made an (incorrect) assumption when implementing the previous properties. The "Remember Property" pattern is a bit tricky when there's a default value to contend with. (The previous properties will be fixed in a commit in the not too distant future.) Signed-off-by: Craig E. Shea <craig.e.shea@gmail.com>
This commit is contained in:
Родитель
e7f1eaab51
Коммит
ecc3a6a4b2
|
@ -72,7 +72,20 @@
|
|||
LINEENDINGS~="false"
|
||||
</SetProperty>
|
||||
|
||||
<Property Id="CMDLINE_TERMINAL" Value="MinTTY" />
|
||||
<Property Id="TERMINAL" Value="MinTTY" />
|
||||
<SetProperty Id="CMDLINE_TERMINAL" Value="[TERMINAL]" Before="AppSearch" Sequence="first"><![CDATA[ TERMINAL <> CMDLINE_TERMINAL AND (TERMINAL~="CmdPrompt" OR TERMINAL~="MinTTY") ]]></SetProperty>
|
||||
<Property Id="TERMINALSEARCH">
|
||||
<RegistrySearch Id="TerminalSearch" Root="HKLM" Key="SOFTWARE\GitForWindows" Name="Terminal" Type="raw" />
|
||||
</Property>
|
||||
<SetProperty Id="TERMINAL" Value="[TERMINALSEARCH]" Action="GetUpgradeTERMINALValue" After="AppSearch" Sequence="first">TERMINALSEARCH</SetProperty>
|
||||
<SetProperty Id="TERMINAL" Value="[CMDLINE_TERMINAL]" After="GetUpgradeTERMINALValue" Sequence="first"><![CDATA[ CMDLINE_TERMINAL <> TERMINAL ]]></SetProperty>
|
||||
<SetProperty Id="TERMINAL" Value="MinTTY" Action="NormalizeMinTTYCasing" After="SetTERMINAL" Sequence="first">
|
||||
TERMINAL~="MinTTY"
|
||||
</SetProperty>
|
||||
<SetProperty Id="TERMINAL" Value="CmdPrompt" Action="NormalizeCmdPromptCasing" After="SetTERMINAL" Sequence="first">
|
||||
TERMINAL~="CmdPrompt"
|
||||
</SetProperty>
|
||||
|
||||
<SetProperty Id="CMDLINE_ENABLEFSCACHE" Value="false" Before="AppSearch" Sequence="first">
|
||||
ENABLEFSCACHE~="false" OR ENABLEFSCACHE=0
|
||||
|
@ -342,6 +355,10 @@
|
|||
<CustomAction Id="ExecConfigureFsCache" BinaryKey="WixCA" DllEntry="WixQuietExec$(var.SixtyFourBit)" Execute="deferred" Return="ignore" Impersonate="no" />
|
||||
<SetProperty Id="ExecConfigureGcm" Value='"[#GitExe]" config --system credential.helper manager' Sequence="execute" Before="ExecConfigureGcm"><![CDATA[ REMOVE <> "ALL" AND ENABLEGCM=1 ]]></SetProperty>
|
||||
<CustomAction Id="ExecConfigureGcm" BinaryKey="WixCA" DllEntry="WixQuietExec$(var.SixtyFourBit)" Execute="deferred" Return="ignore" Impersonate="no" />
|
||||
<SetProperty Id="ExecEditGitBash" Value='"[#EditGitBash]" "[#GitBash]" "SHOW_CONSOLE=1 APPEND_QUOTE=1 @@COMSPEC@@ /S /C \"\"@@EXEPATH@@\usr\bin\bash.exe\" --login -i"' Sequence="execute" Before="ExecEditGitBash"><![CDATA[ REMOVE <> "ALL" AND TERMINAL = "CmdPrompt" ]]></SetProperty>
|
||||
<CustomAction Id="ExecEditGitBash" BinaryKey="WixCA" DllEntry="WixQuietExec$(var.SixtyFourBit)" Execute="deferred" Return="check" Impersonate="no" />
|
||||
<SetProperty Id="DeleteEditGitBash" Value='"[System$(var.SixtyFourBit)Folder]cmd.exe" /S /C del "[#EditGitBash]"' Sequence="execute" Before="DeleteEditGitBash"><![CDATA[ REMOVE <> "ALL" AND TERMINAL = "CmdPrompt" ]]></SetProperty>
|
||||
<CustomAction Id="DeleteEditGitBash" BinaryKey="WixCA" DllEntry="WixQuietExec$(var.SixtyFourBit)" Execute="deferred" Return="ignore" Impersonate="no" />
|
||||
<!-- Schedule two "best effort" actions:
|
||||
1. Write the command to run the post-install.bat to the transaction log
|
||||
2. Execute the command during the installation transaction
|
||||
|
@ -356,7 +373,9 @@
|
|||
<Custom Action="ExecConfigureSslCAInfo" Before="ExecConfigureCoreAutoCrlf"><![CDATA[ REMOVE <> "ALL" ]]></Custom>
|
||||
<Custom Action="ExecConfigureCoreAutoCrlf" Before="ExecConfigureFsCache"><![CDATA[ REMOVE <> "ALL" ]]></Custom>
|
||||
<Custom Action="ExecConfigureFsCache" Before="ExecConfigureGcm"><![CDATA[ REMOVE <> "ALL" ]]></Custom>
|
||||
<Custom Action="ExecConfigureGcm" Before="ExecPostInstallBat"><![CDATA[ REMOVE <> "ALL" AND ENABLEGCM=1 ]]></Custom>
|
||||
<Custom Action="ExecConfigureGcm" Before="ExecEditGitBash"><![CDATA[ REMOVE <> "ALL" AND ENABLEGCM=1 ]]></Custom>
|
||||
<Custom Action="ExecEditGitBash" Before="DeleteEditGitBash"><![CDATA[ TERMINAL = "CmdPrompt" AND REMOVE <> "ALL" ]]></Custom>
|
||||
<Custom Action="DeleteEditGitBash" Before="ExecPostInstallBat"><![CDATA[ TERMINAL = "CmdPrompt" AND REMOVE <> "ALL" ]]></Custom>
|
||||
<!-- Execute the post-install.bat at the end of the installation transaction on install and repair but not removal. -->
|
||||
<Custom Action="ExecPostInstallBat" Before="InstallFinalize"><![CDATA[ REMOVE <> "ALL" ]]></Custom>
|
||||
</InstallExecuteSequence>
|
||||
|
|
|
@ -120,6 +120,9 @@ die "Could not switch directory to $SCRIPT_PATH"
|
|||
../render-release-notes.sh --css usr/share/git/ ||
|
||||
die "Could not generate ReleaseNotes.html."
|
||||
|
||||
# Compile edit-git-bash.exe
|
||||
make -C ../ edit-git-bash.exe ||
|
||||
die "Could not build edit-git-bash.exe."
|
||||
|
||||
# Make a list of files to include
|
||||
LIST="$(ARCH=$ARCH BITNESS=$BITNESS \
|
||||
|
@ -157,6 +160,10 @@ BUILD_EXTRA_WINPATH="$(cd "$SCRIPT_PATH"/.. && pwd -W | tr / \\\\)"
|
|||
<Component Directory="INSTALLFOLDER:\\usr\\share\\git\\">
|
||||
<File Id="ReleaseNotes_Css" Source="$BUILD_EXTRA_WINPATH\\ReleaseNotes.css" />
|
||||
</Component>
|
||||
<Component Directory="INSTALLFOLDER" Guid="">
|
||||
<Condition>TERMINAL = "CmdPrompt"</Condition>
|
||||
<File DoNotBind Id="EditGitBash" Source="$BUILD_EXTRA_WINPATH\\edit-git-bash.exe" KeyPath="yes" />
|
||||
</Component>
|
||||
EOF
|
||||
echo "$LIST" |
|
||||
sort |
|
||||
|
@ -172,6 +179,7 @@ sed -e 's/\(.*\)\\\(.*\)/ <Component Directory="INSTALLFOLDER:\\\1\\"
|
|||
-e 's/\(<File Source="git-bash.exe"[^>]*\) \/>/\1 \/><Shortcut Name="Git Bash" Icon="git.ico" Directory="GitProgramMenuFolder" WorkingDirectory="INSTALLFOLDER" Arguments="--cd-to-home" Advertise="yes" \/>/' \
|
||||
-e 's/\(<File Source="git-cmd.exe"[^>]*\) \/>/\1 \/><Shortcut Name="Git CMD" Icon="git.ico" Directory="GitProgramMenuFolder" WorkingDirectory="INSTALLFOLDER" Arguments="--cd-to-home" Advertise="yes" \/>/' \
|
||||
-e 's/\(<File Source="cmd\\git-gui.exe"[^>]*\) \/>/\1 \/><Shortcut Name="Git GUI" Icon="git.ico" Directory="GitProgramMenuFolder" WorkingDirectory="INSTALLFOLDER" Arguments="--cd-to-home" Advertise="yes" \/>/' \
|
||||
-e 's/\(Source="git-bash.exe" \)\([^>]\)*/Id="GitBash" \1\2/' \
|
||||
-e 's/\(<Component Directory="INSTALLFOLDER:\\etc\\post-install\\"\)>/\1 Guid="" >/' \
|
||||
-e 's/\(<File Source="etc\\post-install\\.*\.post"\) \/>/\1 KeyPath="yes" \/>/'
|
||||
cat <<EOF
|
||||
|
@ -179,7 +187,8 @@ cat <<EOF
|
|||
</Fragment>
|
||||
</Wix>
|
||||
EOF
|
||||
) | sed -e "s/\(<File .*Source=\"\)\(.*\(compat-\)?\(ba\)?sh.exe\|.*git.*\.exe\)\([^>]*\) \/>/\1\2\" BindPath=\"[BindImagePaths]\5 \/>/" >GitComponents.wxs
|
||||
) | sed -e 's/\(<File \(Id=".*" \)\?Source="\)\(.*\(compat-\)\?\(ba\)\?sh\.exe\|.*git.*\.exe\)\([^>]\)* \/>/\1\3" BindPath="[BindImagePaths]\6 \/>/' \
|
||||
-e 's/\(<File \)\(DoNotBind\) \([^>]*\)>/\1\3>/' >GitComponents.wxs
|
||||
|
||||
# Make the .msi file
|
||||
mkdir -p obj &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче