Skip to main content
Question

Automated install issues

  • May 9, 2016
  • 4 replies
  • 25 views

KyleEricson
Forum|alt.badge.img+17

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:

!/bin/sh

postinstall

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

4 replies

Forum|alt.badge.img+15
  • Contributor
  • May 9, 2016

$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.


Forum|alt.badge.img+13
  • Honored Contributor
  • May 9, 2016

@thoule beat me to it


KyleEricson
Forum|alt.badge.img+17
  • Author
  • Valued Contributor
  • May 9, 2016

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.

!/bin/sh

postinstall

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


KyleEricson
Forum|alt.badge.img+17
  • Author
  • Valued Contributor
  • May 12, 2016

I was able to fix the red folder but still can seem to move the folder to the current users Application Support.