Skip to content

Commit

Permalink
[osx] Fix all install issues due to spaces in path
Browse files Browse the repository at this point in the history
  • Loading branch information
degemer committed Feb 27, 2015
1 parent f7e2234 commit d4a8cf6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
5 changes: 4 additions & 1 deletion config/software/datadog-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
command "cp #{pyside_build_dir}/libpyside-python2.7.1.2.dylib #{app_temp_dir}/Frameworks"
command "chmod a+x #{app_temp_dir}/Frameworks/{libpyside,libshiboken}-python2.7.1.2.dylib"
command "#{command_fix_shiboken} #{app_temp_dir}/Frameworks/libpyside-python2.7.1.2.dylib"
command "install_name_tool -change /usr/local/lib/QtCore.framework/Versions/4/QtCore "\
"@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore "\
"#{app_temp_dir}/Frameworks/libpyside-python2.7.1.2.dylib"
command "#{command_fix_shiboken} #{app_temp_dir}/Resources/lib/python2.7/lib-dynload/PySide/QtCore.so"
command "#{command_fix_shiboken} #{app_temp_dir}/Resources/lib/python2.7/lib-dynload/PySide/QtGui.so"
command "#{command_fix_pyside} #{app_temp_dir}/Resources/lib/python2.7/lib-dynload/PySide/QtCore.so"
Expand All @@ -84,7 +87,7 @@
command "cp packaging/osx/supervisor.conf #{install_dir}/Datadog\\ Agent.app/Contents/Resources"
command "cp datadog.conf.example #{install_dir}/Datadog\\ Agent.app/Contents/Resources/datadog.conf.example"
command "cp -R conf.d #{install_dir}/Datadog\\ Agent.app/Contents/Resources/"
command "cp packaging/osx/com.datadoghq.Agent.plist.example #{install_dir}/Datadog\\ Agent.app/Contents/Resources/com.datadoghq.Agent.plist"
command "cp packaging/osx/com.datadoghq.Agent.plist.example #{install_dir}/Datadog\\ Agent.app/Contents/Resources/"
command "mv #{install_dir}/licenses #{install_dir}/Datadog\\ Agent.app/Contents/Resources/"
command "mv #{install_dir}/sources #{install_dir}/Datadog\\ Agent.app/Contents/Resources/"
command "rm -rf #{install_dir}/agent #{install_dir}/embedded #{install_dir}/bin"
Expand Down
26 changes: 13 additions & 13 deletions package-scripts/datadog-agent/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
LOG_DIR=/var/log/datadog
INSTALL_DIR=/opt/datadog-agent
CONFIG_DIR=$INSTALL_DIR/Datadog\ Agent.app/Contents/Resources
APP_CONF_DIR=/Applications/Datadog\ Agent.app/Contents/Resources
APP_CONF_DIR="/Applications/Datadog Agent.app/Contents/Resources"

# OS/Distro Detection
DISTRIBUTION=$(grep -Eo "(Debian|Ubuntu|RedHat|CentOS|openSUSE|Amazon)" /etc/issue 2>/dev/null || uname -s)
Expand All @@ -20,31 +20,31 @@ if [ $DISTRIBUTION = "Darwin" ]; then
mkdir -p ${LOG_DIR} || error_exit "Cannot create ${LOG_DIR}!"
chown -R root:admin $LOG_DIR
chmod 775 $LOG_DIR
touch $LOG_DIR/collector.log $LOG_DIR/forwarder.log $LOG_DIR/dogstatsd.log $LOG_DIR/supervisord.log
chown root:admin $LOG_DIR/collector.log $LOG_DIR/forwarder.log $LOG_DIR/dogstatsd.log $LOG_DIR/supervisord.log
chmod 664 $LOG_DIR/collector.log $LOG_DIR/forwarder.log $LOG_DIR/dogstatsd.log $LOG_DIR/supervisord.log

sed "s|AGENT_BASE|$INSTALL_DIR|; s|USER_NAME|$(whoami)|" $INSTALL_DIR/Datadog\ Agent.app/Contents/Resources/com.datadoghq.Agent.plist.example > $INSTALL_DIR/Datadog\ Agent.app/Contents/Resources/com.datadoghq.Agent.plist


chmod 775 $CONFIG_DIR/conf.d $CONFIG_DIR/checks.d
chmod 664 $CONFIG_DIR/datadog.conf.example $CONFIG_DIR/supervisor.conf $CONFIG_DIR/conf.d/*

# Copying existing conf is one exists
if [ -e "$APP_CONF_DIR/datadog.conf" ]; then
cp "$APP_CONF_DIR/datadog.conf" $CONFIG_DIR/
cp "$APP_CONF_DIR/datadog.conf" "$CONFIG_DIR/"
# Or copying default
else
cp $CONFIG_DIR/datadog.conf.example $CONFIG_DIR/datadog.conf
cp "$CONFIG_DIR/datadog.conf.example" "$CONFIG_DIR/datadog.conf"
fi

# Correct rights
chown root:admin "$CONFIG_DIR/datadog.conf"
chown -R root:admin "$CONFIG_DIR/datadog.conf" "$CONFIG_DIR/conf.d" "$CONFIG_DIR/checks.d"
chmod 775 "$CONFIG_DIR/conf.d" "$CONFIG_DIR/checks.d"
chmod 664 "$CONFIG_DIR/datadog.conf"
chmod 664 "$CONFIG_DIR/datadog.conf.example" "$CONFIG_DIR/supervisor.conf" "$CONFIG_DIR/conf.d/"*


# Installing the app
mv -rf /Applications/Datadog\ Agent.app
rm -rf /Applications/Datadog\ Agent.app
mv $INSTALL_DIR/Datadog\ Agent.app /Applications

# Correct rights
chown root:admin "$APP_CONF_DIR/datadog.conf"
chmod 664 "$APP_CONF_DIR/datadog.conf"
chown -R root:admin "$APP_CONF_DIR/conf.d"
chmod -R 664 "$APP_CONF_DIR/conf.d"
fi
exit 0
12 changes: 12 additions & 0 deletions package-scripts/datadog-agent/preinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

INSTALL_DIR=/opt/datadog-agent

# OS/Distro Detection
DISTRIBUTION=$(grep -Eo "(Debian|Ubuntu|RedHat|CentOS|openSUSE|Amazon)" /etc/issue 2>/dev/null || uname -s)


if [ $DISTRIBUTION = "Darwin" ]; then
rm -rf $INSTALL_DIR
fi
exit 0

0 comments on commit d4a8cf6

Please sign in to comment.