remove yad.sh by sose's request

This commit is contained in:
fosslinux 2018-11-16 17:42:46 +11:00 committed by Samuel Tyler
parent 18f1615739
commit 74b0c49901
1 changed files with 0 additions and 82 deletions

82
yad.sh
View File

@ -1,82 +0,0 @@
#!/bin/sh
server_address="tilde.town!tilde.team"
login=""
ssh_dir="$HOME/.ssh"
priv_key_path=" "
get_field(){
field_num="$1"
info="$2"
echo "$info" | cut -f "$field_num" -d '|'
}
error_box(){
error_text="$1"
echo "Error: $error_text"
yad \
--width "250" \
--image "dialog-error" \
--title "Error!" \
--text "$error_text"
}
info_box(){
info_text="$1"
echo "$info_text"
yad \
--no-buttons \
--width "250" \
--image "dialog-info" \
--title "Info" \
--text "$info_text"
}
get_info() {
error_num="0"
error_msg=""
info=$(yad \
--title="New server setup" \
--text="Add a new server" \
--form \
--field="Server":CB \
--field="Login" \
--field="SSH Directory":DIR \
--field="Private key":FL \
"$server_address" "$login" "$ssh_dir" "$priv_key_path")
server_address=$(get_field "1" "$info")
login=$(get_field "2" "$info")
ssh_dir=$(get_field "3" "$info")
priv_key_path=$(get_field "4" "$info")
if test -z "$login"
then
error_msg="No login provided!"
error_num=$(( error_num + 1))
fi
if test -d "$(echo "$priv_key_path" | sed 's/\/ *$//')"
then
error_msg="$error_msg\nNo private key provided!"
error_num=$(( error_num + 1))
fi
if [ $error_num -gt '0' ]
then
error_box "$error_msg"
get_info
fi
}
test_info() {
info_box "Attempting to log in with the provided credentials."
if ssh -qF "$ssh_temp_config" "$server_name" exit
then
info_box "Login success! writing config..."
fi
}
get_info
test_info