Closed SB62 closed 8 years ago
Bluejeans has changed the postinstall script in the package. While I could update the recipe to replace it with a "better" one, I'm uncomfortable with doing that, as the script could be updated again in the future and the autopkg recipe might be used for days/weeks/months with a "wrong" postinstall script. I'm not sure how best to proceed here.
Formerly, this script only attempted to set the application's owner to the "user who initiated the install", so we could skip that. Now it does that, plus copy a LaunchAgent plist into place, and then attempts to use the open
command to open an app in the current GUI user's context...
#!/bin/bash
#Update the application ownership to the user who initiated the install, if it's not root.
if [ "$USER" != "root" ]; then
chown -R $USER:"$(id -gn $USER)" /Applications/Blue\ Jeans.app
fi
cp /Applications/Blue\ Jeans.app/Contents/Resources/com.bluejeans.app.detector.plist /Library/LaunchAgents
chmod 755 /Applications/Blue\ Jeans.app/Contents/Resources/start-carmel-detector.sh
open -a /Applications/Blue\ Jeans.app --args init-app-detector
I have no idea what this thing is doing/is supposed to do...
% cat /Applications/Blue\ Jeans.app/Contents/Resources/start-carmel-detector.sh
#!/bin/sh
SYSTEM_APP_PATH="/Applications/Blue Jeans.app/Contents/MacOS/BlueJeans"
USER_APP_PATH="$HOME/Applications/Blue Jeans.app/Contents/MacOS/BlueJeans"
APP_DETECTOR_PATH="$HOME/Library/Application Support/Blue Jeans/desktop/carmel-detector/main.js"
if [ -f "$SYSTEM_APP_PATH" ]; then
APP_PATH="$SYSTEM_APP_PATH"
elif [ -f "$USER_APP_PATH" ]; then
APP_PATH="$USER_APP_PATH"
fi
if [ -f "$APP_DETECTOR_PATH" ]; then
"$APP_PATH" "$APP_DETECTOR_PATH"
else
"$APP_PATH" "init-app-detector"
% cat /Library/LaunchAgents/com.bluejeans.app.detector.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.bluejeans.app.detector</string>
<key>Program</key>
<string>/Applications/Blue Jeans.app/Contents/Resources/start-carmel-detector.sh</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
The LaunchAgent it copies into place seems to start the same process as did the postinstall script; so it appears the postinstall script attempts to start it during the current login session, and the LaunchAgent does it for subsequent logins.
Fixing this mess is possible, but I suspect the a future release of the BluejeansApp pkg will change things again. It would be better if there were a way to replace the postinstall script with a "better" one only if the current script contents were the expected "bad" contents.
This commit https://github.com/autopkg/gregneagle-recipes/commit/6ff8ffd77307cf3f39200bf23fe0f2aaba11f4bd addresses the issue in my testing, but I think it likely to break again in the future (possibly without us noticing for a while).
Running a fresh Autopkg run and installing via Munki returns the following error:
The applications still installs correctly in the /Applications/ folder and is usable, but Munki does not recognize it as installed and continues to try to install every time you try to install it. If it is marked as a Managed Install, Munki recognizes it as install and doesn't not try to reinstall.