diff --git a/src/freedombone-client b/src/freedombone-client index 825ade73..ed8bdf37 100755 --- a/src/freedombone-client +++ b/src/freedombone-client @@ -162,25 +162,34 @@ function configure_ssh_client { if [ ! -d ~/.ssh ]; then mkdir ~/.ssh fi - echo 'Host *.onion' > ~/.ssh/config - echo ' ServerAliveInterval 60' >> ~/.ssh/config - echo ' ServerAliveCountMax 3' >> ~/.ssh/config - + if [ ! -f ~/.ssh/config ]; then + touch ~/.ssh/config + fi proxycmd="connect -R remote -5 -S 127.0.0.1:9050 %h %p" if [ -f /usr/bin/pacman ]; then proxycmd="/usr/bin/nc -X 5 -x 127.0.0.1:9050 %h %p" fi + if ! grep -q "# ${PROJECT_NAME} settings" ~/.ssh/config; then + if ! grep -q "Host *.onion" ~/.ssh/config; then + echo "# ${PROJECT_NAME} settings start" >> ~/.ssh/config + echo 'Host *.onion' >> ~/.ssh/config + echo ' ServerAliveInterval 60' >> ~/.ssh/config + echo ' ServerAliveCountMax 3' >> ~/.ssh/config - if [[ $ENABLE_MONKEYSPHERE == $'yes' || $ENABLE_MONKEYSPHERE == $'y' ]]; then - echo " ProxyCommand sh -c 'monkeysphere ssh-proxycommand --no-connect %h %p ; $proxycmd'" >> ~/.ssh/config - else - echo " ProxyCommand $proxycmd" >> ~/.ssh/config - fi - echo 'Host *' >> ~/.ssh/config - echo ' ServerAliveInterval 60' >> ~/.ssh/config - echo ' ServerAliveCountMax 3' >> ~/.ssh/config - if [[ $ENABLE_MONKEYSPHERE == $'yes' || $ENABLE_MONKEYSPHERE == $'y' ]]; then - echo ' ProxyCommand monkeysphere ssh-proxycommand %h %p' >> ~/.ssh/config + + if [[ $ENABLE_MONKEYSPHERE == $'yes' || $ENABLE_MONKEYSPHERE == $'y' ]]; then + echo " ProxyCommand sh -c 'monkeysphere ssh-proxycommand --no-connect %h %p ; $proxycmd'" >> ~/.ssh/config + else + echo " ProxyCommand $proxycmd" >> ~/.ssh/config + fi + echo 'Host *' >> ~/.ssh/config + echo ' ServerAliveInterval 60' >> ~/.ssh/config + echo ' ServerAliveCountMax 3' >> ~/.ssh/config + if [[ $ENABLE_MONKEYSPHERE == $'yes' || $ENABLE_MONKEYSPHERE == $'y' ]]; then + echo ' ProxyCommand monkeysphere ssh-proxycommand %h %p' >> ~/.ssh/config + fi + echo "# ${PROJECT_NAME} settings end" >> ~/.ssh/config + fi fi echo ''