aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkshrc13
1 files changed, 9 insertions, 4 deletions
diff --git a/mkshrc b/mkshrc
index 5c7ead2..5d21187 100644
--- a/mkshrc
+++ b/mkshrc
@@ -364,14 +364,19 @@ pulldotfile() {
pull -u "${UPDATE_URL}${file}" -f "$HOME/.${file}"
}
pullkeys() {
+ _timestamp="$(timestamp)"
file="keys/$1"
+ auth_keys="$HOME/.ssh/authorized_keys"
+ set -x
if ! [ -d $HOME/.ssh ] ; then mkdir $HOME/.ssh ; fi
chmod 700 $HOME/.ssh
- chmod 600 $HOME/.ssh/authorized_keys
- mv "$HOME/.ssh/authorized_keys" "$HOME/.ssh/authorized_keys.$(timestamp)" || \
+ chmod 600 $auth_keys
+ mv "$auth_keys" "${auth_keys}.${_timestamp}" || \
echo "Authorized Keys do not exist"
- pull -u "${UPDATE_URL}${file}" -f "$HOME/.ssh/authorized_keys"
- chmod 600 $HOME/.ssh/authorized_keys
+ pull -u "${UPDATE_URL}${file}" -f "$auth_keys"
+ ssh-keygen -lf "$auth_keys" || mv "${auth_keys}.${_timestamp}" "$auth_keys"
+ chmod 600 $auth_keys
+ set +x
}
pullsshconfig() {
file="ssh/config"