-
Notifications
You must be signed in to change notification settings - Fork 228
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
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d430358
auto git config's script added and consequential change is made to ta…
fam007e 78cad31
Update tabs/system-setup/tab_data.toml
fam007e 5040b27
Update tabs/system-setup/git-auto-conf-cli.sh
fam007e 5947b33
Update tabs/system-setup/git-auto-conf-cli.sh
fam007e bb095b0
check cmd req for git cmd is added and the script for git config is m…
fam007e 8c7557b
check cmd req for git cmd is added at the main exec part
fam007e 8a14b10
removed extra line from the script
fam007e b7134ce
removed echo cmd
fam007e 521c8e5
new fresh approach
fam007e ff70494
ok if this is not to your liking close and trash the PR, I am done
fam007e File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,4 @@ script = "3-global-theme.sh" | |
[[data]] | ||
name = "Remove Snaps" | ||
script = "4-remove-snaps.sh" | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/sh -e | ||
|
||
# Import common utilities | ||
. ../common-script.sh | ||
|
||
# Install Git if it's not already present | ||
installGit() { | ||
if ! command -v git >/dev/null 2>&1; then | ||
printf "Git is not installed. Installing it now...\n" | ||
|
||
case "$PACKAGER" in | ||
pacman|xbps-install) | ||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm git | ||
;; | ||
apt-get|nala|dnf|zypper) | ||
"$ESCALATION_TOOL" "$PACKAGER" install -y git | ||
;; | ||
nix-env) | ||
nix-env -iA nixpkgs.git | ||
;; | ||
*) | ||
printf "%sGit installation not supported for this package manager%s\n" "$RED" "$RC" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
printf "%sGit installed successfully.%s\n" "$GREEN" "$RC" | ||
else | ||
printf "Git is already installed.\n" | ||
fi | ||
} | ||
|
||
# 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 | ||
printf "Choose your SSH key type:\n" | ||
printf "1. Ed25519 (recommended)\n" | ||
printf "2. RSA (legacy)\n" | ||
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" ;; | ||
*) | ||
printf "Invalid choice. Exiting.\n" | ||
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 | ||
if ! ssh-add -l >/dev/null 2>&1; then | ||
eval "$(ssh-agent -s)" | ||
fi | ||
ssh-add "$ssh_key_path" | ||
else | ||
printf "Skipping passphrase setup.\n" | ||
fi | ||
|
||
fam007e marked this conversation as resolved.
Show resolved
Hide resolved
|
||
printf "SSH key generation and setup completed.\n" | ||
printf "Please copy the SSH key and add it to your GitHub account.\n" | ||
printf "Then run this command to verify the SSH connection:\n" | ||
printf "ssh -T [email protected]\n" | ||
} | ||
|
||
# Main execution | ||
checkEnv | ||
installGit | ||
setup_git_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line...
There was a problem hiding this comment.
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