diff --git a/.github/mkdocs.yml b/.github/mkdocs.yml deleted file mode 100644 index 9f7e0038..00000000 --- a/.github/mkdocs.yml +++ /dev/null @@ -1,89 +0,0 @@ -site_name: Chris Titus LinUtil Official Documentation -repo_url: https://github.com/ChrisTitusTech/linutil -docs_dir: '../docs' - -nav: - - Introduction: 'index.md' - - User Guide: 'userguide.md' - - Contributing: - - Contributing Guide: 'contributing.md' - - Roadmap: 'roadmap.md' - - Documentation: - - Known Issues: 'KnownIssues.md' - - FAQ: 'faq.md' - -theme: - name: material - custom_dir: '../overrides' - features: - - navigation.tabs - - navigation.sections - - toc.integrate - - navigation.top - - search.suggest - - search.highlight - - content.tabs.link - - content.code.annotation - - content.code.copy - language: en - logo: assets/favicon.png - favicon: assets/favicon.png - palette: - # Palette toggle for automatic mode - - media: "(prefers-color-scheme)" - toggle: - icon: material/brightness-auto - name: Switch to light mode - - # Palette toggle for light mode - - media: "(prefers-color-scheme: light)" - scheme: default - accent: blue - toggle: - icon: material/brightness-7 - name: Switch to dark mode - - # Palette toggle for dark mode - - media: "(prefers-color-scheme: dark)" - scheme: slate - primary: black - accent: blue - toggle: - icon: material/weather-night - name: Switch to light mode -markdown_extensions: - - admonition - - pymdownx.details - - pymdownx.superfences - - pymdownx.superfences: - custom_fences: - - name: mermaid - class: mermaid - format: !!python/name:pymdownx.superfences.fence_code_format - - abbr - - attr_list - - pymdownx.snippets - - md_in_html - - pymdownx.superfences - - pymdownx.tabbed: - alternate_style: true - - pymdownx.highlight: - anchor_linenums: true - line_spans: __span - pygments_lang_class: true - - pymdownx.inlinehilite - - def_list - - pymdownx.tasklist: - custom_checkbox: true - - toc: - permalink: true - -plugins: - - search - - awesome-pages - - git-revision-date-localized - - minify: - minify_html: true - htmlmin_opts: - remove_comments: true - cache_safe: true diff --git a/docs/assets/preview.gif b/.github/preview.gif similarity index 100% rename from docs/assets/preview.gif rename to .github/preview.gif diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml deleted file mode 100644 index 94ca5e3c..00000000 --- a/.github/workflows/github-pages.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: GitHub Pages Deploy - -on: - push: - paths: - - '.github/mkdocs.yml' - - '.github/requirements.txt' - - 'docs/**' - - 'overrides/**' - - '.github/CONTRIBUTING.md' - workflow_dispatch: - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - environment: linutil_env - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - fetch-depth: '0' # Fetch all commit history for all branches as well as tags. - - - name: Copy Contributing Guidelines - run: | - echo -e "\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md' - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - commit-message: Update Contributing Guidelines - title: 'docs: Update Contributing Guidelines' - body: 'Automated update of Contributing Guidelines from .github/CONTRIBUTING.md' - branch: update-contributing-guidelines - delete-branch: true - base: main - labels: documentation - token: ${{ secrets.PAT_TOKEN }} - if: success() - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: 3.x # Install latest Stable release of Python 3 - cache: 'pip' # Caching pip dependencies - - - name: Install Necessary Dependencies - run: pip install -r .github/requirements.txt - - - name: Build & Deploy using mkdocs - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: mkdocs gh-deploy --force -f .github/mkdocs.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 4967eeef..d879346f 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -34,15 +34,14 @@ jobs: repo: context.repo.repo, per_page: 1 }); - core.setOutput('result', releases.data[0].tag_name); - result-encoding: string + return releases.data[0].tag_name; - name: Set tag name ( Workflow Run ) if: github.event_name == 'workflow_run' run: echo "tag_name=${{ steps.latest_tag.outputs.result }}" >> $GITHUB_ENV - name: Set tag name ( Workflow Dispatch ) - if: ${{ github.event_name }} == 'workflow_dispatch' + if: github.event_name == 'workflow_dispatch' run: echo "tag_name=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV - name: Download binary @@ -59,20 +58,19 @@ jobs: - name: Generate preview uses: charmbracelet/vhs-action@v2.1.0 with: - path: "docs/assets/preview.tape" + path: ".github/preview.tape" - name: Move preview - run: mv preview.gif docs/assets/preview.gif + run: mv preview.gif .github/preview.gif - name: Create PR uses: peter-evans/create-pull-request@v7.0.5 with: commit-message: Preview for ${{ env.tag_name }} - file-pattern: "docs/assets/preview.gif" - add-options: "--force" token: ${{ secrets.PAT_TOKEN }} branch: feature/preview-${{ env.tag_name }} title: "Update preview for ${{ env.tag_name }}" body: | Automated PR to update preview gif for version ${{ env.tag_name }} + ![preview](https://raw.githubusercontent.com/${{ github.repository }}/feature/preview-${{ env.tag_name }}/.github/preview.gif) if: success() diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index bfcc3bc8..e3be746d 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -6,6 +6,10 @@ on: - '**/*.sh' workflow_dispatch: +permissions: + contents: read + pull-requests: write + jobs: shellcheck: name: Shellcheck diff --git a/.github/workflows/xtask.yml b/.github/workflows/xtask.yml deleted file mode 100644 index fab93937..00000000 --- a/.github/workflows/xtask.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: XTasks - -on: - pull_request: - paths: - - "xtask" - - "Cargo.toml" - - "Cargo.lock" - - ".cargo" - - "core/tabs" - - "docs" - push: - paths: - - "xtask" - - "Cargo.toml" - - "Cargo.lock" - - ".cargo" - - "core/tabs" - - "docs" - -env: - CARGO_TERM_COLOR: always - -jobs: - docgen: - name: DocGen - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - - - name: Cache Cargo registry - uses: actions/cache@v4 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo index - uses: actions/cache@v4 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-index- - - - name: Run cargo xtask docgen - run: cargo xtask docgen - - - name: Check uncommitted documentation changes - run: | - git diff - git diff-files --quiet \ - || (echo "Run 'cargo xtask docgen' and push the changes" \ - && exit 1) diff --git a/Cargo.lock b/Cargo.lock index 36c3d923..60f37ffd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,18 +30,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] -name = "anstream" -version = "0.6.15" +name = "ansi-to-tui" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "67555e1f1ece39d737e28c8a017721287753af3f93225e4a445b29ccb0f5912c" dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", + "nom", + "ratatui", + "smallvec", + "thiserror", ] [[package]] @@ -50,34 +47,6 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" -[[package]] -name = "anstyle-parse" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" -dependencies = [ - "anstyle", - "windows-sys", -] - [[package]] name = "anyhow" version = "1.0.88" @@ -144,6 +113,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "clap" version = "4.5.20" @@ -160,10 +135,8 @@ version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ - "anstream", "anstyle", "clap_lex", - "strsim", ] [[package]] @@ -184,12 +157,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" -[[package]] -name = "colorchoice" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" - [[package]] name = "compact_str" version = "0.8.0" @@ -304,6 +271,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" + [[package]] name = "heck" version = "0.5.0" @@ -346,12 +319,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.1", ] [[package]] @@ -379,12 +352,6 @@ dependencies = [ "libc", ] -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - [[package]] name = "itertools" version = "0.13.0" @@ -430,6 +397,7 @@ version = "24.9.28" dependencies = [ "clap", "linutil_core", + "nix 0.29.0", "oneshot", "portable-pty", "rand", @@ -470,7 +438,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -515,6 +483,28 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -590,7 +580,7 @@ dependencies = [ "lazy_static", "libc", "log", - "nix", + "nix 0.25.1", "serial", "shared_library", "shell-words", @@ -684,9 +674,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -892,12 +882,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520" -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "strum" version = "0.26.3" @@ -946,6 +930,12 @@ dependencies = [ "libc", ] +[[package]] +name = "textwrap" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" + [[package]] name = "thiserror" version = "1.0.64" @@ -1022,9 +1012,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", @@ -1279,9 +1269,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] diff --git a/README.md b/README.md index 78bd1d0e..cd7149f2 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Crates.io Version](https://img.shields.io/crates/v/linutil_tui?style=for-the-badge&color=%23af3a03)](https://crates.io/crates/linutil_tui) [![linutil AUR Version](https://img.shields.io/aur/version/linutil?style=for-the-badge&label=%5BAUR%5D%20linutil&color=%23230567ff)](https://aur.archlinux.org/packages/linutil) [![linutil-bin AUR Version](https://img.shields.io/aur/version/linutil-bin?style=for-the-badge&label=%5BAUR%5D%20linutil-bin&color=%23230567ff)](https://aur.archlinux.org/packages/linutil-bin) -![Preview](docs/assets/preview.gif) +![Preview](/.github/preview.gif) **Linutil** is a distro-agnostic toolbox designed to simplify everyday Linux tasks. It helps you set up applications and optimize your system for specific use cases. The utility is actively developed in Rust 🦀, providing performance and reliability. @@ -24,13 +24,16 @@ curl -fsSL https://christitus.com/linux | sh ```bash curl -fsSL https://christitus.com/linuxdev | sh ``` -
- CLI arguments + +### CLI arguments Linutil supports various command-line arguments to customize its behavior. Here are some common arguments you can use: -- `-t, --theme ` : Set the theme to use in the application [default: default] [possible values: default, compatible]. +- `-c, --config ` : Path to the configuration file. - `--override-validation` : Show all available options, disregarding compatibility checks (UNSAFE). +- `--size-bypass` : Bypass the terminal size limit. +- `-y, --skip-confirmation` : Skip confirmation prompt before executing commands. +- `-t, --theme ` : Set the theme to use in the application [default: `default`] [possible values: `default`, `compatible`]. - `-h, --help` : Print help. For more detailed usage, run: @@ -42,7 +45,6 @@ curl -fsSL https://christitus.com/linux | sh -s -- --help ```bash linutil --help ``` -
## ⬇️ Installation @@ -128,13 +130,15 @@ If you find Linutil helpful, please consider giving it a ⭐️ to show your sup ## 🎓 Documentation -For comprehensive information on how to use Linutil, visit the [Linutil Official Documentation](https://christitustech.github.io/linutil/). +For comprehensive information on how to use Linutil, visit the [Linutil Official Documentation](https://chris-titus-docs.github.io/linutil-docs/). ## 🛠 Contributing We welcome contributions from the community! Before you start, please review our [Contributing Guidelines](.github/CONTRIBUTING.md) to understand how to make the most effective and efficient contributions. -[Official LinUtil Roadmap](https://christitustech.github.io/linutil/roadmap) +[Official LinUtil Roadmap](https://chris-titus-docs.github.io/linutil-docs/roadmap/) + +Docs are now [here](https://github.com/Chris-Titus-Docs/linutil-docs) ## 🏅 Thanks to All Contributors diff --git a/core/tabs/applications-setup/Developer-tools/ngrok-setup.sh b/core/tabs/applications-setup/Developer-tools/ngrok-setup.sh index 1ba6ff66..a45d7686 100644 --- a/core/tabs/applications-setup/Developer-tools/ngrok-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/ngrok-setup.sh @@ -4,8 +4,17 @@ installNgrok() { if ! command_exists ngrok; then - printf "%b\n" "${YELLOW}Installing Ngrok...${RC}" - curl -sSLO https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz | "$ESCALATION_TOOL" tar -xz -C /usr/local/bin + printf "%b\n" "${YELLOW}Installing Ngrok.${RC}" + case "$ARCH" in + x86_64) + url="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz" + ;; + aarch64) + url="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" + ;; + esac + curl -sSL "$url" -o ngrok.tgz + "$ESCALATION_TOOL" tar -xzf ngrok.tgz -C /usr/local/bin else printf "%b\n" "${GREEN}Ngrok is already installed.${RC}" fi @@ -13,4 +22,4 @@ installNgrok() { checkEnv checkEscalationTool -installNgrok \ No newline at end of file +installNgrok diff --git a/core/tabs/applications-setup/Developer-tools/sublime-setup.sh b/core/tabs/applications-setup/Developer-tools/sublime-setup.sh index 16c03497..18843752 100644 --- a/core/tabs/applications-setup/Developer-tools/sublime-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/sublime-setup.sh @@ -23,7 +23,12 @@ installSublime() { ;; dnf) "$ESCALATION_TOOL" rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.sublimetext.com/rpm/dev/x86_64/sublime-text.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.sublimetext.com/rpm/dev/x86_64/sublime-text.repo + fi "$ESCALATION_TOOL" "$PACKAGER" install -y sublime-text ;; *) diff --git a/core/tabs/applications-setup/auto-cpufreq.sh b/core/tabs/applications-setup/auto-cpufreq.sh new file mode 100644 index 00000000..b90744ca --- /dev/null +++ b/core/tabs/applications-setup/auto-cpufreq.sh @@ -0,0 +1,111 @@ +#!/bin/sh -e + +. ../common-script.sh + +installAutoCpufreq() { + clear + + AUTO_CPUFREQ_PATH="$HOME/.local/share/auto-cpufreq" + + if ! command_exists auto-cpufreq; then + printf "%b\n" "${YELLOW}Installing auto-cpufreq.${RC}" + + if ! command_exists git && [ "$PACKAGER" != "pacman" ]; then + printf "%b\n" "${YELLOW}Installing git.${RC}" + case "$PACKAGER" in + *) + "$ESCALATION_TOOL" "$PACKAGER" install -y git + ;; + esac + fi + + case "$PACKAGER" in + pacman) + if command_exists powerprofilesctl; then + printf "%b\n" "${YELLOW}Disabling powerprofilesctl service.${RC}" + "$ESCALATION_TOOL" systemctl disable --now power-profiles-daemon + fi + + "$AUR_HELPER" -S --needed --noconfirm auto-cpufreq + "$ESCALATION_TOOL" systemctl enable --now auto-cpufreq + ;; + *) + mkdir -p "$HOME/.local/share" + + if [ -d "$AUTO_CPUFREQ_PATH" ]; then + rm -rf "$AUTO_CPUFREQ_PATH" + fi + + printf "%b\n" "${YELLOW}Cloning auto-cpufreq repository.${RC}" + git clone --depth=1 https://github.com/AdnanHodzic/auto-cpufreq.git "$AUTO_CPUFREQ_PATH" + + cd "$AUTO_CPUFREQ_PATH" + printf "%b\n" "${YELLOW}Running auto-cpufreq installer.${RC}" + "$ESCALATION_TOOL" ./auto-cpufreq-installer + "$ESCALATION_TOOL" auto-cpufreq --install + ;; + esac + else + printf "%b\n" "${GREEN}auto-cpufreq is already installed.${RC}" + fi +} + +applyTweak() { + printf "%b\n" "${YELLOW}Configuring auto-cpufreq.${RC}" + + if command_exists auto-cpufreq; then + if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then + printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop.${RC}" + "$ESCALATION_TOOL" auto-cpufreq --force powersave + else + printf "%b\n" "${GREEN}System detected as desktop. Updating auto-cpufreq for desktop.${RC}" + "$ESCALATION_TOOL" auto-cpufreq --force performance + fi + else + printf "%b\n" "${RED}auto-cpufreq is not installed.${RC}" + exit 1 + fi +} + +removeTweak() { + if command_exists auto-cpufreq; then + printf "%b\n" "${YELLOW}Removing auto-cpufreq tweak.${RC}" + "$ESCALATION_TOOL" auto-cpufreq --force reset + else + printf "%b\n" "${RED}auto-cpufreq is not installed.${RC}" + exit 1 + fi +} + +main() { + printf "%b\n" "${YELLOW}Do you want to apply the auto-cpufreq tweak or remove it?${RC}" + printf "%b\n" "${YELLOW}1) Apply tweak${RC}" + printf "%b\n" "${YELLOW}2) Remove tweak${RC}" + printf "%b\n" "${YELLOW}3) Exit${RC}" + printf "%b" "Enter your choice [1/3]: " + read -r choice + + case "$choice" in + 1) + applyTweak + ;; + 2) + removeTweak + ;; + 3) + printf "%b\n" "${GREEN}Exiting.${RC}" + exit 0 + ;; + *) + printf "%b\n" "${RED}Invalid choice. Exiting.${RC}" + exit 1 + ;; + esac + + printf "%b\n" "${GREEN}auto-cpufreq setup complete.${RC}" +} + +checkEnv +checkEscalationTool +installAutoCpufreq +main diff --git a/core/tabs/applications-setup/browsers/brave.sh b/core/tabs/applications-setup/browsers/brave.sh index 6618f0fe..995775e3 100644 --- a/core/tabs/applications-setup/browsers/brave.sh +++ b/core/tabs/applications-setup/browsers/brave.sh @@ -25,7 +25,12 @@ installBrave() { ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + fi "$ESCALATION_TOOL" rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc "$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser ;; diff --git a/core/tabs/applications-setup/browsers/vivaldi.sh b/core/tabs/applications-setup/browsers/vivaldi.sh index 311816d0..28535a52 100644 --- a/core/tabs/applications-setup/browsers/vivaldi.sh +++ b/core/tabs/applications-setup/browsers/vivaldi.sh @@ -15,7 +15,12 @@ installVivaldi() { ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y dnf-plugins-core - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://repo.vivaldi.com/stable/vivaldi-fedora.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://repo.vivaldi.com/stable/vivaldi-fedora.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://repo.vivaldi.com/stable/vivaldi-fedora.repo + fi "$ESCALATION_TOOL" "$PACKAGER" install -y vivaldi-stable ;; zypper) diff --git a/core/tabs/applications-setup/docker-setup.sh b/core/tabs/applications-setup/docker-setup.sh index c4fc53ff..b693656b 100755 --- a/core/tabs/applications-setup/docker-setup.sh +++ b/core/tabs/applications-setup/docker-setup.sh @@ -28,7 +28,12 @@ install_docker() { ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo + fi "$ESCALATION_TOOL" "$PACKAGER" -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin "$ESCALATION_TOOL" systemctl enable --now docker ;; @@ -58,7 +63,12 @@ install_docker_compose() { ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core - "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo + fi "$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin ;; zypper) diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml index 4e6df84a..a1a3ea45 100644 --- a/core/tabs/applications-setup/tab_data.toml +++ b/core/tabs/applications-setup/tab_data.toml @@ -227,6 +227,12 @@ description = "Universal Android Debloater (UAD) is a tool designed to help user script = "android-debloat.sh" task_list = "I" +[[data]] +name = "Auto CPU Frequency" +description = "Automatic CPU speed & power optimizer.\nhttps://github.com/AdnanHodzic/auto-cpufreq" +script = "auto-cpufreq.sh" +task_list = "I SS" + [[data]] name = "Bash Prompt" description = "The .bashrc file is a script that runs every time a new terminal session is started in Unix-like operating systems. It is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful. This command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository. https://github.com/ChrisTitusTech/mybash" diff --git a/core/tabs/applications-setup/waydroid-setup.sh b/core/tabs/applications-setup/waydroid-setup.sh index 8cac399f..0d305e65 100755 --- a/core/tabs/applications-setup/waydroid-setup.sh +++ b/core/tabs/applications-setup/waydroid-setup.sh @@ -3,7 +3,7 @@ . ../common-script.sh checkGpu() { - if lspci | grep -i nvidia > /dev/null; then + if lspci | grep -i nvidia >/dev/null; then printf "%b\n" "${RED}Waydroid is not compatible with NVIDIA GPUs.${RC}" exit 1 fi @@ -11,28 +11,31 @@ checkGpu() { installWaydroid() { if ! command_exists waydroid; then - printf "%b\n" "${YELLOW}Installing Waydroid...${RC}" + printf "%b\n" "${YELLOW}Installing Waydroid...${RC}" case "$PACKAGER" in pacman) "$AUR_HELPER" -S --needed --noconfirm waydroid + if ! command_exists dkms; then - installed_kernels=$("$PACKAGER" -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1) - for kernel in $installed_kernels; do - header="${kernel}-headers" - printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}" - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header" - done "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm dkms fi + + installed_kernels=$("$PACKAGER" -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1) + for kernel in $installed_kernels; do + header="${kernel}-headers" + printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}" + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header" + done + "$AUR_HELPER" -S --needed --noconfirm binder_linux-dkms "$ESCALATION_TOOL" modprobe binder-linux device=binder,hwbinder,vndbinder ;; - apt-get|nala) + apt-get | nala) curl https://repo.waydro.id | "$ESCALATION_TOOL" sh "$ESCALATION_TOOL" "$PACKAGER" install -y waydroid if command_exists dkms; then "$ESCALATION_TOOL" "$PACKAGER" install -y git - mkdir -p "$HOME/.local/share/" # only create it if it doesnt exist + mkdir -p "$HOME/.local/share/" git clone https://github.com/choff/anbox-modules.git "$HOME/.local/share/anbox-modules" cd "$HOME/.local/share/anbox-modules" "$ESCALATION_TOOL" cp anbox.conf /etc/modules-load.d/ @@ -47,7 +50,7 @@ installWaydroid() { "$ESCALATION_TOOL" "$PACKAGER" install -y waydroid if command_exists dkms; then "$ESCALATION_TOOL" "$PACKAGER" install -y git - mkdir -p "$HOME/.local/share/" # only create it if it doesnt exist + mkdir -p "$HOME/.local/share/" git clone https://github.com/choff/anbox-modules.git "$HOME/.local/share/anbox-modules" cd "$HOME/.local/share/anbox-modules" "$ESCALATION_TOOL" cp anbox.conf /etc/modules-load.d/ diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh index f8188ac3..c3472c08 100644 --- a/core/tabs/common-script.sh +++ b/core/tabs/common-script.sh @@ -86,6 +86,13 @@ checkAURHelper() { checkEscalationTool() { ## Check for escalation tools. if [ -z "$ESCALATION_TOOL_CHECKED" ]; then + if [ "$(id -u)" = "0" ]; then + ESCALATION_TOOL="eval" + ESCALATION_TOOL_CHECKED=true + printf "%b\n" "${CYAN}Running as root, no escalation needed${RC}" + return 0 + fi + ESCALATION_TOOLS='sudo doas' for tool in ${ESCALATION_TOOLS}; do if command_exists "${tool}"; then diff --git a/core/tabs/utils/create-bootable-usb.sh b/core/tabs/utils/create-bootable-usb.sh index 09b24d4d..a2994356 100644 --- a/core/tabs/utils/create-bootable-usb.sh +++ b/core/tabs/utils/create-bootable-usb.sh @@ -236,7 +236,8 @@ write_iso(){ printf "%b" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (y/N): ${RC}" read -r CONFIRMATION - if [ "$CONFIRMATION" != "yes" ]; then + CONFIRMATION="$(echo "$CONFIRMATION" | tr '[:upper:]' '[:lower:]')" + if [ "${CONFIRMATION}" != "yes" ] && [ "${CONFIRMATION}" != "y" ]; then printf "%b\n" "${YELLOW}Operation cancelled.${RC}" exit 1 fi diff --git a/core/tabs/utils/power-profile.sh b/core/tabs/utils/power-profile.sh deleted file mode 100644 index 9c242c4d..00000000 --- a/core/tabs/utils/power-profile.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -e - -. ../common-script.sh - -installAutoCpufreq() { - clear - printf "%b\n" "${YELLOW}Checking if auto-cpufreq is already installed...${RC}" - - # Check if auto-cpufreq is already installed - if command_exists auto-cpufreq; then - printf "%b\n" "${GREEN}auto-cpufreq is already installed.${RC}" - else - printf "%b\n" "${YELLOW}Installing auto-cpufreq...${RC}" - - # Install git if not already installed - if ! command_exists git; then - printf "%b\n" "${YELLOW}git not found. Installing git...${RC}" - case "$PACKAGER" in - pacman) - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm git - ;; - apk) - "$ESCALATION_TOOL" "$PACKAGER" add git - ;; - *) - "$ESCALATION_TOOL" "$PACKAGER" install -y git - ;; - esac - fi - - # Clone the auto-cpufreq repository and run the installer - if [ ! -d "auto-cpufreq" ]; then - printf "%b\n" "${YELLOW}Cloning auto-cpufreq repository...${RC}" - git clone https://github.com/AdnanHodzic/auto-cpufreq.git - fi - - cd auto-cpufreq - printf "%b\n" "${YELLOW}Running auto-cpufreq installer...${RC}" - "$ESCALATION_TOOL" ./auto-cpufreq-installer - "$ESCALATION_TOOL" auto-cpufreq --install - - cd .. - fi -} - -configureAutoCpufreq() { - printf "%b\n" "${YELLOW}Configuring auto-cpufreq...${RC}" - - if command_exists auto-cpufreq; then - # Check if the system has a battery to determine if it's a laptop - if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then - printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop...${RC}" - "$ESCALATION_TOOL" auto-cpufreq --force powersave - else - printf "%b\n" "${GREEN}System detected as desktop. Updating auto-cpufreq for desktop...${RC}" - "$ESCALATION_TOOL" auto-cpufreq --force performance - fi - else - printf "%b\n" "${RED}auto-cpufreq is not installed, skipping configuration.${RC}" - fi -} - -removeAutoCpufreqTweak() { - printf "%b\n" "${YELLOW}Removing auto-cpufreq tweak...${RC}" - - if command_exists auto-cpufreq; then - printf "%b\n" "${YELLOW}Resetting auto-cpufreq configuration...${RC}" - "$ESCALATION_TOOL" auto-cpufreq --force reset - else - printf "%b\n" "${RED}auto-cpufreq is not installed, skipping removal.${RC}" - fi -} - -apply_or_remove_auto_cpufreq() { - # Prompt user for action - printf "%b\n" "${YELLOW}Do you want to apply the auto-cpufreq tweak or remove it?${RC}" - printf "%b\n" "${YELLOW}1) Apply tweak${RC}" - printf "%b\n" "${YELLOW}2) Remove tweak${RC}" - printf "%b" "Enter your choice [1/2]: " - read -r choice - - case $choice in - 1) - configureAutoCpufreq - ;; - 2) - removeAutoCpufreqTweak - ;; - *) - printf "%b\n" "${RED}Invalid choice. Exiting.${RC}" - exit 1 - ;; - esac - - printf "%b\n" "${GREEN}auto-cpufreq setup complete.${RC}" -} - -checkEnv -checkEscalationTool -installAutoCpufreq -apply_or_remove_auto_cpufreq diff --git a/core/tabs/utils/tab_data.toml b/core/tabs/utils/tab_data.toml index 7afc2e27..034d8749 100644 --- a/core/tabs/utils/tab_data.toml +++ b/core/tabs/utils/tab_data.toml @@ -127,11 +127,6 @@ name = "Auto Login" script = "auto-login.sh" task_list = "DE setup" -[[data]] -name = "Auto Power Profiling" -script = "power-profile.sh" -task_list = "I" - [[data]] name = "Bluetooth Manager" description = "This utility is designed to manage bluetooth in your system" diff --git a/docs/KnownIssues.md b/docs/KnownIssues.md deleted file mode 100644 index 0d12097e..00000000 --- a/docs/KnownIssues.md +++ /dev/null @@ -1,4 +0,0 @@ -# Known Issues ---- - -- [Known Issues](https://github.com/ChrisTitusTech/linutil/issues) diff --git a/docs/assets/favicon.png b/docs/assets/favicon.png deleted file mode 100644 index a4f4bc5d..00000000 Binary files a/docs/assets/favicon.png and /dev/null differ diff --git a/docs/assets/preview.tape b/docs/assets/preview.tape deleted file mode 100644 index 66b1c359..00000000 --- a/docs/assets/preview.tape +++ /dev/null @@ -1,89 +0,0 @@ -# VHS documentation -# -# Output: -# Output .gif Create a GIF output at the given -# Output .mp4 Create an MP4 output at the given -# Output .webm Create a WebM output at the given -# -# Require: -# Require Ensure a program is on the $PATH to proceed -# -# Settings: -# Set FontSize Set the font size of the terminal -# Set FontFamily Set the font family of the terminal -# Set Height Set the height of the terminal -# Set Width Set the width of the terminal -# Set LetterSpacing Set the font letter spacing (tracking) -# Set LineHeight Set the font line height -# Set LoopOffset % Set the starting frame offset for the GIF loop -# Set Theme Set the theme of the terminal -# Set Padding Set the padding of the terminal -# Set Framerate Set the framerate of the recording -# Set PlaybackSpeed Set the playback speed of the recording -# Set MarginFill Set the file or color the margin will be filled with. -# Set Margin Set the size of the margin. Has no effect if MarginFill isn't set. -# Set BorderRadius Set terminal border radius, in pixels. -# Set WindowBar Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight) -# Set WindowBarSize Set window bar size, in pixels. Default is 40. -# Set TypingSpeed