refactored setup script and added install option

This commit is contained in:
sose 2020-09-22 17:11:00 -07:00
parent 5dbec4cc5a
commit a9c78171fc
1 changed files with 71 additions and 39 deletions

View File

@ -10,20 +10,15 @@ startx_command="startlxqt"
. ./connection.sh
. ./user.sh
choice=""
setup_tildelinux() {
echo "What tilde would you like to connect to? (use the domain name as you would for ssh)"
read tilde_name
clear
echo "=== Welcome to Tildelinux! ==="
configure_network
echo "What is your username for $tilde_name?"
read tilde_username
echo "What tilde would you like to connect to? (use the domain name as you would for ssh)"
read tilde_name
echo "What is your username for $tilde_name?"
read tilde_username
if ! grep -q "$tilde_username@$tilde_name" /tilde/tildes
then
if ! grep -q "$tilde_username@$tilde_name" /tilde/tildes
then
echo "Now you will need to provide tildelinux with your ssh private key"
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"
@ -41,18 +36,55 @@ then
done
echo "Key file located at $key_file, testing connection..."
connection_test "$key_file" "$tilde_username" "$tilde_name"
else
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..."
configure_user "$key_file" "$tilde_username" "$tilde_name" "$startx_command"
echo "User configured!"
echo "All done! Enjoy using Tildelinux!"
rm ./setup_incomplete
systemctl restart 'getty@tty1.service'
}
choose_option() {
answers="1 2"
answer=""
echo "What would you like to do?"
echo "1. Configure Tildelinux for use as a live system"
echo "2. Install Tildelinux to a disk"
read -r answer
if is_substring "$answer" "$answers"
then
case "$answer" in
"1")
setup_tildelinux
;;
"2")
startx
;;
else
echo "\"$answer\" is not a valid option."
choose_option
fi
}
clear
echo "=== Welcome to Tildelinux! ==="
configure_network
if [ -f ./setup_incomplete ]
then
choose_option
else
setup_tildelinux
fi
echo "Configuring user..."
configure_user "$key_file" "$tilde_username" "$tilde_name" "$startx_command"
echo "User configured!"
echo "All done! Enjoy using Tildelinux!"
rm ./setup_incomplete
systemctl restart 'getty@tty1.service'