}
# remove all lines with specified string from specified file
-remove_file_line() {
+remove_line() {
local file
local string
# remove user ID from file
log -n " removing user ID '$userID'... "
- remove_file_line "$AUTHORIZED_USER_IDS" "^${userID}$"
+ remove_line "$AUTHORIZED_USER_IDS" "^${userID}$"
loge "done."
}
while read -r ok keyid ; do
sshKey=$(gpg2ssh "$keyid")
# remove the old host key line
- remove_file_line "$KNOWN_HOSTS" "$sshKey"
+ remove_line "$KNOWN_HOSTS" "$sshKey"
# if key OK, add new host line
if [ "$ok" -eq '0' ] ; then
# hash if specified
while read -r ok keyid ; do
sshKey=$(gpg2ssh "$keyid")
# remove the old host key line
- remove_file_line "$AUTHORIZED_KEYS" "$sshKey"
+ remove_line "$AUTHORIZED_KEYS" "$sshKey"
# if key OK, add new host line
if [ "$ok" -eq '0' ] ; then
ssh2authorized_keys "$userID" "$sshKey" >> "$AUTHORIZED_KEYS"
# FIXME: need to figure out better way to identify host key
# dummy command so as not to publish fakes keys during testing
# eventually:
- #gpg --send-keys --keyserver "$KEYSERVER" $(hostname -f)
- echo "NOT PUBLISHED: gpg --send-keys --keyserver $KEYSERVER $(hostname -f)"
+ #gpg --keyserver "$KEYSERVER" --send-keys $(hostname -f)
+ echo "NOT PUBLISHED (to avoid permanent publication errors during monkeysphere development).
+To publish manually, do: gpg --keyserver $KEYSERVER --send-keys $(hostname -f)"
+ return 1
}