From 6086e908152e97011681e6d91cd7fe627c5cf02f Mon Sep 17 00:00:00 2001 From: Super User Date: Mon, 23 Mar 2026 19:18:34 +0800 Subject: fix ssh sed-replace, remove set paste, add claude idempotency guard --- core/packages/install_claude.sh | 3 +++ core/ssh.sh | 14 +++++++++----- core/vim.sh | 1 - 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/packages/install_claude.sh b/core/packages/install_claude.sh index 99a881d..6a730d6 100755 --- a/core/packages/install_claude.sh +++ b/core/packages/install_claude.sh @@ -1,4 +1,7 @@ #!/bin/bash + +command -v claude &>/dev/null && exit 0 + sudo dnf install -y tar # Install Node.js via nvm and Claude Code curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash diff --git a/core/ssh.sh b/core/ssh.sh index f23d571..63d5ea9 100755 --- a/core/ssh.sh +++ b/core/ssh.sh @@ -1,11 +1,15 @@ #!/bin/bash -dnf install -y git +sudo dnf install -y git -grep -q 'PasswordAuthentication no' /etc/ssh/sshd_config || echo "PasswordAuthentication no" | sudo tee -a /etc/ssh/sshd_config -grep -q 'AllowTcpForwarding yes' /etc/ssh/sshd_config || echo "AllowTcpForwarding yes" | sudo tee -a /etc/ssh/sshd_config -grep -q 'GatewayPorts yes' /etc/ssh/sshd_config || echo "GatewayPorts yes" | sudo tee -a /etc/ssh/sshd_config -grep -q 'AllowAgentForwarding yes' /etc/ssh/sshd_config || echo "AllowAgentForwarding yes" | sudo tee -a /etc/ssh/sshd_config +sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config +grep -q '^PasswordAuthentication' /etc/ssh/sshd_config || echo "PasswordAuthentication no" | sudo tee -a /etc/ssh/sshd_config +sudo sed -i 's/^#\?AllowTcpForwarding.*/AllowTcpForwarding yes/' /etc/ssh/sshd_config +grep -q '^AllowTcpForwarding' /etc/ssh/sshd_config || echo "AllowTcpForwarding yes" | sudo tee -a /etc/ssh/sshd_config +sudo sed -i 's/^#\?GatewayPorts.*/GatewayPorts yes/' /etc/ssh/sshd_config +grep -q '^GatewayPorts' /etc/ssh/sshd_config || echo "GatewayPorts yes" | sudo tee -a /etc/ssh/sshd_config +sudo sed -i 's/^#\?AllowAgentForwarding.*/AllowAgentForwarding yes/' /etc/ssh/sshd_config +grep -q '^AllowAgentForwarding' /etc/ssh/sshd_config || echo "AllowAgentForwarding yes" | sudo tee -a /etc/ssh/sshd_config SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" "$SCRIPT_DIR/../keys/add-ssh-keys.sh" diff --git a/core/vim.sh b/core/vim.sh index bd99a13..2b2854e 100755 --- a/core/vim.sh +++ b/core/vim.sh @@ -57,7 +57,6 @@ nnoremap $ set number setlocal regexpengine=2 -set paste set foldcolumn=12 set noswapfile -- cgit