Worklet: Install Slack on MacOS

Hi all, here’s a Worklet to install Slack on MacOS

Evaluation:

#!/bin/bash

#Checks whether the Slack.app is installed in the /Applications directory, if not, Exit 1 code and goes to next step

if [[ -d "/Applications/Slack.app" ]]; then
        echo "Slack is installed."
        exit 0
else
        echo "Slack is not installed."
        exit 1
fi

Remediation:

#!/bin/bash

echo -e "Downloading Slack..."
curl -L -o "/tmp/Slack.dmg" https://slack.com/ssb/download-osx

echo -e "Installing Slack..."
hdiutil attach "/tmp/Slack.dmg" -nobrowse
ditto "/Volumes/Slack.app/Slack.app" "/Applications/Slack.app"

echo -e "Cleaning up..."
hdiutil detach "/Volumes/Slack.app"
rm -f "/tmp/Slack.dmg"