autopkg / gregneagle-recipes

AutoPkg recipes maintained by gregneagle
Apache License 2.0
11 stars 9 forks source link

BlueJeans error when installing via Munki #1

Closed SB62 closed 8 years ago

SB62 commented 8 years ago

Running a fresh Autopkg run and installing via Munki returns the following error:

Installing Blue Jeans (1 of 1)... Preparing for installation… Preparing the disk… Preparing Blue Jeans… Waiting for other installations to complete… Configuring the installation… 26.440098 percent complete... Writing files… 55.600702 percent complete... Moving items into place… Validating packages… 97.75 percent complete... Install of Blue Jeans failed with return code 1... ERROR: ------------------------------------------------------------------------------ ERROR: installer: Package name is Blue Jeans ERROR: installer: Installing at base path / ERROR: installer:PHASE:Preparing for installation… ERROR: installer:PHASE:Preparing the disk… ERROR: installer:PHASE:Preparing Blue Jeans… ERROR: installer:PHASE:Waiting for other installations to complete… ERROR: installer:PHASE:Configuring the installation… ERROR: installer:STATUS: ERROR: installer:%26.440098 ERROR: installer:PHASE:Writing files… ERROR: installer:%55.600702 ERROR: installer:PHASE:Moving items into place… ERROR: installer:PHASE:Validating packages… ERROR: installer:%97.750000 ERROR: installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.) 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.

gregneagle commented 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.

gregneagle commented 8 years ago

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
gregneagle commented 8 years ago

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"
gregneagle commented 8 years ago
% 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.

gregneagle commented 8 years ago

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.

gregneagle commented 8 years ago

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