Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes tray app upgrades on mac #282

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions omnibus/package-scripts/chef-workstation/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,32 @@ for binary in $binaries; do
done

if is_darwin; then
restart_required=false
# Close the app if it is running.
if [ $(osascript -e 'application "Chef Workstation App" is running') = 'true' ]; then
restart_required=true
echo "Closing Chef Workstation App..."
osascript -e 'quit app "Chef Workstation App"' > /dev/null 2>&1;
fi
# chef-workstation-app is configured to build Mac as a zip file instead
# of a directory. Otherwise, the mac pkgbuild command will find the Chef Workstation App
# within the larger Chef Workstatoin package, and will not include it in the Chef Workstation
# package directly.
echo "Moving Chef Workstation App to the Applications folder"
pushd $INSTALLER_DIR/components/chef-workstation-app
unzip chef-workstation-app-mac.zip
sudo rm -rf "/Applications/Chef Workstation App.app"
sudo mv "mac/Chef Workstation App.app" /Applications
rm -r mac
popd

ln -sf $INSTALLER_DIR/bin/uninstall_chef_workstation $PREFIX/bin || error_exit "Cannot link uninstall_chef_workstation to $PREFIX/bin"

# Restart the app if it was running.
if $restart_required; then
echo "Restarting Chef Workstation App..."
osascript -e 'open app "Chef Workstation App"' > /dev/null 2>&1;
fi
else # linux - postinst does not run for windows.
cwa_app_path="$INSTALLER_DIR/components/chef-workstation-app/chef-workstation-app"
ldd "$cwa_app_path" | grep "not found" >/dev/null 2>&1
Expand Down