fix typos and ensure installers with choices work (#22800)

for #22774

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
This commit is contained in:
Roberto Dip
2024-10-09 18:24:25 -03:00
committed by GitHub
parent 567803955e
commit c02af491c2
5 changed files with 43 additions and 51 deletions
+3 -3
View File
@@ -286,19 +286,19 @@ func (s *scriptBuilder) InstallPkg(pkg string, choices ...[]brewPkgConfig) error
return nil
}
choiceXML, err := plist.MarshalIndent(choices, " ")
choiceXML, err := plist.MarshalIndent(choices[0], " ")
if err != nil {
return err
}
s.Writef(`
CHOICE_XML=$(mktemp /tmp/choice_xml)
CHOICE_XML=$(mktemp /tmp/choice_xml_XXX)
cat << EOF > "$CHOICE_XML"
%s
EOF
sudo installer -pkg "$temp_dir"/%s -target / -applyChoiceChangesXML "$CHOICE_XML"
sudo installer -pkg "$TMPDIR"/%s -target / -applyChoiceChangesXML "$CHOICE_XML"
`, choiceXML, pkg)
return nil
@@ -6,27 +6,25 @@ TMPDIR=$(dirname "$(realpath $INSTALLER_PATH)")
# install pkg files
CHOICE_XML=$(mktemp /tmp/choice_xml)
CHOICE_XML=$(mktemp /tmp/choice_xml_XXX)
cat << EOF > "$CHOICE_XML"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.microsoft.package.Microsoft_AutoUpdate.app</string>
</dict>
</array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.microsoft.package.Microsoft_AutoUpdate.app</string>
</dict>
</array>
</plist>
EOF
sudo installer -pkg "$temp_dir"/MicrosoftEdge-128.0.2739.67.pkg -target / -applyChoiceChangesXML "$CHOICE_XML"
sudo installer -pkg "$TMPDIR"/MicrosoftEdge-128.0.2739.67.pkg -target / -applyChoiceChangesXML "$CHOICE_XML"
@@ -6,27 +6,25 @@ TMPDIR=$(dirname "$(realpath $INSTALLER_PATH)")
# install pkg files
CHOICE_XML=$(mktemp /tmp/choice_xml)
CHOICE_XML=$(mktemp /tmp/choice_xml_XXX)
cat << EOF > "$CHOICE_XML"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.microsoft.autoupdate</string>
</dict>
</array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.microsoft.autoupdate</string>
</dict>
</array>
</plist>
EOF
sudo installer -pkg "$temp_dir"/Microsoft_Excel_16.88.24081116_Installer.pkg -target / -applyChoiceChangesXML "$CHOICE_XML"
sudo installer -pkg "$TMPDIR"/Microsoft_Excel_16.88.24081116_Installer.pkg -target / -applyChoiceChangesXML "$CHOICE_XML"
@@ -6,27 +6,25 @@ TMPDIR=$(dirname "$(realpath $INSTALLER_PATH)")
# install pkg files
CHOICE_XML=$(mktemp /tmp/choice_xml)
CHOICE_XML=$(mktemp /tmp/choice_xml_XXX)
cat << EOF > "$CHOICE_XML"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.microsoft.autoupdate</string>
</dict>
</array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.microsoft.autoupdate</string>
</dict>
</array>
</plist>
EOF
sudo installer -pkg "$temp_dir"/MicrosoftTeams.pkg -target / -applyChoiceChangesXML "$CHOICE_XML"
sudo installer -pkg "$TMPDIR"/MicrosoftTeams.pkg -target / -applyChoiceChangesXML "$CHOICE_XML"
@@ -6,27 +6,25 @@ TMPDIR=$(dirname "$(realpath $INSTALLER_PATH)")
# install pkg files
CHOICE_XML=$(mktemp /tmp/choice_xml)
CHOICE_XML=$(mktemp /tmp/choice_xml_XXX)
cat << EOF > "$CHOICE_XML"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.microsoft.autoupdate</string>
</dict>
</array>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>com.microsoft.autoupdate</string>
</dict>
</array>
</plist>
EOF
sudo installer -pkg "$temp_dir"/Microsoft_Word_16.88.24081116_Installer.pkg -target / -applyChoiceChangesXML "$CHOICE_XML"
sudo installer -pkg "$TMPDIR"/Microsoft_Word_16.88.24081116_Installer.pkg -target / -applyChoiceChangesXML "$CHOICE_XML"