osascript to do GUI update on M1 still has Terminal asking for permissions

beeboo
Contributor

So for the M1 machines I am trying to initiate a GUI update and while it works if i manually accept the Terminal permissions prompt, it wont work in the script.

Here is what is known.

  1. It works with applescript AND as part of the shell script if i accept the following noticeScreen Shot 2021-07-21 at 10.29.20 AM.png
  2. I had the TCC stream running before and during the whole time i ran the script, thus ideally catching who the requester was so that i can add that entry to the PPPC profile but the end result is the same
  3. I had to make in big sur cuz it was asking for privateframework locations that were not on my Catalina machine
  4. I do a direct upload from PPPC utility instead of saving it then uploading to JSS manually, hoping to minimize translation issues
  5. Here is the excerpt of the code that works post acceptance of number 1

 

 

guiSOFTWAREupdate() {
    launchctl asuser ${currentUSERid} /usr/bin/osascript <<EOD
    tell application "System Preferences"
        activate
        tell application "System Events"
            tell process "System Preferences"
                set frontmost to true
            end tell
        end tell
        
        if exists window "Software Update" then
            tell window "Software Update" to if it is miniaturized then set miniaturized to false
        else
            set the current pane to pane id "com.apple.preferences.softwareupdate"
        end if
        tell application "System Events"
            tell process "System Preferences"
                repeat until (exists window "Software Update" of application process "System Preferences" of application "System Events")
                    delay 1
                end repeat
                
                if (exists static text "Checking for updates…" of group 1 of window "Software Update" of application process "System Preferences" of application "System Events") then
                    repeat
                        set itExists to exists busy indicator 1 of group 1 of window "Software Update" of application process "System Preferences" of application "System Events"
                        if itExists then
                            delay 1
                        else
                            exit repeat
                        end if
                    end repeat
                end if
                
                if (exists button "Restart Now" of group 1 of window "Software Update" of application process "System Preferences" of application "System Events") then
                    click button "Restart Now" of group 1 of window "Software Update" of application process "System Preferences" of application "System Events"
                    set myRESULT to "Restart Now"
                else if (exists button "Upgrade Now" of group 1 of window "Software Update" of application process "System Preferences" of application "System Events") then
                    set myRESULT to "Upgrade Now"
                else if (exists button "More info…" of group 1 of window "Software Update" of application process "System Preferences" of application "System Events") then
                    click button "More info…" of group 1 of window "Software Update" of application process "System Preferences" of application "System Events"
                    if (exists button "Install Now" of sheet 1 of window "Software Update" of application process "System Preferences" of application "System Events") then
                        click button "Install Now" of sheet 1 of window "Software Update" of application process "System Preferences" of application "System Events"
                        set myRESULT to "Install Now"
                    end if
                end if
                set frontmost to true
                return myRESULT
            end tell
        end tell
    end tell
EOD

echo "$?"
}

 

 

  • I have essentially gone through looked at all the TCC stream logs to see what I may be missing but I cant find anything... (patebin link to stream: https://pastebin.com/KVtQqizE)
  • I went all out trying to add exceptions too, see below
    1. Screen Shot 2021-07-21 at 10.39.05 AM.png

 

Looking to see if you guys have any insight to this matter as I am super stumped now ( @mm2270 for visibility)

0 REPLIES 0