mostly message changing

This commit is contained in:
fosslinux 2018-11-16 17:33:42 +11:00 committed by Samuel Tyler
parent f0890e6f39
commit 18f1615739
3 changed files with 13 additions and 14 deletions

View File

@ -34,15 +34,15 @@ configure_directories() {
local_dir="" local_dir=""
remote_dir="" remote_dir=""
echo "What would you like to call the local directory? (~/Remote/...)" echo "What would you like to call the local directory? (~/Remote/...)?"
read -r answer read -r answer
local_dir="$HOME/Remote/$answer" local_dir="$HOME/Remote/$answer"
mkdir -p "$local_dir" mkdir -p "$local_dir"
echo "Created directory $local_dir" echo "Created directory $local_dir."
echo "What directory on \"$server_name\" would you like to link it to? (Absolute path)" echo "What directory on \"$server_name\" would you like to link it to? (absolute path)"
read -r answer read -r answer
remote_dir="$answer" remote_dir="$answer"
echo "Linking directory $local_dir to $remote_dir on \"$server_name\"" echo "Linking directory $local_dir to $remote_dir on \"$server_name\"."
sshfs "$server_name:$remote_dir" "$local_dir" sshfs "$server_name:$remote_dir" "$local_dir"
echo "Done, enjoy!" echo "Done, enjoy!"
} }
@ -52,7 +52,7 @@ attempt_login() {
ssh_temp_config="$2" ssh_temp_config="$2"
ssh_config="$3" ssh_config="$3"
echo "Attempting to log in with configuration for \"$server_name\"" echo "Attempting to log in with configuration for \"$server_name\"."
if ssh -qF "$ssh_temp_config" "$server_name" exit if ssh -qF "$ssh_temp_config" "$server_name" exit
then then
echo "Login successful! Writing ssh config..." echo "Login successful! Writing ssh config..."
@ -72,8 +72,8 @@ attempt_login() {
esac esac
else else
echo "Login failed, what would you like to do?" echo "Login failed, what would you like to do?"
echo " 1) Try logging in again" echo " 1) Try logging in again."
echo " 2) Re-configure my credentials" echo " 2) Re-configure my credentials."
read -r answer read -r answer
case "$answer" in case "$answer" in
"1") "1")
@ -94,10 +94,10 @@ setup_keys() {
ssh_dir="" ssh_dir=""
key_type="" key_type=""
echo "Configuring \"$server_address\" as \"$server_name\"" echo "Configuring \"$server_address\" as \"$server_name\"."
echo "What is your login name for this server?" echo "What is your login name for this server?"
read -r login read -r login
echo "Where is the pivate key you use for this account (Absolute path)" echo "Where is the private key you use for this account (absolute path)"
read -r key_path read -r key_path
if test -r "$key_path" if test -r "$key_path"
then then
@ -155,7 +155,7 @@ pick_account() {
;; ;;
esac esac
else else
echo "\"$answer\" is not a valid option" echo "\"$answer\" is not a valid option."
pick_account pick_account
fi fi
} }

View File

@ -118,7 +118,6 @@ get_info() {
} }
configure_server() { configure_server() {
ssh_current_config="$ssh_dir/config" ssh_current_config="$ssh_dir/config"
ssh_temp_config="$ssh_dir/config.tmp" ssh_temp_config="$ssh_dir/config.tmp"
ssh_host_dir="$ssh_dir/$server_address" ssh_host_dir="$ssh_dir/$server_address"
@ -167,7 +166,7 @@ configure_server() {
} >> "$ssh_temp_config" } >> "$ssh_temp_config"
info_box "Attempting to log in with the provided credentials" & info_box "Attempting to log in with the provided credentials..." &
info_pid=$(( $! + 2 )) # yikes, is this safe? info_pid=$(( $! + 2 )) # yikes, is this safe?
echo "$ssh_temp_config" echo "$ssh_temp_config"
echo "$server_address" echo "$server_address"
@ -180,7 +179,7 @@ configure_server() {
exit # Without this the "Host already exists" box appears, investigate. exit # Without this the "Host already exists" box appears, investigate.
else else
kill $info_pid kill $info_pid
error_box "Login failed, please try again" error_box "Login failed, please try again."
get_info get_info
fi fi
} }

2
yad.sh
View File

@ -71,7 +71,7 @@ get_info() {
} }
test_info() { test_info() {
info_box "Attempting to log in with the provided credentials" info_box "Attempting to log in with the provided credentials."
if ssh -qF "$ssh_temp_config" "$server_name" exit if ssh -qF "$ssh_temp_config" "$server_name" exit
then then
info_box "Login success! writing config..." info_box "Login success! writing config..."