- 'update-authorized-keys'|'a')
- MODE='authorized_keys'
-
- log "processing authorized_user_ids file..."
-
- # make sure authorized_user_ids file exists
- if [ ! -s "$AUTHORIZED_USER_IDS" ] ; then
- log "authorized_user_ids file is empty or does not exist."
- exit
- fi
-
- process_authorized_ids "$AUTHORIZED_USER_IDS" "$userKeysCacheDir"
-
- # write output key file
- log "writing monkeysphere authorized_keys file... "
- touch "$msAuthorizedKeys"
- if [ "$(ls "$userKeysCacheDir")" ] ; then
- log -n "adding gpg keys... "
- cat "$userKeysCacheDir"/* > "$msAuthorizedKeys"
- echo "done."
- else
- log "no gpg keys to add."
- fi
- if [ "$USER_CONTROLLED_AUTHORIZED_KEYS" ] ; then
- userAuthorizedKeys=${USER_CONTROLLED_AUTHORIZED_KEYS/\%h/"$HOME"}
- if [ -s "$userAuthorizedKeys" ] ; then
- log -n "adding user authorized_keys file... "
- cat "$userAuthorizedKeys" >> "$msAuthorizedKeys"
- echo "done."
- fi