Skip to content

WABAC Tools

François edited this page Jun 10, 2015 · 8 revisions

The WABAC Machine repo contains a small file called WABACMachine-tools.sh.

This file contains a few functions that may help you build your preflight/postflight scripts. You can either ignore it, or read it and use it if you find it useful.

How to use

It's pretty simple. Download the file, put it wherever you want and chmod 600 it.

In your script(s), use source to import the functions. You can see an example of a preflight.sh script that makes use of it in the repo.

Available functions

I'll try to keep this section up-to-date. If you see something missing, drop me a line and I'll fix it ASAP.

OSX specific functions

Related to AFP

osx_mount_afp_share

Connect to the given host, and mount the given AFP share in the given mount point using the given credentials.

This function takes 5 parameters :

  1. Host
  2. Share
  3. User
  4. Password
  5. Mount point for the AFP share

Example :

osx_mount_afp_share "myserver.local" "sharePoint" "john" "top5ecr3t" "/Volumes/sharePoint"

osx_unmount_afp_share

Unmount the given AFP share.

This function takes 1 parameter :

  1. Mount point of the AFP share

Example :

local afp_mount_point="/Volumes/sharePoint"
osx_mount_afp_share "myserver.local" "sharePoint" "john" "top5ecr3t" "${afp_mount_point}"
[...]
osx_unmount_afp_share "${afp_mount_point}"

Related to sparsebundle files

osx_mount_sparsebundle

Mount the given sparsebundle file.

This function takes 2 parameters :

  1. Path to the sparsebundle file to mount.
  2. Password needed to mount the sparsebundle file.

Example :

local sparsebundle_mount_point
sparsebundle_mount_point=$(osx_mount_sparsebundle "/Volumes/sharePoint/backup.sparsebundle" "top5ecr3t")

osx_unmount_sparsebundle

Unmount the given sparsebundle file.

This function takes 1 parameters :

  1. Mount point of the sparsebundle file.

Example :

local sparsebundle_mount_point
sparsebundle_mount_point=$(osx_mount_sparsebundle "/Volumes/sharePoint/backup.sparsebundle" "top5ecr3t")
[...]
osx_unmount_sparsebundle "${sparsebundle_mount_point}"

Related to Keychain

osx_get_user_from_keychain_for_afp_share()

Retrieve the user name for the given AFP host in the System keychain.

This function takes 1 parameter :

  1. AFP host.

Example :

local user
user=$(osx_get_user_from_keychain_for_afp_share "backup.local")

osx_get_pass_from_keychain_for_afp_share()

Retrieve the password for the given AFP host in the System keychain.

This function takes 1 parameter :

  1. AFP host.

Example :

local password
password=$(osx_get_pass_from_keychain_for_afp_share "backup.local")

osx_get_pass_from_keychain_for_sparsebundle()

Retrieve the password for the given sparsebundle in the System keychain.

This function takes 1 parameter :

  1. Path to the sparsebundle file.

Example :

local sparse_password
sparse_password=$(osx_get_pass_from_keychain_for_sparsebundle "/Volumes/sharePoint/backup.sparsebundle")

Related to Notifications

osx_notify()

Display a notification.

This function takes 2 parameters :

  1. Title
  2. Message

Example :

osx_notify "The WABAC Machine" "Successfully backed up 125Mo."