Aternity Agent Deployment Script

Eskobar
Contributor

Hi everyone

 

The agent am trying to deploy is : Aternity_MacAgent_3.7.0-49

Some machines have Aternity_MacAgent_3.5.0-102, some do not have any agent, i have multiple OS installed.

My script was not successful, any idea?

 

#!/bin/bash


# Copy the Agent pkg file to the home or shared directory of the user.

# Use the copy method for your distribution system.

#Set up the pkg file with full logs, placing the Agent files in the home directory of the user.

su -l $this_user -c "/usr/sbin/installer -verboseR -dumplog -pkg /Users/$this_user/mac-agent.pkg -target CurrentUserHomeDirectory"



exit 0      ## Success

exit 1      ## Failure
5 REPLIES 5

AJPinto
Honored Contributor II

I think you are missing line 4 in Step 5 from your script. This is where the $this_user variable is defined. If the $this_user variable is not defined the script wont know where to put the files and will error out.

 

#!/bin/bash

#Get the current user on a device. Notice the back-quote for embedding the python script.
this_user=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }')

# Copy the Agent pkg file to the home or shared directory of the user.
# Use the copy method for your distribution system.

#Set up the pkg file with full logs, placing the Agent files in the home directory of the user.
su -l $this_user -c "/usr/sbin/installer -verboseR -dumplog -pkg /Users/$this_user/mac-agent.pkg -target CurrentUserHomeDirectory"

 

cdoherty
New Contributor

Also, in Monterey (not sure of the version) Apple has removed Python, so if your installer is using Python it will fail on these devices. I think the latest installer from Aternity no longer uses Python. 

AJPinto
Honored Contributor II

Apple removed Python 2.7, not Python as a whole. They did this with 12.3 back in March. You must now use Python 3, so any scripts using Python 2.7 need to be updated to function.

Correct.

Script adjusted and deployment testing

Eskobar
Contributor

Hi @AJPinto 

Indeed, i have this error: 

Screenshot 2022-11-23 at 13.47.42.png

Could you please help me  fixed, I sam not good at scripting :(

Thanks