-
Notifications
You must be signed in to change notification settings - Fork 1
WABAC Tools
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.
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.
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
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 :
- Host
- Share
- User
- Password
- Mount point for the AFP share
Example :
osx_mount_afp_share "myserver.local" "sharePoint" "john" "top5ecr3t" "/Volumes/sharePoint"
Unmount the given AFP share.
This function takes 1 parameter :
- 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}"
Mount the given sparsebundle file.
This function takes 2 parameters :
- Path to the sparsebundle file to mount.
- Password needed to mount the sparsebundle file.
Example :
local sparsebundle_mount_point
sparsebundle_mount_point=$(osx_mount_sparsebundle "/Volumes/sharePoint/backup.sparsebundle" "top5ecr3t")
Unmount the given sparsebundle file.
This function takes 1 parameters :
- 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}"
Retrieve the user name for the given AFP host in the System keychain.
This function takes 1 parameter :
- AFP host.
Example :
local user
user=$(osx_get_user_from_keychain_for_afp_share "backup.local")
Retrieve the password for the given AFP host in the System keychain.
This function takes 1 parameter :
- AFP host.
Example :
local password
password=$(osx_get_pass_from_keychain_for_afp_share "backup.local")
Retrieve the password for the given sparsebundle in the System keychain.
This function takes 1 parameter :
- Path to the sparsebundle file.
Example :
local sparse_password
sparse_password=$(osx_get_pass_from_keychain_for_sparsebundle "/Volumes/sharePoint/backup.sparsebundle")
Display a notification.
This function takes 2 parameters :
- Title
- Message
Example :
osx_notify "The WABAC Machine" "Successfully backed up 125Mo."
WABAC Machine | Copyright © 2009-2016 François Kubler (@fkubler)