Backblaze is a cloud backup solution with robust command-line utilities that make it well-suited for silent deployment and management through Addigy. This guide walks you through creating a Smart Software item that installs Backblaze and automatically signs devices in to your organization's Backblaze account.
Overview
The Backblaze Smart Software item uses up to three scripts:
- Installation script (required) — mounts the Backblaze DMG, runs the installer, and signs the device in to your account
- Condition script (required) — checks whether Backblaze is already installed before attempting to install
- Removal script (optional) — fully uninstalls Backblaze when the item is removed from a policy
Note: The installation script uses an Addigy Variable to pass your Backblaze password without storing it in plain text. Make sure you have a variable configured before proceeding.
Prerequisites
- The Backblaze DMG installer, uploaded to your Smart Software item
- Your organization's Backblaze account email and password
- An Addigy Variable configured for your Backblaze password
Step 1: Create the Smart Software Item
- Navigate to Catalog > Software > Smart Software and click New.
- Enter a name (e.g.,
Backblaze) and set a version number. - Under Installation Files, click Select File(s) and upload the Backblaze DMG installer.
Step 2: Add the Installation Script
Paste the following into the Installation Command field. Replace the login value with your organization's Backblaze email, and replace $yourVariableHere with the key of your configured Addigy Variable.
# The Backblaze email associated with your account login="myusername@mycompany.com" # The password associated with your account — use an Addigy Variable here password='$yourVariableHere' /usr/bin/hdiutil attach -nobrowse "/Library/Addigy/ansible/packages/Backblaze (1.0)/Backblaze Installer.dmg" "/Volumes/Backblaze Installer/Backblaze Installer.app/Contents/MacOS/bzinstall_mate" -nogui -createaccount "$login" "$password" /usr/sbin/diskutil unmount "/Volumes/Backblaze Installer"
Security note: If you prefer not to store account credentials in the script, you can remove the
login,password, and-createaccountlines. Backblaze will install without signing in, and end users can sign in manually afterward.
Step 3: Add the Condition Script
The condition script prevents Backblaze from being reinstalled on devices where it already exists. Expand the Condition for Install section, select Advanced: Custom Conditional Commands, and paste the following:
if [ -e "/Library/Backblaze.bzpkg/bztransmit" ]; then
echo "Backblaze already installed. Not installing."
exit 1
else
echo "Backblaze not installed. Attempting to install now..."
exit 0
fi
After pasting the script, make sure the Install if return value is 0 checkbox is enabled (it should be enabled by default). This tells Addigy to proceed with installation only when the condition script confirms Backblaze is not yet present.
Tip: This is the simplest condition that works reliably. If you need version-aware upgrades — where Addigy installs Backblaze only if the installed version is outdated — the condition script can be extended to check the installed version number.
Step 4: Add the Removal Script (Optional)
If you want Backblaze to be fully uninstalled when this item is removed from a policy, expand the Removal Command section and paste the following script:
#!/bin/bash
# Backblaze uninstall script
function die {
echo $*
exit 1
}
function remove {
rm -r "$1" || die "Could not remove file: $1"
}
function shutdown_bzserv {
local output=`ps -cA | grep bzserv`
local bz_plist='/Library/LaunchDaemons/com.backblaze.bzserv.plist'
if [ -n "$output" ]; then
test -f $bz_plist && launchctl unload $bz_plist
test -f $bz_plist && remove $bz_plist
else
if [ -f $bz_plist ]; then
remove $bz_plist
fi
fi
}
function clean_library_backblaze {
local bz_pkgs='/Library/Backblaze.bzpkg'
local bz_apps='/Library/Backblaze'
if [ -d $bz_apps ]; then remove $bz_apps; fi
if [ -d $bz_pkgs ]; then remove $bz_pkgs; fi
}
function clean_system_preferences_backblaze {
local bz_pref_pane='/Library/PreferencePanes/BackblazeBackup.prefPane'
if [ -d $bz_pref_pane ]; then remove $bz_pref_pane; fi
}
function clean_applications_backblaze {
local bz_app='/Applications/Backblaze.app'
if [ -d $bz_app ]; then remove $bz_app; fi
}
function clean_misc {
local bz_extbx="/Library/Application Support/ExtBX"
if [ -d "$bz_extbx" ]; then remove "$bz_extbx"; fi
}
function shutdown_bzbmenu {
local output=`ps -cA | grep bzbmenu`
if [ -n "$output" ]; then killall -9 bzbmenu; fi
}
function unload_bzbmenu {
for dir in /Users/*; do
userName=${dir:7}
if [ $userName == 'Guest' -o $userName == 'Shared' ]; then continue; fi
bzbmenuPlist="$dir/Library/LaunchAgents/com.backblaze.bzbmenu.plist"
if [ -f "$bzbmenuPlist" ]; then
sudo -u "$userName" launchctl unload "$bzbmenuPlist"
remove "$bzbmenuPlist"
fi
done
}
function bz_main {
shutdown_bzbmenu
shutdown_bzserv
clean_library_backblaze
clean_system_preferences_backblaze
clean_applications_backblaze
clean_misc
unload_bzbmenu
}
bz_main
Step 5: Save and Test
- Click Save in the bottom right.
- Add the Smart Software item to a test policy with a test device before deploying to production.
- Confirm that Backblaze installs silently and that the device appears signed in to your organization's account.
Best practice: Always validate new Smart Software items on a test policy and machine before pushing them to your production devices.
Frequently Asked Questions
Is it safe to store my Backblaze password in the installation script?
Using an Addigy Variable for the password (rather than typing it directly) keeps it out of plain text in the script itself. Variables are stored securely in Addigy and injected at runtime. If you have concerns about credential security beyond this, you can omit the sign-in portion of the script entirely and let end users sign in manually.
What does the condition script actually check?
It checks for the presence of /Library/Backblaze.bzpkg/bztransmit, a core Backblaze file that exists only when Backblaze is installed. If the file is found, the script exits with code 1 (skip install). If not found, it exits with code 0 (proceed with install).
What does the removal script remove?
The removal script stops all Backblaze processes, unloads launch daemons and agents, and deletes the Backblaze app, preference pane, and supporting library files. It performs a complete uninstall equivalent to Backblaze's own uninstaller.
Huge thanks to Benjamin Morales, @bmorales on MacAdmins, for his scripts which were adapted for use in this article.