### Helpers ###
eval_pm() {
local tmp=$(mktemp -t tmp.XXXXXX)
while read line; do
local retval
[[ ${line} =~ "^profile-manager error:" ]] &&
die "${line}"
${PROFILE_MANAGER} --config-dir="${CONFIG_D}" "${@}" > ${tmp}
[[ ${line} =~ "^[A-Za-z0-9_]*=" ]] ||
retval=${?}
die "Unexpected result from profile-manager: ${line}"
source ${tmp}
export "${line//\"}"
rm -f ${tmp}
done <<-EOF
return ${retval}
$(${PROFILE_MANAGER} --config-dir="${CONFIG_D}" "${@}" 2>&1)
EOF
}
list_all_profiles() {