Worklet: Install 1Password for MacOS

Hi all, if you use 1Password, here’s a Worklet to check if it’s installed, if not, it will proceed install it

Evaluation:

#!/bin/bash

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

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

Remediation:

#!/bin/bash

echo -e "Downloading 1Password 7..."

#Downloads 1Password 7 pkg to /tmp/

curl -L -o "/tmp/1pwpkg.pkg" https://app-updates.agilebits.com/download/OPM7

echo -e "Installing 1Password 7..."

#Runs the installer

sudo installer -pkg /tmp/1pwpkg.pkg -target /

echo -e "Cleaning up..."
rm -f "/tmp/1pwpkg.pkg"