dont look for key if tilde is already configured

This commit is contained in:
sose 2020-09-13 04:07:27 +00:00
parent 217dc47e44
commit 8c21b7fab6
1 changed files with 24 additions and 15 deletions

View File

@ -22,23 +22,32 @@ read tilde_name
echo "What is your username for $tilde_name?" echo "What is your username for $tilde_name?"
read tilde_username read tilde_username
echo "Now you will need to provide tildelinux with your ssh private key" if ! grep -q "$tilde_username@$tilde_name" /tilde/tildes
echo "By whatever means, place your private key in the /tilde/key directory" then
echo "Here is a shell, once the key is in the proper location, simply type \"exit\" to close the shell and continue" echo "Now you will need to provide tildelinux with your ssh private key"
bash echo "By whatever means, place your private key in the /tilde/key directory"
echo "Here is a shell, once the key is in the proper location, simply type \"exit\" to close the shell and continue"
bash
echo "Looking for key file..." echo "Looking for key file..."
key_file="$(find_key_file '/tilde/key')"
while [ -z "$key_file" ]
do
echo "Could not find a valid key file in /tilde/key"
echo "Use this shell to try and fix any problems, then check again by exiting this shell"
echo "Use \`exit 1\` to abort the install"
bash || fail
key_file="$(find_key_file '/tilde/key')" key_file="$(find_key_file '/tilde/key')"
done while [ -z "$key_file" ]
echo "Key file located at $key_file, testing connection..." do
connection_test "$key_file" "$tilde_username" "$tilde_name" echo "Could not find a valid key file in /tilde/key"
echo "Use this shell to try and fix any problems, then check again by exiting this shell"
echo "Use \`exit 1\` to abort the install"
bash || fail
key_file="$(find_key_file '/tilde/key')"
done
echo "Key file located at $key_file, testing connection..."
connection_test "$key_file" "$tilde_username" "$tilde_name"
else
key_file="$(cat /tilde/tildes \
| grep -A4 "Host $tilde_username@$tilde_name" \
| grep "IdentityFile" \
| cut -f2 -d ' ')"
echo "$tilde_name found in /tilde/tildes, using $key_file as key file"
fi
echo "Configuring user..." echo "Configuring user..."
configure_user "$key_file" "$tilde_username" "$tilde_name" "$startx_command" configure_user "$key_file" "$tilde_username" "$tilde_name" "$startx_command"