Skip to main content
Question

Aternity Agent Deployment Script

  • October 19, 2022
  • 5 replies
  • 23 views

Forum|alt.badge.img+6

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

AJPinto
Forum|alt.badge.img+26
  • Legendary Contributor
  • October 19, 2022

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"

 


Forum|alt.badge.img
  • New Contributor
  • October 19, 2022

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
Forum|alt.badge.img+26
  • Legendary Contributor
  • October 19, 2022

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. 


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.


Forum|alt.badge.img+6
  • Author
  • Contributor
  • October 25, 2022

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


Forum|alt.badge.img+6
  • Author
  • Contributor
  • November 23, 2022

Hi @AJPinto 

Indeed, i have this error: 

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

Thanks