diff --git a/server/mdm/maintainedapps/scripts.go b/server/mdm/maintainedapps/scripts.go index 1a3179b285..46871f5611 100644 --- a/server/mdm/maintainedapps/scripts.go +++ b/server/mdm/maintainedapps/scripts.go @@ -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 diff --git a/server/mdm/maintainedapps/testdata/scripts/microsoft-edge_install.golden.sh b/server/mdm/maintainedapps/testdata/scripts/microsoft-edge_install.golden.sh index fa6887a8aa..6e9db8ec3e 100644 --- a/server/mdm/maintainedapps/testdata/scripts/microsoft-edge_install.golden.sh +++ b/server/mdm/maintainedapps/testdata/scripts/microsoft-edge_install.golden.sh @@ -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" - - - attributeSetting - 0 - choiceAttribute - selected - choiceIdentifier - com.microsoft.package.Microsoft_AutoUpdate.app - - + + attributeSetting + 0 + choiceAttribute + selected + choiceIdentifier + com.microsoft.package.Microsoft_AutoUpdate.app + 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" diff --git a/server/mdm/maintainedapps/testdata/scripts/microsoft-excel_install.golden.sh b/server/mdm/maintainedapps/testdata/scripts/microsoft-excel_install.golden.sh index cc88f6bc2e..4ff1b8c40d 100644 --- a/server/mdm/maintainedapps/testdata/scripts/microsoft-excel_install.golden.sh +++ b/server/mdm/maintainedapps/testdata/scripts/microsoft-excel_install.golden.sh @@ -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" - - - attributeSetting - 0 - choiceAttribute - selected - choiceIdentifier - com.microsoft.autoupdate - - + + attributeSetting + 0 + choiceAttribute + selected + choiceIdentifier + com.microsoft.autoupdate + 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" diff --git a/server/mdm/maintainedapps/testdata/scripts/microsoft-teams_install.golden.sh b/server/mdm/maintainedapps/testdata/scripts/microsoft-teams_install.golden.sh index 58222137e1..14059f4ccc 100644 --- a/server/mdm/maintainedapps/testdata/scripts/microsoft-teams_install.golden.sh +++ b/server/mdm/maintainedapps/testdata/scripts/microsoft-teams_install.golden.sh @@ -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" - - - attributeSetting - 0 - choiceAttribute - selected - choiceIdentifier - com.microsoft.autoupdate - - + + attributeSetting + 0 + choiceAttribute + selected + choiceIdentifier + com.microsoft.autoupdate + EOF -sudo installer -pkg "$temp_dir"/MicrosoftTeams.pkg -target / -applyChoiceChangesXML "$CHOICE_XML" +sudo installer -pkg "$TMPDIR"/MicrosoftTeams.pkg -target / -applyChoiceChangesXML "$CHOICE_XML" diff --git a/server/mdm/maintainedapps/testdata/scripts/microsoft-word_install.golden.sh b/server/mdm/maintainedapps/testdata/scripts/microsoft-word_install.golden.sh index 5686532766..d14d36179e 100644 --- a/server/mdm/maintainedapps/testdata/scripts/microsoft-word_install.golden.sh +++ b/server/mdm/maintainedapps/testdata/scripts/microsoft-word_install.golden.sh @@ -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" - - - attributeSetting - 0 - choiceAttribute - selected - choiceIdentifier - com.microsoft.autoupdate - - + + attributeSetting + 0 + choiceAttribute + selected + choiceIdentifier + com.microsoft.autoupdate + 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"