#!/bin/bash
# 添加 Mac 公钥到 Windows authorized_keys

MAC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDuLPlB6X9JC2uP9urgA94wCr7VBPKAX+4j9hR5wc5U5rPDxhKWbFBzRiFU/cssCZlcZbuoWPjrxwtTKR6Tq1++ugHffa2poulXCoufaN5s9kN6US8DNe/q7dulAomwd0pjSDTjhQR4OQG847PqfXz/quU96RfpOrn1WqSRTrzPnVZ885ApNUB7SHd74jrYslwoDRsJu+mS6jjI7NHdNUKTAUBsZWWPmjNO4X1+vEwwK6dZg9i1Z+sz5kLxZ0w+fI1hO6rtR5MPZh8G9JRWiVw3HN0vQtf3zxYtDnzPxELfiE10cctDaDqwMKZ6K73WNlkmoNuM7we7eRlarPGWmGu9 houzi@MichaeldeMBP.lan"

AUTH_KEYS="/c/Users/houzi/.ssh/authorized_keys"

echo "=== 添加 Mac 公钥到 Windows ==="
echo ""

# 检查是否已存在
if grep -q "houzi@MichaeldeMBP.lan" "$AUTH_KEYS" 2>/dev/null; then
    echo "Mac 公钥已存在，无需添加"
else
    echo "添加 Mac 公钥..."
    echo "$MAC_KEY" >> "$AUTH_KEYS"
    echo "✓ 已添加"
fi

echo ""
echo "=== 当前 authorized_keys 内容 ==="
cat "$AUTH_KEYS"
echo ""
echo "完成！"
