Posted on 04-23-2020 07:13 AM
Hey guys,
We're working on an automatic policy push of Python3 to people in the company. This can happen even once, but needs to happen to all the people.
This is the current script:
jamf policy -event PythonTrigger
-u $3 [ -f ~/.bash_profile ] && sed -i '' -e 's/(^./Python.framework/Versions/.$)/#1/' ~/.bash_profile && echo "Success updating .bash_profile" || echo "Failed updating .bash_profile"
-u $3 [ -f ~/.zprofile ] && sed -i '' -e 's/(^./Python.framework/Versions/.$)/#1/' ~/.zprofile && echo "Success updating .bash_profile"
-u $3 [ -f ~/.bashrc ] && sed -i '' -e 's/(^./Python.framework/Versions/.$)/#1/' ~/.bashrc && echo "Success updating .bash_profile"
Now, the script is running on a policy calling for the trigger. Another policy, the one with the package, has the PythonTrigger.
The policy that extracts the Python package runs successfully, and Python is installed in Applications.
However, after that part, the rest of the policy fails. Python should be at version 3.8.2 per the package, but when running Python3 at the terminal, it doesn't appear to be updated.
Would appreciate any input on the script/process!
Posted on 04-23-2020 07:42 AM
Your script does not display properly, but I doubt that "-u $3 [ -f ~/.bash_profile ]" does what you expect it to do. I assume "$3" is the third parameter sent from the MDM, so the username. But which username? Are you making this available in the Self-Service, or do you push it out? What do expect the '~' resolves to in your context? Does it resolve at all?
Posted on 04-23-2020 07:56 AM
Something else just crossed my mind: does "jamf policy -event PythonTrigger" really wait that the policy finishes, or does it just trigger it? Scripts that require a package to be installed are a pain with JAMF.
I think I would
Posted on 04-23-2020 07:26 PM
@mschroder The jamf policy -event PythonTrigger
won't return until the triggered policy completes