#!/bin/sh
#set -x

# Extracts a password from the Mac keychain. The name of the item should
# be stored in $KEYPASS.

: ${SERVICENAME:=EECISbackup}
pwd=$(security 2>&1 > /dev/null find-generic-password -gs "$SERVICENAME")
[ $? -eq 0 ] || exit 0

pwd=${pwd#password: \"}
echo ${pwd%\"}
