Hey all,
Apologies in advance if this questions comes across as thick-headed - I'm very new to Jamf and bash scripting in general.
We have Visual Studio Code installed on our lab machines, and would like to use Jamf Remote to install some plugins for VScode.
To do this, Jamf needs to be able to run
code --install-extension foo.vscode.extension
We've managed to add code cli commands to the path variable from Jamf remote by writing the following script:
#!/bin/sh
sudo touch /etc/paths.d/vscode
sudo bash -c "echo /Applications/Visual Studio Code.app/Contents/Resources/app/bin > /etc/paths.d/vscode"
This can be pushed to our machines and will work once the Macs are restarted, allow us to locally install vscode extensions via command line.
The problem comes trying to push the vscode commands via Jamf remote - I don't think that Jamf (as root) can see the path variable to run the vscode commands. I think this will hold true even If I sudo -i into the same user that has the path variable set, since that doesn't carry over?
If anyone can push me in the right direction for getting the Jamf user to be able to install these extensions, that would be great.
Thanks!