diff --git a/Cargo.toml b/Cargo.toml index fce957c..bcc9f55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "1.0.0" edition = "2021" authors = ["Andrew Kushyk "] description = "gnulinwiz (GNU/Linux Config Wizard) The ultimate post-installation setup assistant for GNU/Linux, streamlining your configuration process with ease and precision." -license = "GPL-3.0-or-later" +license = "AGPL-3.0-or-later" repository = "https://gitlab.com/git-user-cpp/gnulinwiz" [dependencies] diff --git a/README.md b/README.md index cf10b82..bacc0f2 100644 --- a/README.md +++ b/README.md @@ -58,23 +58,21 @@ https://git-user-cpp.github.io/gnulinwiz/gnulinwiz/index.html --- ## ⚠️ LICENSE ⚠️ - gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux, streamlining your configuration process with ease and precision. - + Copyright (C) 2025 Andrew Kushyk This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + GNU Affero General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . - --- diff --git a/docs/gnulinwiz/functionality/configs/fn.setup_root_config.html b/docs/gnulinwiz/functionality/configs/fn.setup_root_config.html index 0d04221..ce522f6 100644 --- a/docs/gnulinwiz/functionality/configs/fn.setup_root_config.html +++ b/docs/gnulinwiz/functionality/configs/fn.setup_root_config.html @@ -1,4 +1,4 @@ -setup_root_config in gnulinwiz::functionality::configs - Rust

Function setup_root_config

Source
pub fn setup_root_config(home_dir: &str) -> i8
Expand description

Configures the root user’s environment by copying user configurations to root directories.

+setup_root_config in gnulinwiz::functionality::configs - Rust

Function setup_root_config

Source
pub fn setup_root_config(home_dir: &str) -> i8
Expand description

Configures the root user’s environment by copying user configurations to root directories.

This function copies essential configuration files and directories (e.g., .oh-my-zsh, .zshrc, .vimrc) from the user’s home directory to the root user’s environment (e.g., /root). It uses sudo to perform the copy operations, ensuring root-owned files are updated correctly. The function diff --git a/docs/gnulinwiz/functionality/configs/fn.user_config_setup.html b/docs/gnulinwiz/functionality/configs/fn.user_config_setup.html index 3b150d8..7ee20d9 100644 --- a/docs/gnulinwiz/functionality/configs/fn.user_config_setup.html +++ b/docs/gnulinwiz/functionality/configs/fn.user_config_setup.html @@ -1,4 +1,4 @@ -user_config_setup in gnulinwiz::functionality::configs - Rust

Function user_config_setup

Source
pub fn user_config_setup(
+user_config_setup in gnulinwiz::functionality::configs - Rust

Function user_config_setup

Source
pub fn user_config_setup(
     config_path: &str,
     home_dir: &str,
     cfg_name: &str,
@@ -26,9 +26,11 @@ 

§Errors

  • The file copy operation fails due to permissions or other I/O errors.
  • §Example

    -
    use gnulinwiz::functionality::configs::user_config_setup;
    +
    // This example requires a valid ../configs/.zshrc file and write permissions.
    +// For actual testing, use integration tests with a mocked file system.
    +use gnulinwiz::functionality::configs::user_config_setup;
     let result = user_config_setup("../configs/.zshrc", "/home/user", "zsh");
    -assert_eq!(result, 0); // Configuration copied or skipped successfully
    +assert_eq!(result, 0); // Success if files exist and no overwrite prompt

    §See Also

    • prog_fun::read_input: Used to prompt the user for overwrite confirmation.
    • diff --git a/docs/gnulinwiz/functionality/configs/index.html b/docs/gnulinwiz/functionality/configs/index.html index 407f22d..d50bbc1 100644 --- a/docs/gnulinwiz/functionality/configs/index.html +++ b/docs/gnulinwiz/functionality/configs/index.html @@ -1,4 +1,4 @@ -gnulinwiz::functionality::configs - Rust

      Module configs

      Source
      Expand description

      Manages user and root configuration file setups, such as .zshrc and .vimrc.

      +gnulinwiz::functionality::configs - Rust

      Module configs

      Source
      Expand description

      Manages user and root configuration file setups, such as .zshrc and .vimrc.

      This submodule handles copying configuration files to user and root directories, ensuring consistent environments. It supports idempotent operations by checking for existing files and prompting for overwrites.

      diff --git a/docs/gnulinwiz/functionality/index.html b/docs/gnulinwiz/functionality/index.html index 880686b..96ec378 100644 --- a/docs/gnulinwiz/functionality/index.html +++ b/docs/gnulinwiz/functionality/index.html @@ -1,4 +1,4 @@ -gnulinwiz::functionality - Rust

      Module functionality

      Source
      Expand description

      The core module for the GNU/Linux Config Wizard, containing utilities for system configuration.

      +gnulinwiz::functionality - Rust

      Module functionality

      Source
      Expand description

      The core module for the GNU/Linux Config Wizard, containing utilities for system configuration.

      This module organizes functionality into submodules for tasks such as software installation, shell configuration, iptables setup, and ZRAM swap management. Each submodule provides specific tools to automate post-installation setup for GNU/Linux systems, ensuring a diff --git a/docs/gnulinwiz/functionality/iptables/fn.iptables_file_setup.html b/docs/gnulinwiz/functionality/iptables/fn.iptables_file_setup.html index 408ae9b..b0e2eb2 100644 --- a/docs/gnulinwiz/functionality/iptables/fn.iptables_file_setup.html +++ b/docs/gnulinwiz/functionality/iptables/fn.iptables_file_setup.html @@ -1,4 +1,4 @@ -iptables_file_setup in gnulinwiz::functionality::iptables - Rust

      Function iptables_file_setup

      Source
      pub fn iptables_file_setup() -> i8
      Expand description

      Sets up the iptables configuration file for network security.

      +iptables_file_setup in gnulinwiz::functionality::iptables - Rust

      Function iptables_file_setup

      Source
      pub fn iptables_file_setup() -> i8
      Expand description

      Sets up the iptables configuration file for network security.

      This function copies a predefined iptables rules file from ../configs/iptables.rules to /etc/iptables/iptables.rules, ensuring a secure firewall configuration in the “gnulinwiz” project. It checks for the source file’s existence and prompts the user to overwrite the destination if it @@ -17,9 +17,10 @@

      §Errors

    • Writing to /etc/iptables/iptables.rules fails due to permissions or sudo issues.

    §Example

    -
    use gnulinwiz::functionality::iptables::iptables_file_setup;
    +
    // Requires ../configs/iptables.rules and sudo privileges.
    +use gnulinwiz::functionality::iptables::iptables_file_setup;
     let result = iptables_file_setup();
    -assert_eq!(result, 0); // Rules file created or skipped successfully
    +assert_eq!(result, 0);

    §See Also

    • commands::run_sudo_command_with_stdin: Used to write the rules file with sudo.
    • diff --git a/docs/gnulinwiz/functionality/iptables/fn.iptables_rules_setup.html b/docs/gnulinwiz/functionality/iptables/fn.iptables_rules_setup.html index 3131f16..64895bb 100644 --- a/docs/gnulinwiz/functionality/iptables/fn.iptables_rules_setup.html +++ b/docs/gnulinwiz/functionality/iptables/fn.iptables_rules_setup.html @@ -1,4 +1,4 @@ -iptables_rules_setup in gnulinwiz::functionality::iptables - Rust

      Function iptables_rules_setup

      Source
      pub fn iptables_rules_setup() -> i8
      Expand description

      Applies the configured iptables rules to enforce network security.

      +iptables_rules_setup in gnulinwiz::functionality::iptables - Rust

      Function iptables_rules_setup

      Source
      pub fn iptables_rules_setup() -> i8
      Expand description

      Applies the configured iptables rules to enforce network security.

      This function uses iptables-restore to apply the rules stored in /etc/iptables/iptables.rules, activating the firewall configuration set up by iptables_file_setup. It executes the command with sudo to ensure proper permissions and is part of the “gnulinwiz” project’s post-installation diff --git a/docs/gnulinwiz/functionality/iptables/index.html b/docs/gnulinwiz/functionality/iptables/index.html index 7d5589b..487b69c 100644 --- a/docs/gnulinwiz/functionality/iptables/index.html +++ b/docs/gnulinwiz/functionality/iptables/index.html @@ -1,4 +1,4 @@ -gnulinwiz::functionality::iptables - Rust

      Module iptables

      Source
      Expand description

      Configures iptables firewall rules for network security.

      +gnulinwiz::functionality::iptables - Rust

      Module iptables

      Source
      Expand description

      Configures iptables firewall rules for network security.

      This submodule sets up and applies iptables rules by copying configuration files and executing restore commands. It ensures existing rules are preserved or overwritten with user confirmation.

      diff --git a/docs/gnulinwiz/functionality/shell/fn.install_omz.html b/docs/gnulinwiz/functionality/shell/fn.install_omz.html index d5a7dc4..7a16d47 100644 --- a/docs/gnulinwiz/functionality/shell/fn.install_omz.html +++ b/docs/gnulinwiz/functionality/shell/fn.install_omz.html @@ -1,4 +1,4 @@ -install_omz in gnulinwiz::functionality::shell - Rust

      Function install_omz

      Source
      pub fn install_omz() -> i8
      Expand description

      Installs Oh My Zsh to enhance the Zsh shell experience.

      +install_omz in gnulinwiz::functionality::shell - Rust

      Function install_omz

      Source
      pub fn install_omz() -> i8
      Expand description

      Installs Oh My Zsh to enhance the Zsh shell experience.

      This function downloads and installs Oh My Zsh by piping the official installation script from a remote URL through curl to bash. It checks if Oh My Zsh is already installed to avoid redundant operations, ensuring idempotency. The function is part of the “gnulinwiz” project’s @@ -16,9 +16,10 @@

      §Errors

    • The bash command fails to execute the script or returns a non-zero exit status.

    §Example

    -
    use gnulinwiz::functionality::shell::install_omz;
    +
    // Requires network access and curl/bash.
    +use gnulinwiz::functionality::shell::install_omz;
     let result = install_omz();
    -assert_eq!(result, 0); // Oh My Zsh installed or already present
    +assert_eq!(result, 0);

    §See Also

    • install_zsh_autosuggestions: Installs a complementary Zsh plugin.
    • diff --git a/docs/gnulinwiz/functionality/shell/fn.install_zsh_autosuggestions.html b/docs/gnulinwiz/functionality/shell/fn.install_zsh_autosuggestions.html index d9bd951..0716b6d 100644 --- a/docs/gnulinwiz/functionality/shell/fn.install_zsh_autosuggestions.html +++ b/docs/gnulinwiz/functionality/shell/fn.install_zsh_autosuggestions.html @@ -1,4 +1,4 @@ -install_zsh_autosuggestions in gnulinwiz::functionality::shell - Rust

      Function install_zsh_autosuggestions

      Source
      pub fn install_zsh_autosuggestions(home_dir: &str) -> i8
      Expand description

      Installs the Zsh Autosuggestions plugin for enhanced shell interaction.

      +install_zsh_autosuggestions in gnulinwiz::functionality::shell - Rust

      Function install_zsh_autosuggestions

      Source
      pub fn install_zsh_autosuggestions(home_dir: &str) -> i8
      Expand description

      Installs the Zsh Autosuggestions plugin for enhanced shell interaction.

      This function installs the Zsh Autosuggestions plugin by cloning its Git repository into the Oh My Zsh custom plugins directory. It ensures idempotency by checking for existing installations and is part of the “gnulinwiz” project’s post-installation setup to improve Zsh usability with @@ -15,9 +15,10 @@

      §Returns

      §Errors

      Returns 1 if the git clone command fails due to network issues, permissions, or invalid URLs.

      §Example

      -
      use gnulinwiz::functionality::shell::install_zsh_autosuggestions;
      +
      // Requires git and network access.
      +use gnulinwiz::functionality::shell::install_zsh_autosuggestions;
       let result = install_zsh_autosuggestions("/home/user");
      -assert_eq!(result, 0); // Plugin installed or already present
      +assert_eq!(result, 0);

      §See Also

      • install_zsh_plugin: The helper function performing the installation.
      • diff --git a/docs/gnulinwiz/functionality/shell/fn.install_zsh_syntax_highlighting.html b/docs/gnulinwiz/functionality/shell/fn.install_zsh_syntax_highlighting.html index a3979d9..2c6da23 100644 --- a/docs/gnulinwiz/functionality/shell/fn.install_zsh_syntax_highlighting.html +++ b/docs/gnulinwiz/functionality/shell/fn.install_zsh_syntax_highlighting.html @@ -1,4 +1,4 @@ -install_zsh_syntax_highlighting in gnulinwiz::functionality::shell - Rust

        Function install_zsh_syntax_highlighting

        Source
        pub fn install_zsh_syntax_highlighting(home_dir: &str) -> i8
        Expand description

        Installs the Zsh Syntax Highlighting plugin for improved shell readability.

        +install_zsh_syntax_highlighting in gnulinwiz::functionality::shell - Rust

        Function install_zsh_syntax_highlighting

        Source
        pub fn install_zsh_syntax_highlighting(home_dir: &str) -> i8
        Expand description

        Installs the Zsh Syntax Highlighting plugin for improved shell readability.

        This function installs the Zsh Syntax Highlighting plugin by cloning its Git repository into the Oh My Zsh custom plugins directory. It ensures idempotency by checking for existing installations and is part of the “gnulinwiz” project’s post-installation setup to enhance Zsh with syntax @@ -15,7 +15,8 @@

        §Returns

        §Errors

        Returns 1 if the git clone command fails due to network issues, permissions, or invalid URLs.

        §Example

        -
        use gnulinwiz::functionality::shell::install_zsh_syntax_highlighting;
        +
        // Requires git and network access.
        +use gnulinwiz::functionality::shell::install_zsh_syntax_highlighting;
         let result = install_zsh_syntax_highlighting("/home/user");
         assert_eq!(result, 0); // Plugin installed or already present

        §See Also

        diff --git a/docs/gnulinwiz/functionality/shell/index.html b/docs/gnulinwiz/functionality/shell/index.html index 7fab4eb..667b904 100644 --- a/docs/gnulinwiz/functionality/shell/index.html +++ b/docs/gnulinwiz/functionality/shell/index.html @@ -1,4 +1,4 @@ -gnulinwiz::functionality::shell - Rust

        Module shell

        Source
        Expand description

        Manages shell configurations, including Zsh setup and plugin installations.

        +gnulinwiz::functionality::shell - Rust

        Module shell

        Source
        Expand description

        Manages shell configurations, including Zsh setup and plugin installations.

        This submodule handles changing the default shell to Zsh, installing Oh My Zsh, and adding plugins like autosuggestions and syntax highlighting. It ensures idempotent operations to avoid redundant setups.

        diff --git a/docs/gnulinwiz/functionality/zram/fn.zram_swap_setup.html b/docs/gnulinwiz/functionality/zram/fn.zram_swap_setup.html index 0b27f23..481a00b 100644 --- a/docs/gnulinwiz/functionality/zram/fn.zram_swap_setup.html +++ b/docs/gnulinwiz/functionality/zram/fn.zram_swap_setup.html @@ -1,4 +1,4 @@ -zram_swap_setup in gnulinwiz::functionality::zram - Rust

        Function zram_swap_setup

        Source
        pub fn zram_swap_setup() -> i8
        Expand description

        Configures ZRAM swap to optimize system memory usage.

        +zram_swap_setup in gnulinwiz::functionality::zram - Rust

        Function zram_swap_setup

        Source
        pub fn zram_swap_setup() -> i8
        Expand description

        Configures ZRAM swap to optimize system memory usage.

        This function sets up ZRAM (compressed RAM-based swap) by copying a predefined configuration file from ../configs/zram-generator.conf to /etc/systemd/zram-generator.conf. It is part of the “gnulinwiz” project’s post-installation setup to enhance system performance by providing @@ -17,9 +17,11 @@

        §Errors

      • The copy operation fails due to permissions or sudo issues.

      §Example

      -
      use gnulinwiz::functionality::zram::zram_swap_setup;
      +
      // Requires ../configs/zram-generator.conf and sudo privileges.
      +// Use integration tests for actual validation.
      +use gnulinwiz::functionality::zram::zram_swap_setup;
       let result = zram_swap_setup();
      -assert_eq!(result, 0); // ZRAM configured or skipped successfully
      +assert_eq!(result, 0); // Success if config exists and no overwrite

      §See Also

      • commands::run_sudo_command: Used to copy the configuration file with sudo.
      • diff --git a/docs/gnulinwiz/functionality/zram/index.html b/docs/gnulinwiz/functionality/zram/index.html index 33de41a..14b5794 100644 --- a/docs/gnulinwiz/functionality/zram/index.html +++ b/docs/gnulinwiz/functionality/zram/index.html @@ -1,9 +1,11 @@ -gnulinwiz::functionality::zram - Rust

        Module zram

        Source
        Expand description

        Configures ZRAM swap for improved system performance.

        +gnulinwiz::functionality::zram - Rust

        Module zram

        Source
        Expand description

        Configures ZRAM swap for improved system performance.

        This submodule sets up compressed RAM-based swap by copying configuration files to the appropriate system directories. It checks for existing configurations to avoid overwrites unless confirmed by the user.

        §Example

        -
        use gnulinwiz::functionality::zram::zram_swap_setup;
        +
        // Requires ../configs/zram-generator.conf and sudo privileges.
        +// Use integration tests for actual validation.
        +use gnulinwiz::functionality::zram::zram_swap_setup;
         let result = zram_swap_setup();
        -assert_eq!(result, 0); // Successful ZRAM setup
        +assert_eq!(result, 0); // Success if config exists and no overwrite

        Functions§

        zram_swap_setup
        Configures ZRAM swap to optimize system memory usage.
        \ No newline at end of file diff --git a/docs/src/gnulinwiz/functionality.rs.html b/docs/src/gnulinwiz/functionality.rs.html index 8e00e9a..e525996 100644 --- a/docs/src/gnulinwiz/functionality.rs.html +++ b/docs/src/gnulinwiz/functionality.rs.html @@ -1,21 +1,21 @@ functionality.rs - source

        gnulinwiz/
        functionality.rs

        1/*
        -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
        -3 *  streamlining your configuration process with ease and precision.
        -4 *
        -5 *  Copyright (C) 2025  Andrew Kushyk
        +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
        +3 * streamlining your configuration process with ease and precision.
        +4 * 
        +5 * Copyright (C) 2025  Andrew Kushyk
         6 *
        -7 *  This program is free software: you can redistribute it and/or modify
        -8 *  it under the terms of the GNU General Public License as published by
        -9 *  the Free Software Foundation, either version 3 of the License, or
        -10 *  (at your option) any later version.
        +7 * This program is free software: you can redistribute it and/or modify
        +8 * it under the terms of the GNU Affero General Public License as published
        +9 * by the Free Software Foundation, either version 3 of the License, or
        +10 * (at your option) any later version.
         11 *
        -12 *  This program is distributed in the hope that it will be useful,
        -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
        -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        -15 *  GNU General Public License for more details.
        +12 * This program is distributed in the hope that it will be useful,
        +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
        +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        +15 * GNU Affero General Public License for more details.
         16 *
        -17 *  You should have received a copy of the GNU General Public License
        -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
        +17 * You should have received a copy of the GNU Affero General Public License
        +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
         19 */
         20
         21/// Provides utilities for executing system commands, including `sudo` and user-level operations.
        @@ -110,9 +110,11 @@
         110/// unless confirmed by the user.
         111///
         112/// # Example
        -113/// ```
        -114/// use gnulinwiz::functionality::zram::zram_swap_setup;
        -115/// let result = zram_swap_setup();
        -116/// assert_eq!(result, 0); // Successful ZRAM setup
        -117/// ```
        -118pub mod zram;
        \ No newline at end of file +113/// ```should_panic +114/// // Requires ../configs/zram-generator.conf and sudo privileges. +115/// // Use integration tests for actual validation. +116/// use gnulinwiz::functionality::zram::zram_swap_setup; +117/// let result = zram_swap_setup(); +118/// assert_eq!(result, 0); // Success if config exists and no overwrite +119/// ``` +120pub mod zram;
    \ No newline at end of file diff --git a/docs/src/gnulinwiz/functionality/commands.rs.html b/docs/src/gnulinwiz/functionality/commands.rs.html index f8380b7..a9e469b 100644 --- a/docs/src/gnulinwiz/functionality/commands.rs.html +++ b/docs/src/gnulinwiz/functionality/commands.rs.html @@ -1,21 +1,21 @@ commands.rs - source

    gnulinwiz/functionality/
    commands.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use colored::Colorize;
    diff --git a/docs/src/gnulinwiz/functionality/configs.rs.html b/docs/src/gnulinwiz/functionality/configs.rs.html
    index 8ff0b5c..05c8f59 100644
    --- a/docs/src/gnulinwiz/functionality/configs.rs.html
    +++ b/docs/src/gnulinwiz/functionality/configs.rs.html
    @@ -1,21 +1,21 @@
     configs.rs - source

    gnulinwiz/functionality/
    configs.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use super::commands::run_sudo_command;
    @@ -45,132 +45,134 @@
     45/// - The file copy operation fails due to permissions or other I/O errors.
     46///
     47/// # Example
    -48/// ```
    -49/// use gnulinwiz::functionality::configs::user_config_setup;
    -50/// let result = user_config_setup("../configs/.zshrc", "/home/user", "zsh");
    -51/// assert_eq!(result, 0); // Configuration copied or skipped successfully
    -52/// ```
    -53///
    -54/// # See Also
    -55/// - `prog_fun::read_input`: Used to prompt the user for overwrite confirmation.
    -56/// - `setup_root_config`: For configuring the root user’s environment.
    -57pub fn user_config_setup(config_path: &str, home_dir: &str, cfg_name: &str) -> i8 {
    -58    let source = Path::new(config_path);
    -59    let filename = match source.file_name() {
    -60        Some(name) => name,
    -61        None => {
    -62            eprintln!("{} Invalid path: {}", "error:".red(), config_path);
    -63            return 1;
    -64        }
    -65    };
    -66
    -67    let dest_path = Path::new(home_dir).join(filename);
    -68    if dest_path.exists() {
    -69        println!(
    -70            "{} exists. {} (y/n)",
    -71            dest_path.display(),
    -72            "Overwrite?".yellow()
    -73        );
    -74        let input = super::prog_fun::read_input().trim().to_lowercase();
    -75        if input != "y" {
    -76            println!("{} Skipped.", cfg_name.green());
    -77            return 0;
    -78        }
    -79    }
    -80
    -81    match std::fs::copy(config_path, &dest_path) {
    -82        Ok(_) => {
    -83            println!("{} {}.", cfg_name, "installed".green());
    -84            0
    -85        }
    -86        Err(e) => {
    -87            eprintln!("{} Failed to install {}: {}", "error:".red(), cfg_name, e);
    -88            1
    -89        }
    -90    }
    -91}
    -92
    -93// Copies a file or directory to a system location using root privileges.
    -94//
    -95// This private helper function executes a `cp` command with `sudo` to copy a file or directory
    -96// from a source to a destination, typically for root-owned locations like `/root`. It is used
    -97// by `setup_root_config` to set up root user configurations. The function logs success or failure
    -98// with descriptive messages.
    -99//
    -100// Arguments:
    -101// * `src` - The source path of the file or directory.
    -102// * `dest` - The destination path for the copy.
    -103// * `description` - A descriptive name for the item being copied (e.g., "Root Zsh config").
    -104//
    -105// Returns:
    -106// * `0` - The copy operation succeeded.
    -107// * `1` - The copy operation failed, with an error logged to stderr.
    -108fn copy_item_as_root(src: &str, dest: &str, description: &str) -> i8 {
    -109    match run_sudo_command("cp", &["-r", src, dest]) {
    -110        Ok(_) => {
    -111            println!("{} {}.", description, "created".green());
    -112            0
    -113        }
    -114        Err(e) => {
    -115            eprintln!("{} Failed to copy {}: {}", "error:".red(), description, e);
    -116            1
    -117        }
    -118    }
    -119}
    -120
    -121/// Configures the root user’s environment by copying user configurations to root directories.
    -122///
    -123/// This function copies essential configuration files and directories (e.g., `.oh-my-zsh`, `.zshrc`,
    -124/// `.vimrc`) from the user’s home directory to the root user’s environment (e.g., `/root`). It uses
    -125/// `sudo` to perform the copy operations, ensuring root-owned files are updated correctly. The function
    -126/// is part of the "gnulinwiz" project’s post-installation setup to provide a consistent root environment.
    -127///
    -128/// # Arguments
    -129/// * `home_dir` - The user’s home directory containing the source configurations (e.g., `"/home/user"`).
    -130///
    -131/// # Returns
    -132/// * `0` - All configurations were successfully copied.
    -133/// * `1` - An error occurred during one or more copy operations.
    -134///
    -135/// # Errors
    -136/// Returns `1` if any copy operation fails due to:
    -137/// - Insufficient permissions or invalid paths.
    -138/// - Errors in the `sudo` command execution.
    -139///
    -140/// # Example
    -141/// ```
    -142/// use gnulinwiz::functionality::configs::setup_root_config;
    -143/// let result = setup_root_config("/home/user");
    -144/// assert_eq!(result, 0); // Root configurations copied successfully
    -145/// ```
    -146///
    -147/// # See Also
    -148/// - `commands::run_sudo_command`: Used for executing copy operations with root privileges.
    -149/// - `user_config_setup`: For setting up user-specific configurations.
    -150pub fn setup_root_config(home_dir: &str) -> i8 {
    -151    let items = [
    -152        (
    -153            format!("{}/.oh-my-zsh", home_dir),
    -154            "/root/.oh-my-zsh",
    -155            "Root Oh My Zsh",
    -156        ),
    -157        (
    -158            format!("{}/.zshrc", home_dir),
    -159            "/root/.zshrc",
    -160            "Root Zsh config",
    -161        ),
    -162        (
    -163            format!("{}/.vimrc", home_dir),
    -164            "/root/.vimrc",
    -165            "Root Vim config",
    -166        ),
    -167    ];
    -168
    -169    for (src, dest, desc) in items.iter() {
    -170        if copy_item_as_root(src, dest, desc) != 0 {
    -171            return 1;
    -172        }
    -173    }
    -174
    -175    0
    -176}
    \ No newline at end of file +48/// ```should_panic +49/// // This example requires a valid ../configs/.zshrc file and write permissions. +50/// // For actual testing, use integration tests with a mocked file system. +51/// use gnulinwiz::functionality::configs::user_config_setup; +52/// let result = user_config_setup("../configs/.zshrc", "/home/user", "zsh"); +53/// assert_eq!(result, 0); // Success if files exist and no overwrite prompt +54/// ``` +55/// +56/// # See Also +57/// - `prog_fun::read_input`: Used to prompt the user for overwrite confirmation. +58/// - `setup_root_config`: For configuring the root user’s environment. +59pub fn user_config_setup(config_path: &str, home_dir: &str, cfg_name: &str) -> i8 { +60 let source = Path::new(config_path); +61 let filename = match source.file_name() { +62 Some(name) => name, +63 None => { +64 eprintln!("{} Invalid path: {}", "error:".red(), config_path); +65 return 1; +66 } +67 }; +68 +69 let dest_path = Path::new(home_dir).join(filename); +70 if dest_path.exists() { +71 println!( +72 "{} exists. {} (y/n)", +73 dest_path.display(), +74 "Overwrite?".yellow() +75 ); +76 let input = super::prog_fun::read_input().trim().to_lowercase(); +77 if input != "y" { +78 println!("{} Skipped.", cfg_name.green()); +79 return 0; +80 } +81 } +82 +83 match std::fs::copy(config_path, &dest_path) { +84 Ok(_) => { +85 println!("{} {}.", cfg_name, "installed".green()); +86 0 +87 } +88 Err(e) => { +89 eprintln!("{} Failed to install {}: {}", "error:".red(), cfg_name, e); +90 1 +91 } +92 } +93} +94 +95// Copies a file or directory to a system location using root privileges. +96// +97// This private helper function executes a `cp` command with `sudo` to copy a file or directory +98// from a source to a destination, typically for root-owned locations like `/root`. It is used +99// by `setup_root_config` to set up root user configurations. The function logs success or failure +100// with descriptive messages. +101// +102// Arguments: +103// * `src` - The source path of the file or directory. +104// * `dest` - The destination path for the copy. +105// * `description` - A descriptive name for the item being copied (e.g., "Root Zsh config"). +106// +107// Returns: +108// * `0` - The copy operation succeeded. +109// * `1` - The copy operation failed, with an error logged to stderr. +110fn copy_item_as_root(src: &str, dest: &str, description: &str) -> i8 { +111 match run_sudo_command("cp", &["-r", src, dest]) { +112 Ok(_) => { +113 println!("{} {}.", description, "created".green()); +114 0 +115 } +116 Err(e) => { +117 eprintln!("{} Failed to copy {}: {}", "error:".red(), description, e); +118 1 +119 } +120 } +121} +122 +123/// Configures the root user’s environment by copying user configurations to root directories. +124/// +125/// This function copies essential configuration files and directories (e.g., `.oh-my-zsh`, `.zshrc`, +126/// `.vimrc`) from the user’s home directory to the root user’s environment (e.g., `/root`). It uses +127/// `sudo` to perform the copy operations, ensuring root-owned files are updated correctly. The function +128/// is part of the "gnulinwiz" project’s post-installation setup to provide a consistent root environment. +129/// +130/// # Arguments +131/// * `home_dir` - The user’s home directory containing the source configurations (e.g., `"/home/user"`). +132/// +133/// # Returns +134/// * `0` - All configurations were successfully copied. +135/// * `1` - An error occurred during one or more copy operations. +136/// +137/// # Errors +138/// Returns `1` if any copy operation fails due to: +139/// - Insufficient permissions or invalid paths. +140/// - Errors in the `sudo` command execution. +141/// +142/// # Example +143/// ``` +144/// use gnulinwiz::functionality::configs::setup_root_config; +145/// let result = setup_root_config("/home/user"); +146/// assert_eq!(result, 0); // Root configurations copied successfully +147/// ``` +148/// +149/// # See Also +150/// - `commands::run_sudo_command`: Used for executing copy operations with root privileges. +151/// - `user_config_setup`: For setting up user-specific configurations. +152pub fn setup_root_config(home_dir: &str) -> i8 { +153 let items = [ +154 ( +155 format!("{}/.oh-my-zsh", home_dir), +156 "/root/.oh-my-zsh", +157 "Root Oh My Zsh", +158 ), +159 ( +160 format!("{}/.zshrc", home_dir), +161 "/root/.zshrc", +162 "Root Zsh config", +163 ), +164 ( +165 format!("{}/.vimrc", home_dir), +166 "/root/.vimrc", +167 "Root Vim config", +168 ), +169 ]; +170 +171 for (src, dest, desc) in items.iter() { +172 if copy_item_as_root(src, dest, desc) != 0 { +173 return 1; +174 } +175 } +176 +177 0 +178}
    \ No newline at end of file diff --git a/docs/src/gnulinwiz/functionality/env.rs.html b/docs/src/gnulinwiz/functionality/env.rs.html index 3a5b871..cdf3a6b 100644 --- a/docs/src/gnulinwiz/functionality/env.rs.html +++ b/docs/src/gnulinwiz/functionality/env.rs.html @@ -1,21 +1,21 @@ env.rs - source

    gnulinwiz/functionality/
    env.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use colored::Colorize;
    diff --git a/docs/src/gnulinwiz/functionality/iptables.rs.html b/docs/src/gnulinwiz/functionality/iptables.rs.html
    index ab0fcf6..245ffd3 100644
    --- a/docs/src/gnulinwiz/functionality/iptables.rs.html
    +++ b/docs/src/gnulinwiz/functionality/iptables.rs.html
    @@ -1,21 +1,21 @@
     iptables.rs - source

    gnulinwiz/functionality/
    iptables.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use super::commands::{run_sudo_command, run_sudo_command_with_stdin};
    @@ -41,94 +41,95 @@
     41/// - Writing to `/etc/iptables/iptables.rules` fails due to permissions or `sudo` issues.
     42///
     43/// # Example
    -44/// ```
    -45/// use gnulinwiz::functionality::iptables::iptables_file_setup;
    -46/// let result = iptables_file_setup();
    -47/// assert_eq!(result, 0); // Rules file created or skipped successfully
    -48/// ```
    -49///
    -50/// # See Also
    -51/// - `commands::run_sudo_command_with_stdin`: Used to write the rules file with `sudo`.
    -52/// - `prog_fun::read_input`: Used to prompt for overwrite confirmation.
    -53/// - `iptables_rules_setup`: Applies the configured rules.
    -54pub fn iptables_file_setup() -> i8 {
    -55    let src = "../configs/iptables.rules";
    -56    let dest = "/etc/iptables/iptables.rules";
    -57
    -58    if !std::path::Path::new(src).exists() {
    -59        eprintln!("{} Source file {} not found.", "error:".red(), src);
    -60        return 1;
    -61    }
    -62
    -63    let rules = match fs::read_to_string(src) {
    -64        Ok(r) => r,
    -65        Err(e) => {
    -66            eprintln!("{} Failed to read {}: {}", "error:".red(), src, e);
    -67            return 1;
    -68        }
    -69    };
    -70
    -71    if std::path::Path::new(dest).exists() {
    -72        println!("{} exists. Overwrite? (y/n)", dest);
    -73        let input = super::prog_fun::read_input().trim().to_lowercase();
    -74        if input != "y" {
    -75            println!("iptables rules {}.", "skipped".green());
    -76            return 0;
    -77        }
    -78    }
    -79
    -80    match run_sudo_command_with_stdin("tee", &[dest], rules) {
    -81        Ok(_) => {
    -82            println!("iptables rules {}.", "created".green());
    -83            0
    -84        }
    -85        Err(e) => {
    -86            eprintln!("{} Failed to write iptables rules: {}", "error:".red(), e);
    -87            1
    -88        }
    -89    }
    -90}
    -91
    -92/// Applies the configured iptables rules to enforce network security.
    -93///
    -94/// This function uses `iptables-restore` to apply the rules stored in `/etc/iptables/iptables.rules`,
    -95/// activating the firewall configuration set up by `iptables_file_setup`. It executes the command
    -96/// with `sudo` to ensure proper permissions and is part of the "gnulinwiz" project’s post-installation
    -97/// setup to secure the system’s network. The function logs success or failure with descriptive messages.
    -98///
    -99/// # Returns
    -100/// * `0` - The iptables rules were successfully applied.
    -101/// * `1` - An error occurred, such as a missing rules file or `sudo` command failure.
    -102///
    -103/// # Errors
    -104/// Returns `1` if:
    -105/// - The rules file `/etc/iptables/iptables.rules` does not exist or is invalid.
    -106/// - The `iptables-restore` command fails due to permissions or syntax errors in the rules.
    -107///
    -108/// # Example
    -109/// ```
    -110/// use gnulinwiz::functionality::iptables::iptables_rules_setup;
    -111/// let result = iptables_rules_setup();
    -112/// assert_eq!(result, 0); // Rules applied successfully
    -113/// ```
    -114///
    -115/// # See Also
    -116/// - `commands::run_sudo_command`: Used to execute `iptables-restore` with `sudo`.
    -117/// - `iptables_file_setup`: Sets up the rules file before application.
    -118pub fn iptables_rules_setup() -> i8 {
    -119    let rules_path = "/etc/iptables/iptables.rules";
    -120
    -121    match run_sudo_command(
    -122        "bash",
    -123        &["-c", &format!("iptables-restore < {}", rules_path)],
    -124    ) {
    -125        Ok(_) => {
    -126            println!("iptables rules {}.", "applied".green());
    -127            0
    -128        }
    -129        Err(e) => {
    -130            eprintln!("{} Failed to apply iptables rules: {}", "error:".red(), e);
    -131            1
    -132        }
    -133    }
    -134}
    \ No newline at end of file +44/// ```should_panic +45/// // Requires ../configs/iptables.rules and sudo privileges. +46/// use gnulinwiz::functionality::iptables::iptables_file_setup; +47/// let result = iptables_file_setup(); +48/// assert_eq!(result, 0); +49/// ``` +50/// +51/// # See Also +52/// - `commands::run_sudo_command_with_stdin`: Used to write the rules file with `sudo`. +53/// - `prog_fun::read_input`: Used to prompt for overwrite confirmation. +54/// - `iptables_rules_setup`: Applies the configured rules. +55pub fn iptables_file_setup() -> i8 { +56 let src = "../configs/iptables.rules"; +57 let dest = "/etc/iptables/iptables.rules"; +58 +59 if !std::path::Path::new(src).exists() { +60 eprintln!("{} Source file {} not found.", "error:".red(), src); +61 return 1; +62 } +63 +64 let rules = match fs::read_to_string(src) { +65 Ok(r) => r, +66 Err(e) => { +67 eprintln!("{} Failed to read {}: {}", "error:".red(), src, e); +68 return 1; +69 } +70 }; +71 +72 if std::path::Path::new(dest).exists() { +73 println!("{} exists. Overwrite? (y/n)", dest); +74 let input = super::prog_fun::read_input().trim().to_lowercase(); +75 if input != "y" { +76 println!("iptables rules {}.", "skipped".green()); +77 return 0; +78 } +79 } +80 +81 match run_sudo_command_with_stdin("tee", &[dest], rules) { +82 Ok(_) => { +83 println!("iptables rules {}.", "created".green()); +84 0 +85 } +86 Err(e) => { +87 eprintln!("{} Failed to write iptables rules: {}", "error:".red(), e); +88 1 +89 } +90 } +91} +92 +93/// Applies the configured iptables rules to enforce network security. +94/// +95/// This function uses `iptables-restore` to apply the rules stored in `/etc/iptables/iptables.rules`, +96/// activating the firewall configuration set up by `iptables_file_setup`. It executes the command +97/// with `sudo` to ensure proper permissions and is part of the "gnulinwiz" project’s post-installation +98/// setup to secure the system’s network. The function logs success or failure with descriptive messages. +99/// +100/// # Returns +101/// * `0` - The iptables rules were successfully applied. +102/// * `1` - An error occurred, such as a missing rules file or `sudo` command failure. +103/// +104/// # Errors +105/// Returns `1` if: +106/// - The rules file `/etc/iptables/iptables.rules` does not exist or is invalid. +107/// - The `iptables-restore` command fails due to permissions or syntax errors in the rules. +108/// +109/// # Example +110/// ``` +111/// use gnulinwiz::functionality::iptables::iptables_rules_setup; +112/// let result = iptables_rules_setup(); +113/// assert_eq!(result, 0); // Rules applied successfully +114/// ``` +115/// +116/// # See Also +117/// - `commands::run_sudo_command`: Used to execute `iptables-restore` with `sudo`. +118/// - `iptables_file_setup`: Sets up the rules file before application. +119pub fn iptables_rules_setup() -> i8 { +120 let rules_path = "/etc/iptables/iptables.rules"; +121 +122 match run_sudo_command( +123 "bash", +124 &["-c", &format!("iptables-restore < {}", rules_path)], +125 ) { +126 Ok(_) => { +127 println!("iptables rules {}.", "applied".green()); +128 0 +129 } +130 Err(e) => { +131 eprintln!("{} Failed to apply iptables rules: {}", "error:".red(), e); +132 1 +133 } +134 } +135}
    \ No newline at end of file diff --git a/docs/src/gnulinwiz/functionality/prog_fun.rs.html b/docs/src/gnulinwiz/functionality/prog_fun.rs.html index 235d602..a78a7a1 100644 --- a/docs/src/gnulinwiz/functionality/prog_fun.rs.html +++ b/docs/src/gnulinwiz/functionality/prog_fun.rs.html @@ -1,21 +1,21 @@ prog_fun.rs - source

    gnulinwiz/functionality/
    prog_fun.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use colored::Colorize;
    diff --git a/docs/src/gnulinwiz/functionality/shell.rs.html b/docs/src/gnulinwiz/functionality/shell.rs.html
    index f5579e1..b537605 100644
    --- a/docs/src/gnulinwiz/functionality/shell.rs.html
    +++ b/docs/src/gnulinwiz/functionality/shell.rs.html
    @@ -1,21 +1,21 @@
     shell.rs - source

    gnulinwiz/functionality/
    shell.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use super::commands::{run_sudo_command, run_user_command};
    @@ -82,173 +82,176 @@
     82/// - The `bash` command fails to execute the script or returns a non-zero exit status.
     83///
     84/// # Example
    -85/// ```
    -86/// use gnulinwiz::functionality::shell::install_omz;
    -87/// let result = install_omz();
    -88/// assert_eq!(result, 0); // Oh My Zsh installed or already present
    -89/// ```
    -90///
    -91/// # See Also
    -92/// - `install_zsh_autosuggestions`: Installs a complementary Zsh plugin.
    -93/// - `install_zsh_syntax_highlighting`: Installs another Zsh plugin.
    -94pub fn install_omz() -> i8 {
    -95    if std::path::Path::new("~/.oh-my-zsh").exists() {
    -96        println!("Oh My Zsh already installed.");
    -97        return 0;
    -98    }
    -99
    -100    let mut curl_cmd = Command::new("curl");
    -101    curl_cmd
    -102        .args(&[
    -103            "-fsSL",
    -104            "https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh",
    -105        ])
    -106        .stdout(Stdio::piped());
    -107
    -108    let curl_process = match curl_cmd.spawn() {
    -109        Ok(p) => p,
    -110        Err(e) => {
    -111            eprintln!("{} Failed to run curl: {}", "error:".red(), e);
    -112            return 1;
    -113        }
    -114    };
    -115
    -116    let curl_stdout = match curl_process.stdout {
    -117        Some(s) => s,
    -118        None => {
    -119            eprintln!("{} Failed to capture curl stdout.", "error:".red());
    -120            return 1;
    -121        }
    -122    };
    -123
    -124    let mut bash_cmd = Command::new("bash");
    -125    bash_cmd.stdin(Stdio::from(curl_stdout));
    -126    match bash_cmd.output() {
    -127        Ok(output) if output.status.success() => {
    -128            println!("Oh My Zsh {}.", "installed".green());
    -129            0
    -130        }
    -131        Ok(output) => {
    -132            eprintln!(
    -133                "{} Oh My Zsh failed:\nstdout: {}\nstderr: {}",
    -134                "error:".red(),
    -135                String::from_utf8_lossy(&output.stdout),
    -136                String::from_utf8_lossy(&output.stderr)
    -137            );
    -138            1
    -139        }
    -140        Err(e) => {
    -141            eprintln!("{} Failed to run bash: {}", "error:".red(), e);
    -142            1
    -143        }
    -144    }
    -145}
    -146
    -147// Installs a Zsh plugin by cloning a Git repository.
    -148//
    -149// This private helper function clones a specified Zsh plugin repository into the Oh My Zsh
    -150// custom plugins directory. It checks if the plugin is already installed to avoid redundant
    -151// cloning, ensuring idempotency. The function is used by `install_zsh_autosuggestions` and
    -152// `install_zsh_syntax_highlighting` to install specific plugins.
    -153//
    -154// Arguments:
    -155// * `home_dir` - The user’s home directory (e.g., "/home/user").
    -156// * `plugin_name` - The name of the plugin (e.g., "zsh-autosuggestions").
    -157// * `repo_url` - The Git repository URL for the plugin.
    -158//
    -159// Returns:
    -160// * `0` - The plugin was successfully installed or already present.
    -161// * `1` - An error occurred during the Git clone operation.
    -162fn install_zsh_plugin(home_dir: &str, plugin_name: &str, repo_url: &str) -> i8 {
    -163    let path = format!("{}/.oh-my-zsh/custom/plugins/{}", home_dir, plugin_name);
    -164    if std::path::Path::new(&path).exists() {
    -165        println!("{} already installed.", plugin_name);
    -166        return 0;
    -167    }
    -168
    -169    match run_user_command("git", &["clone", repo_url, &path]) {
    -170        Ok(_) => {
    -171            println!("{} {}.", plugin_name, "installed".green());
    -172            0
    -173        }
    -174        Err(e) => {
    -175            eprintln!(
    -176                "{} Failed to install {}: {}",
    -177                "error:".red(),
    -178                plugin_name,
    -179                e
    -180            );
    -181            1
    -182        }
    -183    }
    -184}
    -185
    -186/// Installs the Zsh Autosuggestions plugin for enhanced shell interaction.
    -187///
    -188/// This function installs the Zsh Autosuggestions plugin by cloning its Git repository into the
    -189/// Oh My Zsh custom plugins directory. It ensures idempotency by checking for existing installations
    -190/// and is part of the "gnulinwiz" project’s post-installation setup to improve Zsh usability with
    -191/// command suggestions based on history.
    -192///
    -193/// # Arguments
    -194/// * `home_dir` - The user’s home directory where Oh My Zsh is installed (e.g., `"/home/user"`).
    -195///
    -196/// # Returns
    -197/// * `0` - The plugin was successfully installed or already present.
    -198/// * `1` - An error occurred during the Git clone operation.
    -199///
    -200/// # Errors
    -201/// Returns `1` if the `git clone` command fails due to network issues, permissions, or invalid URLs.
    -202///
    -203/// # Example
    -204/// ```
    -205/// use gnulinwiz::functionality::shell::install_zsh_autosuggestions;
    -206/// let result = install_zsh_autosuggestions("/home/user");
    -207/// assert_eq!(result, 0); // Plugin installed or already present
    -208/// ```
    -209///
    -210/// # See Also
    -211/// - `install_zsh_plugin`: The helper function performing the installation.
    -212/// - `install_omz`: Installs Oh My Zsh, required for this plugin.
    -213pub fn install_zsh_autosuggestions(home_dir: &str) -> i8 {
    -214    install_zsh_plugin(
    -215        home_dir,
    -216        "zsh-autosuggestions",
    -217        "https://github.com/zsh-users/zsh-autosuggestions",
    -218    )
    -219}
    -220
    -221/// Installs the Zsh Syntax Highlighting plugin for improved shell readability.
    -222///
    -223/// This function installs the Zsh Syntax Highlighting plugin by cloning its Git repository into the
    -224/// Oh My Zsh custom plugins directory. It ensures idempotency by checking for existing installations
    -225/// and is part of the "gnulinwiz" project’s post-installation setup to enhance Zsh with syntax
    -226/// highlighting for commands and arguments.
    -227///
    -228/// # Arguments
    -229/// * `home_dir` - The user’s home directory where Oh My Zsh is installed (e.g., `"/home/user"`).
    -230///
    -231/// # Returns
    -232/// * `0` - The plugin was successfully installed or already present.
    -233/// * `1` - An error occurred during the Git clone operation.
    -234///
    -235/// # Errors
    -236/// Returns `1` if the `git clone` command fails due to network issues, permissions, or invalid URLs.
    -237///
    -238/// # Example
    -239/// ```
    -240/// use gnulinwiz::functionality::shell::install_zsh_syntax_highlighting;
    -241/// let result = install_zsh_syntax_highlighting("/home/user");
    -242/// assert_eq!(result, 0); // Plugin installed or already present
    -243/// ```
    -244///
    -245/// # See Also
    -246/// - `install_zsh_plugin`: The helper function performing the installation.
    -247/// - `install_omz`: Installs Oh My Zsh, required for this plugin.
    -248pub fn install_zsh_syntax_highlighting(home_dir: &str) -> i8 {
    -249    install_zsh_plugin(
    -250        home_dir,
    -251        "zsh-syntax-highlighting",
    -252        "https://github.com/zsh-users/zsh-syntax-highlighting.git",
    -253    )
    -254}
    \ No newline at end of file +85/// ```should_panic +86/// // Requires network access and curl/bash. +87/// use gnulinwiz::functionality::shell::install_omz; +88/// let result = install_omz(); +89/// assert_eq!(result, 0); +90/// ``` +91/// +92/// # See Also +93/// - `install_zsh_autosuggestions`: Installs a complementary Zsh plugin. +94/// - `install_zsh_syntax_highlighting`: Installs another Zsh plugin. +95pub fn install_omz() -> i8 { +96 if std::path::Path::new("~/.oh-my-zsh").exists() { +97 println!("Oh My Zsh already installed."); +98 return 0; +99 } +100 +101 let mut curl_cmd = Command::new("curl"); +102 curl_cmd +103 .args(&[ +104 "-fsSL", +105 "https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh", +106 ]) +107 .stdout(Stdio::piped()); +108 +109 let curl_process = match curl_cmd.spawn() { +110 Ok(p) => p, +111 Err(e) => { +112 eprintln!("{} Failed to run curl: {}", "error:".red(), e); +113 return 1; +114 } +115 }; +116 +117 let curl_stdout = match curl_process.stdout { +118 Some(s) => s, +119 None => { +120 eprintln!("{} Failed to capture curl stdout.", "error:".red()); +121 return 1; +122 } +123 }; +124 +125 let mut bash_cmd = Command::new("bash"); +126 bash_cmd.stdin(Stdio::from(curl_stdout)); +127 match bash_cmd.output() { +128 Ok(output) if output.status.success() => { +129 println!("Oh My Zsh {}.", "installed".green()); +130 0 +131 } +132 Ok(output) => { +133 eprintln!( +134 "{} Oh My Zsh failed:\nstdout: {}\nstderr: {}", +135 "error:".red(), +136 String::from_utf8_lossy(&output.stdout), +137 String::from_utf8_lossy(&output.stderr) +138 ); +139 1 +140 } +141 Err(e) => { +142 eprintln!("{} Failed to run bash: {}", "error:".red(), e); +143 1 +144 } +145 } +146} +147 +148// Installs a Zsh plugin by cloning a Git repository. +149// +150// This private helper function clones a specified Zsh plugin repository into the Oh My Zsh +151// custom plugins directory. It checks if the plugin is already installed to avoid redundant +152// cloning, ensuring idempotency. The function is used by `install_zsh_autosuggestions` and +153// `install_zsh_syntax_highlighting` to install specific plugins. +154// +155// Arguments: +156// * `home_dir` - The user’s home directory (e.g., "/home/user"). +157// * `plugin_name` - The name of the plugin (e.g., "zsh-autosuggestions"). +158// * `repo_url` - The Git repository URL for the plugin. +159// +160// Returns: +161// * `0` - The plugin was successfully installed or already present. +162// * `1` - An error occurred during the Git clone operation. +163fn install_zsh_plugin(home_dir: &str, plugin_name: &str, repo_url: &str) -> i8 { +164 let path = format!("{}/.oh-my-zsh/custom/plugins/{}", home_dir, plugin_name); +165 if std::path::Path::new(&path).exists() { +166 println!("{} already installed.", plugin_name); +167 return 0; +168 } +169 +170 match run_user_command("git", &["clone", repo_url, &path]) { +171 Ok(_) => { +172 println!("{} {}.", plugin_name, "installed".green()); +173 0 +174 } +175 Err(e) => { +176 eprintln!( +177 "{} Failed to install {}: {}", +178 "error:".red(), +179 plugin_name, +180 e +181 ); +182 1 +183 } +184 } +185} +186 +187/// Installs the Zsh Autosuggestions plugin for enhanced shell interaction. +188/// +189/// This function installs the Zsh Autosuggestions plugin by cloning its Git repository into the +190/// Oh My Zsh custom plugins directory. It ensures idempotency by checking for existing installations +191/// and is part of the "gnulinwiz" project’s post-installation setup to improve Zsh usability with +192/// command suggestions based on history. +193/// +194/// # Arguments +195/// * `home_dir` - The user’s home directory where Oh My Zsh is installed (e.g., `"/home/user"`). +196/// +197/// # Returns +198/// * `0` - The plugin was successfully installed or already present. +199/// * `1` - An error occurred during the Git clone operation. +200/// +201/// # Errors +202/// Returns `1` if the `git clone` command fails due to network issues, permissions, or invalid URLs. +203/// +204/// # Example +205/// ```should_panic +206/// // Requires git and network access. +207/// use gnulinwiz::functionality::shell::install_zsh_autosuggestions; +208/// let result = install_zsh_autosuggestions("/home/user"); +209/// assert_eq!(result, 0); +210/// ``` +211/// +212/// # See Also +213/// - `install_zsh_plugin`: The helper function performing the installation. +214/// - `install_omz`: Installs Oh My Zsh, required for this plugin. +215pub fn install_zsh_autosuggestions(home_dir: &str) -> i8 { +216 install_zsh_plugin( +217 home_dir, +218 "zsh-autosuggestions", +219 "https://github.com/zsh-users/zsh-autosuggestions", +220 ) +221} +222 +223/// Installs the Zsh Syntax Highlighting plugin for improved shell readability. +224/// +225/// This function installs the Zsh Syntax Highlighting plugin by cloning its Git repository into the +226/// Oh My Zsh custom plugins directory. It ensures idempotency by checking for existing installations +227/// and is part of the "gnulinwiz" project’s post-installation setup to enhance Zsh with syntax +228/// highlighting for commands and arguments. +229/// +230/// # Arguments +231/// * `home_dir` - The user’s home directory where Oh My Zsh is installed (e.g., `"/home/user"`). +232/// +233/// # Returns +234/// * `0` - The plugin was successfully installed or already present. +235/// * `1` - An error occurred during the Git clone operation. +236/// +237/// # Errors +238/// Returns `1` if the `git clone` command fails due to network issues, permissions, or invalid URLs. +239/// +240/// # Example +241/// ```should_panic +242/// // Requires git and network access. +243/// use gnulinwiz::functionality::shell::install_zsh_syntax_highlighting; +244/// let result = install_zsh_syntax_highlighting("/home/user"); +245/// assert_eq!(result, 0); // Plugin installed or already present +246/// ``` +247/// +248/// # See Also +249/// - `install_zsh_plugin`: The helper function performing the installation. +250/// - `install_omz`: Installs Oh My Zsh, required for this plugin. +251pub fn install_zsh_syntax_highlighting(home_dir: &str) -> i8 { +252 install_zsh_plugin( +253 home_dir, +254 "zsh-syntax-highlighting", +255 "https://github.com/zsh-users/zsh-syntax-highlighting.git", +256 ) +257}
    \ No newline at end of file diff --git a/docs/src/gnulinwiz/functionality/software.rs.html b/docs/src/gnulinwiz/functionality/software.rs.html index 274ef82..99eecf0 100644 --- a/docs/src/gnulinwiz/functionality/software.rs.html +++ b/docs/src/gnulinwiz/functionality/software.rs.html @@ -1,21 +1,21 @@ software.rs - source

    gnulinwiz/functionality/
    software.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use colored::Colorize;
    diff --git a/docs/src/gnulinwiz/functionality/task.rs.html b/docs/src/gnulinwiz/functionality/task.rs.html
    index 53cb160..2eb4d5d 100644
    --- a/docs/src/gnulinwiz/functionality/task.rs.html
    +++ b/docs/src/gnulinwiz/functionality/task.rs.html
    @@ -1,21 +1,21 @@
     task.rs - source

    gnulinwiz/functionality/
    task.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use colored::Colorize;
    diff --git a/docs/src/gnulinwiz/functionality/user_cfg.rs.html b/docs/src/gnulinwiz/functionality/user_cfg.rs.html
    index c29c1cc..c4afa4a 100644
    --- a/docs/src/gnulinwiz/functionality/user_cfg.rs.html
    +++ b/docs/src/gnulinwiz/functionality/user_cfg.rs.html
    @@ -1,21 +1,21 @@
     user_cfg.rs - source

    gnulinwiz/functionality/
    user_cfg.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21/// Stores user configuration data for the GNU/Linux Config Wizard.
    diff --git a/docs/src/gnulinwiz/functionality/zram.rs.html b/docs/src/gnulinwiz/functionality/zram.rs.html
    index 4ed314f..d40ed71 100644
    --- a/docs/src/gnulinwiz/functionality/zram.rs.html
    +++ b/docs/src/gnulinwiz/functionality/zram.rs.html
    @@ -1,21 +1,21 @@
     zram.rs - source

    gnulinwiz/functionality/
    zram.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21use super::commands::run_sudo_command;
    @@ -40,41 +40,43 @@
     40/// - The copy operation fails due to permissions or `sudo` issues.
     41///
     42/// # Example
    -43/// ```
    -44/// use gnulinwiz::functionality::zram::zram_swap_setup;
    -45/// let result = zram_swap_setup();
    -46/// assert_eq!(result, 0); // ZRAM configured or skipped successfully
    -47/// ```
    -48///
    -49/// # See Also
    -50/// - `commands::run_sudo_command`: Used to copy the configuration file with `sudo`.
    -51/// - `prog_fun::read_input`: Used to prompt for overwrite confirmation.
    -52pub fn zram_swap_setup() -> i8 {
    -53    let src = "../configs/zram-generator.conf";
    -54    let dest = "/etc/systemd/zram-generator.conf";
    -55
    -56    if !std::path::Path::new(src).exists() {
    -57        eprintln!("{} Source file {} not found.", "error:".red(), src);
    -58        return 1;
    -59    }
    -60
    -61    if std::path::Path::new(dest).exists() {
    -62        println!("{} exists. Overwrite? (y/n)", dest);
    -63        let input = super::prog_fun::read_input().trim().to_lowercase();
    -64        if input != "y" {
    -65            println!("ZRAM config {}.", "skipped".green());
    -66            return 0;
    -67        }
    -68    }
    -69
    -70    match run_sudo_command("cp", &[src, dest]) {
    -71        Ok(_) => {
    -72            println!("ZRAM {}.", "configured".green());
    -73            0
    -74        }
    -75        Err(e) => {
    -76            eprintln!("{} Failed to configure ZRAM: {}", "error:".red(), e);
    -77            1
    -78        }
    -79    }
    -80}
    \ No newline at end of file +43/// ```should_panic +44/// // Requires ../configs/zram-generator.conf and sudo privileges. +45/// // Use integration tests for actual validation. +46/// use gnulinwiz::functionality::zram::zram_swap_setup; +47/// let result = zram_swap_setup(); +48/// assert_eq!(result, 0); // Success if config exists and no overwrite +49/// ``` +50/// +51/// # See Also +52/// - `commands::run_sudo_command`: Used to copy the configuration file with `sudo`. +53/// - `prog_fun::read_input`: Used to prompt for overwrite confirmation. +54
    pub fn zram_swap_setup() -> i8 { +55 let src = "../configs/zram-generator.conf"; +56 let dest = "/etc/systemd/zram-generator.conf"; +57 +58 if !std::path::Path::new(src).exists() { +59 eprintln!("{} Source file {} not found.", "error:".red(), src); +60 return 1; +61 } +62 +63 if std::path::Path::new(dest).exists() { +64 println!("{} exists. Overwrite? (y/n)", dest); +65 let input = super::prog_fun::read_input().trim().to_lowercase(); +66 if input != "y" { +67 println!("ZRAM config {}.", "skipped".green()); +68 return 0; +69 } +70 } +71 +72 match run_sudo_command("cp", &[src, dest]) { +73 Ok(_) => { +74 println!("ZRAM {}.", "configured".green()); +75 0 +76 } +77 Err(e) => { +78 eprintln!("{} Failed to configure ZRAM: {}", "error:".red(), e); +79 1 +80 } +81 } +82}
    \ No newline at end of file diff --git a/docs/src/gnulinwiz/lib.rs.html b/docs/src/gnulinwiz/lib.rs.html index ae9211c..9a8a765 100644 --- a/docs/src/gnulinwiz/lib.rs.html +++ b/docs/src/gnulinwiz/lib.rs.html @@ -1,21 +1,21 @@ lib.rs - source

    gnulinwiz/
    lib.rs

    1/*
    -2 *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    -3 *  streamlining your configuration process with ease and precision.
    -4 *
    -5 *  Copyright (C) 2025  Andrew Kushyk
    +2 * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    +3 * streamlining your configuration process with ease and precision.
    +4 * 
    +5 * Copyright (C) 2025  Andrew Kushyk
     6 *
    -7 *  This program is free software: you can redistribute it and/or modify
    -8 *  it under the terms of the GNU General Public License as published by
    -9 *  the Free Software Foundation, either version 3 of the License, or
    -10 *  (at your option) any later version.
    +7 * This program is free software: you can redistribute it and/or modify
    +8 * it under the terms of the GNU Affero General Public License as published
    +9 * by the Free Software Foundation, either version 3 of the License, or
    +10 * (at your option) any later version.
     11 *
    -12 *  This program is distributed in the hope that it will be useful,
    -13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    -14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -15 *  GNU General Public License for more details.
    +12 * This program is distributed in the hope that it will be useful,
    +13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +15 * GNU Affero General Public License for more details.
     16 *
    -17 *  You should have received a copy of the GNU General Public License
    -18 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    +17 * You should have received a copy of the GNU Affero General Public License
    +18 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 */
     20
     21/// The core module for the GNU/Linux Config Wizard, containing utilities for system configuration.
    diff --git a/src/functionality.rs b/src/functionality.rs
    index 3327e00..8e244f4 100644
    --- a/src/functionality.rs
    +++ b/src/functionality.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     /// Provides utilities for executing system commands, including `sudo` and user-level operations.
    diff --git a/src/functionality/commands.rs b/src/functionality/commands.rs
    index a6a5724..31244e4 100644
    --- a/src/functionality/commands.rs
    +++ b/src/functionality/commands.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use colored::Colorize;
    diff --git a/src/functionality/configs.rs b/src/functionality/configs.rs
    index 833acd9..db90710 100644
    --- a/src/functionality/configs.rs
    +++ b/src/functionality/configs.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use super::commands::run_sudo_command;
    diff --git a/src/functionality/env.rs b/src/functionality/env.rs
    index e94d46e..86b2d69 100644
    --- a/src/functionality/env.rs
    +++ b/src/functionality/env.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use colored::Colorize;
    diff --git a/src/functionality/iptables.rs b/src/functionality/iptables.rs
    index 3a92cfa..122c251 100644
    --- a/src/functionality/iptables.rs
    +++ b/src/functionality/iptables.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use super::commands::{run_sudo_command, run_sudo_command_with_stdin};
    diff --git a/src/functionality/prog_fun.rs b/src/functionality/prog_fun.rs
    index 51847c3..a337bcf 100644
    --- a/src/functionality/prog_fun.rs
    +++ b/src/functionality/prog_fun.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use colored::Colorize;
    diff --git a/src/functionality/shell.rs b/src/functionality/shell.rs
    index d91584e..f21c7cc 100644
    --- a/src/functionality/shell.rs
    +++ b/src/functionality/shell.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use super::commands::{run_sudo_command, run_user_command};
    diff --git a/src/functionality/software.rs b/src/functionality/software.rs
    index 0aa4432..3d75355 100644
    --- a/src/functionality/software.rs
    +++ b/src/functionality/software.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use colored::Colorize;
    diff --git a/src/functionality/task.rs b/src/functionality/task.rs
    index 97db6a5..f25b6e5 100644
    --- a/src/functionality/task.rs
    +++ b/src/functionality/task.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use colored::Colorize;
    diff --git a/src/functionality/user_cfg.rs b/src/functionality/user_cfg.rs
    index 56de525..4f870de 100644
    --- a/src/functionality/user_cfg.rs
    +++ b/src/functionality/user_cfg.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     /// Stores user configuration data for the GNU/Linux Config Wizard.
    diff --git a/src/functionality/zram.rs b/src/functionality/zram.rs
    index 103af18..7aa4350 100644
    --- a/src/functionality/zram.rs
    +++ b/src/functionality/zram.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     use super::commands::run_sudo_command;
    diff --git a/src/lib.rs b/src/lib.rs
    index 860cd41..d668a8a 100644
    --- a/src/lib.rs
    +++ b/src/lib.rs
    @@ -1,21 +1,21 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
     
     /// The core module for the GNU/Linux Config Wizard, containing utilities for system configuration.
    diff --git a/src/main.rs b/src/main.rs
    index 66f538b..afa3de6 100644
    --- a/src/main.rs
    +++ b/src/main.rs
    @@ -1,23 +1,23 @@
     /*
    - *  gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    - *  streamlining your configuration process with ease and precision.
    + * gnulinwiz AKA GNU/Linux Config Wizard: The ultimate post-installation setup assistant for Linux,
    + * streamlining your configuration process with ease and precision.
    + * 
    + * Copyright (C) 2025  Andrew Kushyk
      *
    - *  Copyright (C) 2025  Andrew Kushyk
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Affero General Public License as published
    + * by the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
      *
    - *  This program is free software: you can redistribute it and/or modify
    - *  it under the terms of the GNU General Public License as published by
    - *  the Free Software Foundation, either version 3 of the License, or
    - *  (at your option) any later version.
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Affero General Public License for more details.
      *
    - *  This program is distributed in the hope that it will be useful,
    - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - *  GNU General Public License for more details.
    - *
    - *  You should have received a copy of the GNU General Public License
    - *  along with this program.  If not, see .
    + * You should have received a copy of the GNU Affero General Public License
    + * along with this program.  If not, see .
      */
    -
    + 
     use clap::Parser;
     use gnulinwiz::gnu_linux_default_setup;
     use std::process;