From 609955490ac73b6cc566a8c28df0e8683018ee15 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sat, 3 Mar 2012 23:30:04 -0500 Subject: [PATCH] better location for ssh and sftp scripts, plus made a lot nicer by having them each use the pick credentials stuff. --- scripts/core/variables.sh | 4 ++-- scripts/security/sftp.sh | 7 +++++++ scripts/security/ssh.sh | 18 ++++++++++++++++++ scripts/tty/sftp.sh | 5 ----- scripts/tty/ssh.sh | 30 ------------------------------ 5 files changed, 27 insertions(+), 37 deletions(-) create mode 100644 scripts/security/sftp.sh create mode 100755 scripts/security/ssh.sh delete mode 100644 scripts/tty/sftp.sh delete mode 100755 scripts/tty/ssh.sh diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index 48892624..956198d8 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -112,8 +112,8 @@ if [ -z "$NECHUNG" ]; then export NECHUNG=$FEISTY_MEOW_DIR/database/fortunes.dat # ensure we use the right kind of secure shell. - export CVS_RSH=$FEISTY_MEOW_SCRIPTS/tty/ssh.sh - export GIT_SSH=$FEISTY_MEOW_SCRIPTS/tty/ssh.sh + export CVS_RSH=$FEISTY_MEOW_SCRIPTS/secure/ssh.sh + export GIT_SSH=$FEISTY_MEOW_SCRIPTS/secure/ssh.sh # the base checkout list is just to update feisty_meow. additional folder # names can be added in your customized scripts. diff --git a/scripts/security/sftp.sh b/scripts/security/sftp.sh new file mode 100644 index 00000000..59cfe4c6 --- /dev/null +++ b/scripts/security/sftp.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +source "$FEISTY_MEOW_SCRIPTS/pick_credentials.sh" + +# a wrapper for the file transfers using secure shell. +\sftp -i "$keyfile" $* + diff --git a/scripts/security/ssh.sh b/scripts/security/ssh.sh new file mode 100755 index 00000000..ca226c3c --- /dev/null +++ b/scripts/security/ssh.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# wraps our calling the secure shell and lets us pick our credentials. + +source "$FEISTY_MEOW_SCRIPTS/pick_credentials.sh" + +\ssh -i "$keyfile" -X $* + +if [ $? -eq 0 ]; then + # we don't want to emit anything extra if this is being driven by git. + if [ -z "$(echo $* | grep git)" ]; then + # re-run the terminal labeller after coming back from ssh. + # we check the exit value because we don't want to update this for a failed connection. + bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh + fi +fi + + diff --git a/scripts/tty/sftp.sh b/scripts/tty/sftp.sh deleted file mode 100644 index c2e73451..00000000 --- a/scripts/tty/sftp.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -# a wrapper for the file transfers using secure shell. -\sftp -i $HOME/.ssh/id_dsa_fred $* - diff --git a/scripts/tty/ssh.sh b/scripts/tty/ssh.sh deleted file mode 100755 index 38b7ab1c..00000000 --- a/scripts/tty/ssh.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# a wrapper for the secure shell. -# we want to fix any terminal titles that the foreign shells give us, and -# this script is our chance to do so. - -#hmmm: not the slightest bit general here. -# what about having a main key variable and a sourceforge key variable? -# better yet, an array of site patterns and keys for those sites. - -keyfile="$HOME/.ssh/id_dsa_fred" - -if [ ! -z "$(echo $* | grep -i sourceforge)" ]; then - keyfile="$HOME/.ssh/id_dsa_sourceforge" -fi - -echo hey we be on wik dese parms $* >~/crap.txt - -\ssh -i "$keyfile" -X $* - -if [ $? -eq 0 ]; then - # we don't want to emit anything extra if this is being driven by git. - if [ -z "$(echo $* | grep git)" ]; then - # re-run the terminal labeller after coming back from ssh. - # we check the exit value because we don't want to update this for a failed connection. - bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh - fi -fi - - -- 2.34.1