]> Devi Nivas Git - simplescripts.git/commitdiff
Add SSH Proxy Setup Script
authorAdvaith Menon <noreply-git@bp4k.net>
Wed, 19 Nov 2025 17:33:00 +0000 (12:33 -0500)
committerAdvaith Menon <noreply-git@bp4k.net>
Wed, 19 Nov 2025 17:33:00 +0000 (12:33 -0500)
* Add script that copies the SSH public key to the current
  directory for easy upload of those keys

unix/proxy/setup-proxy.sh [new file with mode: 0755]

diff --git a/unix/proxy/setup-proxy.sh b/unix/proxy/setup-proxy.sh
new file mode 100755 (executable)
index 0000000..4a2b127
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+set -e
+
+if [ -z "$OUTPUT_FILE" ]; then
+    OUTPUT_FILE="./$(whoami)_ssh_pubkey.txt"
+fi
+
+if [ -z $HOME ]; then
+    echo 'error: $HOME not set. Please run from a normal shell.'
+    return 1
+fi
+
+if [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then
+    echo "Creating a ssh key."
+    echo "Leave the location at its default."
+    ssh-keygen -t rsa
+fi
+
+if [ -f "$OUTPUT_FILE" ]; then
+    echo "Delete copied SSH key"
+    rm "$OUTPUT_FILE"
+fi
+
+cp ~/.ssh/id_rsa.pub "$OUTPUT_FILE"
+
+echo "Send the following file to support@devinivas.in using your registered"
+echo "DISH e-mail:"
+echo "    $OUTPUT_FILE"