I'm stumped. I've got a very basic script that is designed to delete Google Chrome from /Applications and ~/Applications (if present). When I run this locally as sudo delete_chrome.sh it works just fine and it does exactly what it is supposed to do. It also works when run from a Policy in Self Service. When it is run via policy at login it only deletes /Applications/Google Chrome.app It doesn't seem to touch the user's Applications in his home folder.
#!/bin/sh
#variable for storing the current users name
currentuser=`stat -f "%Su" /dev/console`
# delete /Applications/Google Chrome.app and ~/Applications/Google Chrome.app
rm -Rf "/Applications/Google Chrome.app/"
if [ -e "/Users/$currentuser/Applications/Google Chrome.app/" ]
then
rm -Rf "/Users/$currentuser/Applications/Google Chrome.app/"
fi
The only thing that I can think of is that it doesn't recognize that the user is logged in yet. Could this be the cause? Is there a way to make it recognize who is logged in during the execution of login policies?