Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Git Config Script Added and Tab_Data TOML Updated. #448

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions tabs/system-setup/tab_data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ script = "3-global-theme.sh"
[[data]]
name = "Remove Snaps"
script = "4-remove-snaps.sh"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Remove this line...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fam007e ONCE AGAIN, this extra line has not been removed, please remove it

58 changes: 58 additions & 0 deletions tabs/utils/git-auto-conf-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/sh -e

# Import common utilities
. ../common-script.sh

# Function to prompt for GitHub configuration
setup_git_config() {

# Prompt for GitHub email
printf "Enter your GitHub email address: "
read email

# Prompt for SSH key type
echo "Choose your SSH key type:"
echo "1. Ed25519 (recommended)"
echo "2. RSA (legacy)"
printf "Enter your choice (1 or 2): "
read key_type

# Set key algorithm based on user choice
case "$key_type" in
1) key_algo="ed25519" ;;
2) key_algo="rsa" ;;
*)
echo "Invalid choice. Exiting."
exit 1
;;
esac

# Prompt for custom key name
printf "Enter a custom SSH key name (leave blank for default): "
read key_name

# Set the SSH key path based on user input
ssh_key_path="${HOME}/.ssh/${key_name:-id_$key_algo}"

# Generate SSH key with specified type and email
ssh-keygen -t "$key_algo" -C "$email" -f "$ssh_key_path"

# Prompt for passphrase usage
printf "Do you want to use a passphrase? (y/n): "
read use_passphrase

# If user opts for a passphrase, add key to SSH agent
if [ "$use_passphrase" = "y" ]; then
ssh-add -l >/dev/null 2>&1 || eval "$(ssh-agent -s)"
ssh-add "$ssh_key_path"
else
echo "Skipping passphrase setup."
fi
echo "SSH key generation and setup completed.\nPlease copy the key from your ssh dir and paste it to your corresponding account ssh key add section of your github settings page.\nThen run this command to verify ssh connection:\nssh -T [email protected]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "SSH key generation and setup completed.\nPlease copy the key from your ssh dir and paste it to your corresponding account ssh key add section of your github settings page.\nThen run this command to verify ssh connection:\nssh -T [email protected]"
printf "SSH key generation and setup completed.\nPlease copy the key from your ssh dir and paste it to your corresponding account ssh key add section of your github settings page.\nThen run this command to verify ssh connection:\nssh -T [email protected]"

You CANNOT use new lines in echo without it being non-posix, use printf

}

fam007e marked this conversation as resolved.
Show resolved Hide resolved

# Main execution
checkEnv
checkCommandRequirements "git"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO. This implementation is STILL wrong, what do you not understand? I explained it to you in a previous review; Exiting the script if git is not found is NOT good. Do not implement it like this...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to do what this PR does: #436

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fam007e The other review on this issue is NOT resolved, I don't understand what you do not understand this implementation is incorrect and will exit the script upon git not being found, this is not what we want. Seriously dude.. We have tried explaining to you many times over.

setup_git_config
4 changes: 4 additions & 0 deletions tabs/utils/tab_data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ script = "bluetooth-control.sh"
name = "Numlock on Startup"
script = "numlock.sh"

[[data]]
name = "Git Configuration"
script = "git-auto-conf-cli.sh"

[[data]]
name = "Monitor Control"

Expand Down