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

Add automated Git configuration, Nerd Fonts installer, and bootloader management scripts to linutil #309

Closed
wants to merge 27 commits into from

Conversation

fam007e
Copy link

@fam007e fam007e commented Sep 8, 2024

Type of Change

  • New feature
  • Bug fix
  • Documentation Update
  • Refactoring
  • Hotfix
  • Security patch
  • UI/UX improvement

Description

This pull request introduces several new features to linutil:

  1. Automated Git Configuration Script: This script helps users set up Git by configuring their GitHub email, SSH key (either Ed25519 or RSA), and copying the SSH key to the clipboard for easy GitHub integration. It checks for necessary tools like xclip and uses best practices for SSH key generation and GitHub authentication.

  2. Nerd Fonts Installer Script: This script automates the installation of Nerd Fonts by detecting the user’s Linux distribution and using the appropriate package manager to install dependencies (curl, tar). It then provides an interactive prompt for selecting fonts, downloads them from GitHub, installs them locally, and refreshes the font cache. This feature simplifies the process of installing Nerd Fonts across different systems.

  3. Bootloader Switching and Backup Script: This new script facilitates seamless switching between GRUB and systemd-boot bootloaders. It includes:

    • Interactive Menu: Detects the current bootloader and offers options to switch to the other bootloader, restore from backups, or exit.
    • Backup and Restore: Backs up GRUB or systemd-boot configurations and allows restoring from previous backups.
    • Automatic Detection: Automatically detects the current bootloader and provides appropriate actions based on the detected bootloader.
  4. Edited Logo: Used ANSI color from ratatui style's color and modifier to create a logo which is in depicted in readme.

  5. Minor correction of word "parent" in hint.rs is made.

These changes aim to streamline user setup and enhance the configuration experience, making it easier for developers to quickly configure their environment and manage bootloader setups.

Testing

  • The Git configuration script has been tested on various distributions (Ubuntu, Fedora, Arch) for SSH key generation, GitHub key addition, and correct handling of user input for key type and passphrase.
  • The Nerd Fonts installer script has been tested across multiple distributions to ensure it correctly installs fonts, refreshes the font cache, and handles package dependencies.
  • The Bootloader Switching and Backup script has been tested for interactive menu functionality, accurate detection of the current bootloader, and successful switching between GRUB and systemd-boot. Backup and restore functionalities have been verified.

Impact

  • Performance: Minimal performance impact since all scripts run only during setup or maintenance processes.
  • Dependencies: Introduces requirements for xclip in the Git configuration script, and ensures curl and tar are installed for the Nerd Fonts installer. The bootloader script uses common system tools and does not introduce additional runtime dependencies.
  • Behavior: Enhances the user setup experience by automating Git configuration, font installation, and providing a streamlined process for managing bootloaders.
  • Colorful: Logo with ASCII art is colored adds to its visual appeal.

Issue related to PR

Additional Information

  • The Git configuration script includes detailed user prompts and instructions for adding SSH keys to GitHub.
  • The Nerd Fonts installer script uses modular, reusable functions for OS detection and dependency installation, ensuring it is extensible for future font management tasks.
  • The Bootloader Switching and Backup script includes comprehensive backup and restoration processes, as well as an intuitive interactive menu for switching and restoring bootloaders.

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no errors/warnings/merge conflicts.

@nnyyxxxx
Copy link
Contributor

nnyyxxxx commented Sep 8, 2024

Why are you removing cargo.lock?

@fam007e
Copy link
Author

fam007e commented Sep 8, 2024

I hope the commits have fixed the issue.
BTW I saw a recent cargo run warning due to a new ratatui version...

cargo run warning mesage shown:

warning: use of deprecated method `ratatui::Frame::<'_>::set_cursor`: the method set_cursor_position indicates more clearly what about the cursor to set
   --> src/filter.rs:111:19
    |
111 |             frame.set_cursor(x, y);
    |                   ^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated method `ratatui::Frame::<'_>::size`: use .area() as it's the more correct name
  --> src/state.rs:81:26
   |
81 |             .split(frame.size());
   |                          ^^^^

warning: `tui` (bin "linutil") generated 2 warnings

@nnyyxxxx
Copy link
Contributor

nnyyxxxx commented Sep 9, 2024

@fam007e These need to be put on separate lines with Resolves before them.
image

@fam007e fam007e changed the title Add automated Git config script and Nerd Fonts installer to linutil Add automated Git configuration, Nerd Fonts installer, and bootloader management scripts to linutil Sep 9, 2024
@nnyyxxxx
Copy link
Contributor

nnyyxxxx commented Sep 10, 2024

@fam007e You're adding too many things into 1 PR I'd recommend splitting this up into multiple.

@fam007e
Copy link
Author

fam007e commented Sep 10, 2024

OK I won't add anymore to this.

Cargo.toml Outdated Show resolved Hide resolved
- Reverted the previous changes made to Cargo.toml to maintain stability.
- Kept the GPU compatibility check to ensure proper setup for NVIDIA GPUs using nvidia-dkms.
- Added configuration to load necessary NVIDIA modules (nvidia, nvidia_modeset, nvidia_uvm, and nvidia_drm) for enhanced NVIDIA experience.
- Implemented Pacman hooks to automatically regenerate initramfs after NVIDIA package transactions for smoother updates.
- This setup provides a better NVIDIA experience for users who are not using the Cosmic Desktop with nvidia-lts.
@ChrisTitusTech
Copy link
Owner

Sorry for the inconvenience. We had a massive restructure of the codebase to improve future development. Because of this can you update your PR to the new structure. Thank you for your assistance and contribution.

fam007e and others added 2 commits September 13, 2024 15:34
- Fixed typo: corrected 'parrent' to 'parent' in hint.rs
- Added color to linutil logo in state.rs
- Updated preview image in README to show visual changes
@nnyyxxxx
Copy link
Contributor

@fam007e This needs to be rebased.

@fam007e
Copy link
Author

fam007e commented Sep 14, 2024

❯ git pull origin main
From github.com:fam007e/linutil
 * branch            main       -> FETCH_HEAD
Already up to date.
❯ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
❯ git rebase origin/main
Current branch main is up to date.

Despite a successful rebase and a clean status, GitHub still indicates that there are conflicts. I’m perplexed by this.

Here’s what I did:

  • Cleared my entire repository and re-added the files to incorporate recent structural changes.
  • Added my scripts and made minor edits to hint.rs to correct a few spelling mistakes.
  • Updated the logo to an ASCII representation of "Linutil" and used ANSI color codes in ratatui to add color (blue) to both the "CTT" and the ASCII logo "Linutil" via changes in state.rs.
  • Adjusted the tabs/system-setup/tab_data.toml file to accommodate the re-added scripts.
  • Ran cargo clean && cargo build && ./target/debug/linutil to test my changes.

As a result, the image in the README.md was updated accordingly.

I would appreciate any guidance on resolving this issue.

@jeevithakannan2
Copy link
Contributor

Can you please split this PR into separate feature PRs

@fam007e fam007e closed this Sep 15, 2024
@fam007e
Copy link
Author

fam007e commented Sep 15, 2024

Can you please split this PR into separate feature PRs

I am going for the hard reset. I will make the fork again and make two batches of commits one is for the scripts and another for the .rs files.

@jeevithakannan2
Copy link
Contributor

Each of the script should be a separate PR so that it will be easy to check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants