Posted on 05-09-2016 10:10 AM
When I run a .pkg file in AirWatch it doesn't install when I run it normally it works fine. This is my post install script:
pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3
loggedInUser=/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'
mv /tmp/Microsoft /Users/$USER/Library/Application Support/
chown -R $loggedInUser:staff /Users/$USER/Library/Application Support/Microsoft
exit 0 ## Success
exit 1 ## Failure
Posted on 05-09-2016 11:17 AM
$USER is an environment variable which is unlikely to be set when run via AirWatch (or any other management system).
Instead of $USER, use $loggedInUser. Really you should look up the user's home directory, but I'm guessing in your environment, that won't be a problem.
Posted on 05-09-2016 11:21 AM
@thoule beat me to it
Posted on 05-09-2016 12:38 PM
I changed this but I see the folder isn't moving it has a red line saying I have no access.
I updated the postinstall as well.
pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3
loggedInUser=/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'
mv /tmp/Microsoft /Users/$loggedInUser/Library/Application Support/
chown -R $loggedInUser:staff /Users/$loggedInUser/Library/Application Support/Microsoft
exit 0 ## Success
exit 1 ## Failure
Posted on 05-12-2016 06:06 AM
I was able to fix the red folder but still can seem to move the folder to the current users Application Support.