talkingmoose / Outlook-Exchange-Setup-5

Automatically configure Outlook 2016 for Mac to connect to Exchange
91 stars 18 forks source link

Script keeps popping up #9

Closed mattiasvdm closed 8 years ago

mattiasvdm commented 8 years ago

I've created the package according the description in the Wiki. When I install this package on a clean Mac it will place the user launch agent (net.talkingmoose.OutlookExchangeSetup5.plist) in the /Library/LaunchAgents. This results in the fact that the script will run every time the user logs in. I've expanded the package and tried to find out why it places the launch agent, but I can't find it. Maybe it's because the package is installed under the root account. Removing the launch agent fixes the problem.

cmcMac commented 8 years ago

same here

mattiasvdm commented 8 years ago

As a work-around you can add this post-install script to the package:

#!/bin/bash

file="/Library/LaunchAgents/net.talkingmoose.OutlookExchangeSetup5.plist"

if [ -f $file ] ; then
    rm $file
fi

exit 0
talkingmoose commented 8 years ago

If the net.talkingmoose.OutlookExchangeSetup5.plist file is appearing in /Library/LaunchAgents, then you may have modified the script to behave differently.

That file should only appear in the user's home folder at ~/Library/LaunchAgents.

The AppleScript (.scpt file) should be removing that launch agent file when it successfully completes creating the account. If that launch agent plist is not getting deleted then we need to probably troubleshoot the AppleScript and find out why it's not getting to the end.

mattiasvdm commented 8 years ago

If the net.talkingmoose.OutlookExchangeSetup5.plist file is appearing in /Library/LaunchAgents, then you may have modified the script to behave differently.

@talkingmoose that's what I also assumed. However, I tested with a fresh download and I got the same behavior. Just to be sure, I just downloaded the latest version and created the package. I did not change anything, not even the .scpt file. Installed the package and again the net.talkingmoose.OutlookExchangeSetup5.plist was created in the /Library/LaunchAgent. Everything else works fine btw, so the removal of the launchagent from the ~/Library/LaunchAgent is working.

Update: I found out that it is probably running the net.talkingmoose.OutlookExchangeSetupLaunchAgent.plist directly during the install of the package. I found the OutlookExchangeSetup5.log in the /Library/Logs/. Contents of logfile:

4/18/16 14:09:44 PM Folder "/Library/Group Containers/UBF8T346G9.Office" does not exist.
4/18/16 14:09:44 PM Create folder "/Library/Group Containters/UBF8T346G9.Office": Successful.
4/18/16 14:09:44 PM Create empty file "/Library/Group Containers/UBF8T346G9.Office/OutlookProfile.plist": Successful.
4/18/16 14:09:44 PM Create folder "/Library/LaunchAgents": Successful.
4/18/16 14:09:44 PM Create launch agent "/Library/LaunchAgents/net.talkingmoose.OutlookExchangeSetup5.plist": Successful.
4/18/16 14:09:44 PM Set launch agent permissions to 644 (-rw-r--r--): Successful.
4/18/16 14:09:44 PM Load launch agent: Successful.
talkingmoose commented 8 years ago

After some testing, I've found a couple of unusual scenarios where two launch agents appear in the main /Library/LaunchAgents folder instead of one in the /Library/LaunchAgents folder and the other in the user's ~/Library/LaunchAgents folder. (Enable and log in to OS X's root account and install the package or install the package via command line after using sudo -s.)

Therefore, I modified the postinstall script to not run the user's launch agent as root if installing by either of those methods or something similar.

This should take care of some issues that may be causing multiple untitled accounts and/or launching Outlook automatically.

You'll find v5.4.0 here: https://github.com/talkingmoose/Outlook-Exchange-Setup-5

And the change log here: https://github.com/talkingmoose/Outlook-Exchange-Setup-5/wiki/Change-log

talkingmoose commented 8 years ago

Closing this issue with no additional feedback after two months.