From 652b8808a96d4391359f342d8bec8692d5227983 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:22:51 +0530 Subject: [PATCH 01/12] xtask docgen (#924) --- docs/userguide.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/userguide.md b/docs/userguide.md index bd1649e4a..24a332c70 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -50,15 +50,14 @@ https://github.com/ChrisTitusTech/neovim - **Bash Prompt**: 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 - **Bottles**: Bottles allows Windows software, like applications and games, to run on Linux. Bottles also provides tools to categorize, organize and optimize your applications. - **Docker**: Docker is an open platform that uses OS-level virtualization to deliver software in packages called containers. +- **Podman**: Podman is a daemon-less open platform that uses OS-level virtualization to deliver software in packages called containers. +- **Podman-compose**: Podman Compose is a tool for defining and running multi-container applications using Podman. - **DWM-Titus**: DWM is a dynamic window manager for X. It manages windows in tiled, monocle and floating layouts. All of the layouts can be applied dynamically, optimising the environment for the application in use and the task performed. This command installs and configures DWM and a desktop manager. The list of patches applied can be found in CTT's DWM repository https://github.com/ChrisTitusTech/dwm-titus -- **Docker**: Docker is an open platform that uses OS-level virtualization to deliver software in packages called containers. -- **Podman**: Podman is a daemon-less open platform that uses OS-level virtualization to deliver software in packages called containers. -- **Podman-compose**: Podman Compose is a tool for defining and running multi-container applications using Podman. - **Fastfetch**: Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind. This command installs fastfetch and configures from CTT's mybash repository. https://github.com/ChrisTitusTech/mybash - **Flatpak / Flathub**: Flatpak is a universal application sandbox for Linux that uses isolated packages from Flathub to prevent conflicts and system alterations, while alleviating dependency concerns. This command installs Flatpak and adds the Flathub repository - **Grub Theme**: Installs ChrisTitusTech's Top 5 Bootloader Themes script to allow for easy customization of GRUB. From 421044f43e4369b7510971458ab1430ccb079536 Mon Sep 17 00:00:00 2001 From: nyx Date: Thu, 7 Nov 2024 13:58:18 -0500 Subject: [PATCH 02/12] fix reversion (#923) --- tui/src/floating_text.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tui/src/floating_text.rs b/tui/src/floating_text.rs index 50655df15..c307b8542 100644 --- a/tui/src/floating_text.rs +++ b/tui/src/floating_text.rs @@ -170,7 +170,7 @@ impl FloatingText { fn scroll_down(&mut self) { let visible_lines = self.frame_height.saturating_sub(2); - if self.v_scroll + visible_lines < self.src.len() { + if self.v_scroll + visible_lines < self.wrapped_lines.len() { self.v_scroll += 1; } } From 980365f7c95d2488005fb5b7e723d368ee4bcc8d Mon Sep 17 00:00:00 2001 From: Liam <33645555+lj3954@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:00:34 -0600 Subject: [PATCH 03/12] refactor: Re-export ego-tree dependency from linutil core (#811) * refactor: Export ego-tree from linutil core, rather than workspace * refactor: Improve code formatting --------- Co-authored-by: Chris Titus --- Cargo.lock | 5 ++--- Cargo.toml | 3 --- core/Cargo.toml | 8 ++------ core/src/lib.rs | 1 + tui/Cargo.toml | 1 - tui/src/filter.rs | 3 +-- tui/src/hint.rs | 9 ++++----- tui/src/state.rs | 4 ++-- 8 files changed, 12 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 094a02ed1..605cd30ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -250,9 +250,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "ego-tree" -version = "0.6.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12a0bb14ac04a9fcf170d0bbbef949b44cc492f4452bd20c095636956f653642" +checksum = "7c6ba7d4eec39eaa9ab24d44a0e73a7949a1095a8b3f3abb11eddf27dbb56a53" [[package]] name = "either" @@ -435,7 +435,6 @@ dependencies = [ "ansi-to-tui", "anstyle", "clap", - "ego-tree", "linutil_core", "oneshot", "portable-pty", diff --git a/Cargo.toml b/Cargo.toml index ef31b2a96..2fa6d68d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,9 +3,6 @@ license = "MIT" version = "24.9.28" edition = "2021" -[workspace.dependencies] -ego-tree = "0.6.2" - [workspace] members = ["tui", "core", "xtask"] default-members = ["tui", "core"] diff --git a/core/Cargo.toml b/core/Cargo.toml index d3f420117..f07d4b779 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -5,11 +5,7 @@ repository = "https://github.com/ChrisTitusTech/linutil/tree/main/core" edition = "2021" version.workspace = true license.workspace = true -include = [ - "src/*.rs", - "Cargo.toml", - "tabs/**", -] +include = ["src/*.rs", "Cargo.toml", "tabs/**"] [dependencies] include_dir = "0.7.4" @@ -17,4 +13,4 @@ temp-dir = "0.1.14" serde = { version = "1.0.205", features = ["derive"], default-features = false } toml = { version = "0.8.19", features = ["parse"], default-features = false } which = "6.0.3" -ego-tree = { workspace = true } +ego-tree = "0.9.0" diff --git a/core/src/lib.rs b/core/src/lib.rs index 891d8e849..aa0693c10 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -2,6 +2,7 @@ mod inner; use std::rc::Rc; +pub use ego_tree; use ego_tree::Tree; use std::path::PathBuf; diff --git a/tui/Cargo.toml b/tui/Cargo.toml index baa0d995e..a486e1e4d 100644 --- a/tui/Cargo.toml +++ b/tui/Cargo.toml @@ -15,7 +15,6 @@ tips = ["rand"] [dependencies] clap = { version = "4.5.20", features = ["derive"] } -ego-tree = { workspace = true } oneshot = "0.1.8" portable-pty = "0.8.1" ratatui = "0.29.0" diff --git a/tui/src/filter.rs b/tui/src/filter.rs index cc93ecee7..f44e89a1a 100644 --- a/tui/src/filter.rs +++ b/tui/src/filter.rs @@ -1,6 +1,5 @@ use crate::{state::ListEntry, theme::Theme}; -use ego_tree::NodeId; -use linutil_core::Tab; +use linutil_core::{ego_tree::NodeId, Tab}; use ratatui::{ crossterm::event::{KeyCode, KeyEvent, KeyModifiers}, layout::{Position, Rect}, diff --git a/tui/src/hint.rs b/tui/src/hint.rs index b5f096ca1..82c265c89 100644 --- a/tui/src/hint.rs +++ b/tui/src/hint.rs @@ -71,8 +71,8 @@ impl Shortcut { } fn to_spans(&self) -> Vec> { - let mut ret: Vec<_> = self - .key_sequences + let description = Span::styled(self.desc, Style::default().italic()); + self.key_sequences .iter() .flat_map(|seq| { [ @@ -81,8 +81,7 @@ impl Shortcut { Span::default().content("] "), ] }) - .collect(); - ret.push(Span::styled(self.desc, Style::default().italic())); - ret + .chain(std::iter::once(description)) + .collect() } } diff --git a/tui/src/state.rs b/tui/src/state.rs index ea598d050..008d110b7 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -7,8 +7,8 @@ use crate::{ running_command::RunningCommand, theme::Theme, }; -use ego_tree::NodeId; -use linutil_core::{ListNode, TabList}; + +use linutil_core::{ego_tree::NodeId, ListNode, TabList}; #[cfg(feature = "tips")] use rand::Rng; use ratatui::{ From e31622480b35088d0ef5471d2880065bbb6b362e Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:31:50 +0530 Subject: [PATCH 04/12] feat: Add Arch virtualization setup script (#813) * Add Arch virtualization setup script * Replace hardcoded pacman * Update core/tabs/system-setup/arch/virtualization.sh Co-authored-by: Adam Perkowski * Update virtualization.sh Co-authored-by: Adam Perkowski * Update core/tabs/system-setup/arch/virtualization.sh Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com> * chore: formatting --------- Co-authored-by: Adam Perkowski Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com> --- core/tabs/system-setup/arch/virtualization.sh | 104 ++++++++++++++++++ core/tabs/system-setup/tab_data.toml | 6 + docs/userguide.md | 1 + 3 files changed, 111 insertions(+) create mode 100755 core/tabs/system-setup/arch/virtualization.sh diff --git a/core/tabs/system-setup/arch/virtualization.sh b/core/tabs/system-setup/arch/virtualization.sh new file mode 100755 index 000000000..e7543abca --- /dev/null +++ b/core/tabs/system-setup/arch/virtualization.sh @@ -0,0 +1,104 @@ +#!/bin/sh -e + +. ../../common-script.sh + +installQEMUDesktop() { + if ! command_exists qemu-img; then + printf "%b\n" "${YELLOW}Installing QEMU.${RC}" + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-desktop + else + printf "%b\n" "${GREEN}QEMU is already installed.${RC}" + fi + checkKVM +} + +installQEMUEmulators() { + if ! "$PACKAGER" -Q | grep -q "qemu-emulators-full "; then + printf "%b\n" "${YELLOW}Installing QEMU-Emulators.${RC}" + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-emulators-full swtpm + else + printf "%b\n" "${GREEN}QEMU-Emulators already installed.${RC}" + fi +} + +installVirtManager() { + if ! command_exists virt-manager; then + printf "%b\n" "${YELLOW}Installing Virt-Manager.${RC}" + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm virt-manager + else + printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}" + fi +} + +checkKVM() { + if [ ! -e "/dev/kvm" ]; then + printf "%b\n" "${RED}KVM is not available. Make sure you have CPU virtualization support enabled in your BIOS/UEFI settings. Please refer https://wiki.archlinux.org/title/KVM for more information.${RC}" + else + "$ESCALATION_TOOL" usermod "$USER" -aG kvm + fi +} + +setupLibvirt() { + printf "%b\n" "${YELLOW}Configuring Libvirt.${RC}" + if "$PACKAGER" -Q | grep -q "iptables "; then + "$ESCALATION_TOOL" "$PACKAGER" -Rdd --noconfirm iptables + fi + + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm dnsmasq iptables-nft + "$ESCALATION_TOOL" sed -i 's/^#\?firewall_backend\s*=\s*".*"/firewall_backend = "iptables"/' "/etc/libvirt/network.conf" + + if systemctl is-active --quiet polkit; then + "$ESCALATION_TOOL" sed -i 's/^#\?auth_unix_ro\s*=\s*".*"/auth_unix_ro = "polkit"/' "/etc/libvirt/libvirtd.conf" + "$ESCALATION_TOOL" sed -i 's/^#\?auth_unix_rw\s*=\s*".*"/auth_unix_rw = "polkit"/' "/etc/libvirt/libvirtd.conf" + fi + + "$ESCALATION_TOOL" usermod "$USER" -aG libvirt + + for value in libvirt libvirt_guest; do + if ! grep -wq "$value" /etc/nsswitch.conf; then + "$ESCALATION_TOOL" sed -i "/^hosts:/ s/$/ ${value}/" /etc/nsswitch.conf + fi + done + + "$ESCALATION_TOOL" systemctl enable --now libvirtd.service + "$ESCALATION_TOOL" virsh net-autostart default + + checkKVM +} + +installLibvirt() { + if ! command_exists libvirtd; then + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libvirt dmidecode + else + printf "%b\n" "${GREEN}Libvirt is already installed.${RC}" + fi + setupLibvirt +} + +main() { + printf "%b\n" "${YELLOW}Choose what to install:${RC}" + printf "%b\n" "1. ${YELLOW}QEMU${RC}" + printf "%b\n" "2. ${YELLOW}QEMU-Emulators ( Extended architectures )${RC}" + printf "%b\n" "3. ${YELLOW}Libvirt${RC}" + printf "%b\n" "4. ${YELLOW}Virtual-Manager${RC}" + printf "%b\n" "5. ${YELLOW}All${RC}" + printf "%b" "Enter your choice [1-5]: " + read -r CHOICE + case "$CHOICE" in + 1) installQEMUDesktop ;; + 2) installQEMUEmulators ;; + 3) installLibvirt ;; + 4) installVirtManager ;; + 5) + installQEMUDesktop + installQEMUEmulators + installLibvirt + installVirtManager + ;; + *) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;; + esac +} + +checkEnv +checkEscalationTool +main diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index abdab9bdb..9f80eec04 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -38,6 +38,12 @@ description = "Paru is your standard pacman wrapping AUR helper with lots of fea script = "arch/paru-setup.sh" task_list = "I" +[[data.entries]] +name = "Virtualization" +description = "QEMU, Libvirt, Virt-Manager installation and configuration." +script = "arch/virtualization.sh" +task_list = "FM I SS RP" + [[data.entries]] name = "Yay AUR Helper" description = "Yet Another Yogurt - An AUR Helper Written in Go. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers" diff --git a/docs/userguide.md b/docs/userguide.md index 24a332c70..f8043d109 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -88,6 +88,7 @@ https://github.com/ChrisTitusTech/dwm-titus - **Linux Neptune for SteamDeck**: Valve's fork of Linux Kernel for the SteamDeck - **Nvidia Drivers && Hardware Acceleration**: This script installs and configures nvidia drivers with Hardware Acceleration. - **Paru AUR Helper**: Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers +- **Virtualization**: QEMU, Libvirt, Virt-Manager installation and configuration. - **Yay AUR Helper**: Yet Another Yogurt - An AUR Helper Written in Go. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers ### Fedora From 1e39d967c5c7706dac39dd5fc8628dfe7283ed24 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:33:21 +0530 Subject: [PATCH 05/12] feat: Alpine linux support (#814) * Add basic apk to scripts * Add common service script * Fix alpine bugs * Add flatpak installations * chore: update scripts, add common-service-script to shellcheckrc --- .shellcheckrc | 3 +- .../Developer-tools/meld-setup.sh | 3 + .../Developer-tools/neovim-setup.sh | 3 + .../Developer-tools/vscode-setup.sh | 6 +- .../Developer-tools/vscodium-setup.sh | 6 +- .../applications-setup/alacritty-setup.sh | 3 + .../applications-setup/android-debloat.sh | 3 + .../tabs/applications-setup/browsers/brave.sh | 6 +- .../applications-setup/browsers/chromium.sh | 3 + .../applications-setup/browsers/firefox.sh | 3 + .../applications-setup/browsers/librewolf.sh | 6 +- core/tabs/applications-setup/browsers/lynx.sh | 3 + .../applications-setup/browsers/thorium.sh | 1 + .../applications-setup/browsers/waterfox.sh | 6 +- .../communication-apps/discord-setup.sh | 6 +- .../communication-apps/jitsi-setup.sh | 6 +- .../communication-apps/signal-setup.sh | 4 + .../communication-apps/telegram-setup.sh | 3 + .../communication-apps/thunderbird-setup.sh | 3 + core/tabs/applications-setup/docker-setup.sh | 14 +-- .../applications-setup/fastfetch-setup.sh | 3 + core/tabs/applications-setup/kitty-setup.sh | 3 + .../applications-setup/linutil-installer.sh | 7 ++ .../applications-setup/linutil-updater.sh | 7 ++ core/tabs/applications-setup/mybash-setup.sh | 3 + .../office-suites/libreoffice.sh | 3 + .../applications-setup/pdf-suites/evince.sh | 3 + .../applications-setup/pdf-suites/okular.sh | 3 + core/tabs/applications-setup/rofi-setup.sh | 3 + core/tabs/applications-setup/zsh-setup.sh | 3 + core/tabs/common-script.sh | 8 +- core/tabs/common-service-script.sh | 85 +++++++++++++++++++ core/tabs/security/firewall-baselines.sh | 3 + core/tabs/system-setup/compile-setup.sh | 3 + core/tabs/system-setup/gaming-setup.sh | 5 +- core/tabs/system-setup/system-cleanup.sh | 8 +- core/tabs/system-setup/system-update.sh | 6 ++ core/tabs/utils/bluetooth-control.sh | 14 ++- core/tabs/utils/create-bootable-usb.sh | 3 + core/tabs/utils/encrypt_decrypt_tool.sh | 3 + core/tabs/utils/numlock.sh | 50 ++++++----- core/tabs/utils/ollama.sh | 2 +- core/tabs/utils/power-profile.sh | 3 + core/tabs/utils/samba-ssh-setup.sh | 24 +++--- core/tabs/utils/timeshift.sh | 5 +- core/tabs/utils/utility_functions.sh | 3 + core/tabs/utils/wifi-control.sh | 14 +-- 47 files changed, 300 insertions(+), 68 deletions(-) create mode 100644 core/tabs/common-service-script.sh diff --git a/.shellcheckrc b/.shellcheckrc index 0b8820662..6bf273ee1 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -1,2 +1,3 @@ external-sources=true -source=core/tabs/common-script.sh \ No newline at end of file +source=core/tabs/common-script.sh +source=core/tabs/common-service-script.sh \ No newline at end of file diff --git a/core/tabs/applications-setup/Developer-tools/meld-setup.sh b/core/tabs/applications-setup/Developer-tools/meld-setup.sh index 031a09aef..36c1cfe4d 100644 --- a/core/tabs/applications-setup/Developer-tools/meld-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/meld-setup.sh @@ -12,6 +12,9 @@ installMeld() { apt-get|nala) "$ESCALATION_TOOL" "$PACKAGER" -y install meld ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add meld + ;; *) checkFlatpak flatpak install -y flathub org.gnome.meld diff --git a/core/tabs/applications-setup/Developer-tools/neovim-setup.sh b/core/tabs/applications-setup/Developer-tools/neovim-setup.sh index ac0d26377..7b3a980cb 100755 --- a/core/tabs/applications-setup/Developer-tools/neovim-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/neovim-setup.sh @@ -29,6 +29,9 @@ installNeovim() { dnf|zypper) "$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add neovim ripgrep fzf py3-virtualenv luarocks go shellcheck git + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/Developer-tools/vscode-setup.sh b/core/tabs/applications-setup/Developer-tools/vscode-setup.sh index 018616a65..3a9c7f0e7 100644 --- a/core/tabs/applications-setup/Developer-tools/vscode-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/vscode-setup.sh @@ -3,7 +3,7 @@ . ../../common-script.sh installVsCode() { - if ! command_exists code; then + if ! command_exists com.visualstudio.code && ! command_exists code; then printf "%b\n" "${YELLOW}Installing VS Code..${RC}." case "$PACKAGER" in apt-get|nala) @@ -28,6 +28,10 @@ installVsCode() { printf "%b\n" '[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc' | "$ESCALATION_TOOL" tee /etc/yum.repos.d/vscode.repo > /dev/null "$ESCALATION_TOOL" "$PACKAGER" install -y code ;; + apk) + checkFlatpak + flatpak install -y flathub com.visualstudio.code + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/Developer-tools/vscodium-setup.sh b/core/tabs/applications-setup/Developer-tools/vscodium-setup.sh index 5b5615caf..d6c97212d 100644 --- a/core/tabs/applications-setup/Developer-tools/vscodium-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/vscodium-setup.sh @@ -3,7 +3,7 @@ . ../../common-script.sh installVsCodium() { - if ! command_exists codium; then + if ! command_exists com.vscodium.codium && ! command_exists codium; then printf "%b\n" "${YELLOW}Installing VS Codium...${RC}" case "$PACKAGER" in apt-get|nala) @@ -26,6 +26,10 @@ installVsCodium() { printf "%b\n" "[gitlab.com_paulcarroty_vscodium_repo]\nname=download.vscodium.com\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | "$ESCALATION_TOOL" tee -a /etc/yum.repos.d/vscodium.repo "$ESCALATION_TOOL" "$PACKAGER" install -y codium ;; + apk) + checkFlatpak + flatpak install -y flathub com.vscodium.codium + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/alacritty-setup.sh b/core/tabs/applications-setup/alacritty-setup.sh index 25558fed0..8149ebae6 100755 --- a/core/tabs/applications-setup/alacritty-setup.sh +++ b/core/tabs/applications-setup/alacritty-setup.sh @@ -9,6 +9,9 @@ installAlacritty() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add alacritty + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y alacritty ;; diff --git a/core/tabs/applications-setup/android-debloat.sh b/core/tabs/applications-setup/android-debloat.sh index b4e1073a1..632580239 100644 --- a/core/tabs/applications-setup/android-debloat.sh +++ b/core/tabs/applications-setup/android-debloat.sh @@ -15,6 +15,9 @@ install_adb() { dnf|zypper) "$ESCALATION_TOOL" "$PACKAGER" install -y android-tools ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add android-tools + ;; *) printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 diff --git a/core/tabs/applications-setup/browsers/brave.sh b/core/tabs/applications-setup/browsers/brave.sh index 8a7eab403..6618f0fec 100644 --- a/core/tabs/applications-setup/browsers/brave.sh +++ b/core/tabs/applications-setup/browsers/brave.sh @@ -3,7 +3,7 @@ . ../../common-script.sh installBrave() { - if ! command_exists brave; then + if ! command_exists com.brave.Browser && ! command_exists brave; then printf "%b\n" "${YELLOW}Installing Brave...${RC}" case "$PACKAGER" in apt-get|nala) @@ -29,6 +29,10 @@ installBrave() { "$ESCALATION_TOOL" rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc "$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser ;; + apk) + checkFlatpak + flatpak install -y flathub com.brave.Browser + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/browsers/chromium.sh b/core/tabs/applications-setup/browsers/chromium.sh index e929dbc9d..f9f14e74e 100644 --- a/core/tabs/applications-setup/browsers/chromium.sh +++ b/core/tabs/applications-setup/browsers/chromium.sh @@ -9,6 +9,9 @@ if ! command_exists chromium; then pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm chromium ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add chromium + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y chromium ;; diff --git a/core/tabs/applications-setup/browsers/firefox.sh b/core/tabs/applications-setup/browsers/firefox.sh index 67980858b..cd36b6c44 100644 --- a/core/tabs/applications-setup/browsers/firefox.sh +++ b/core/tabs/applications-setup/browsers/firefox.sh @@ -18,6 +18,9 @@ installFirefox() { dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y firefox ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add firefox + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/browsers/librewolf.sh b/core/tabs/applications-setup/browsers/librewolf.sh index a630b9c7c..d8ed06b41 100644 --- a/core/tabs/applications-setup/browsers/librewolf.sh +++ b/core/tabs/applications-setup/browsers/librewolf.sh @@ -3,7 +3,7 @@ . ../../common-script.sh installLibreWolf() { - if ! command_exists librewolf; then + if ! command_exists io.gitlab.librewolf-community && ! command_exists librewolf; then printf "%b\n" "${YELLOW}Installing Librewolf...${RC}" case "$PACKAGER" in apt-get|nala) @@ -32,6 +32,10 @@ Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/ pacman) "$AUR_HELPER" -S --needed --noconfirm librewolf-bin ;; + apk) + checkFlatpak + flatpak install flathub io.gitlab.librewolf-community + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/browsers/lynx.sh b/core/tabs/applications-setup/browsers/lynx.sh index 002ff7e3e..f92836913 100644 --- a/core/tabs/applications-setup/browsers/lynx.sh +++ b/core/tabs/applications-setup/browsers/lynx.sh @@ -9,6 +9,9 @@ installLynx() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm lynx ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add lynx + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y lynx ;; diff --git a/core/tabs/applications-setup/browsers/thorium.sh b/core/tabs/applications-setup/browsers/thorium.sh index c45ebc806..dd0b20ef3 100644 --- a/core/tabs/applications-setup/browsers/thorium.sh +++ b/core/tabs/applications-setup/browsers/thorium.sh @@ -22,6 +22,7 @@ installThrorium() { ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + exit 1 ;; esac else diff --git a/core/tabs/applications-setup/browsers/waterfox.sh b/core/tabs/applications-setup/browsers/waterfox.sh index 3cef5106f..28ec96dcc 100644 --- a/core/tabs/applications-setup/browsers/waterfox.sh +++ b/core/tabs/applications-setup/browsers/waterfox.sh @@ -3,14 +3,14 @@ . ../../common-script.sh installWaterfox() { - if ! command_exists waterfox; then + if ! command_exists net.waterfox.waterfox && ! command_exists waterfox; then printf "%b\n" "${YELLOW}Installing waterfox...${RC}" case "$PACKAGER" in pacman) - "$AUR_HELPER" -S --needed --noconfirm waterfox-bin + "$AUR_HELPER" -S --needed --noconfirm waterfox-bin ;; *) - . ../setup-flatpak.sh + checkFlatpak flatpak install -y flathub net.waterfox.waterfox ;; esac diff --git a/core/tabs/applications-setup/communication-apps/discord-setup.sh b/core/tabs/applications-setup/communication-apps/discord-setup.sh index 6c7a0a83b..f96bd9f2e 100644 --- a/core/tabs/applications-setup/communication-apps/discord-setup.sh +++ b/core/tabs/applications-setup/communication-apps/discord-setup.sh @@ -3,7 +3,7 @@ . ../../common-script.sh installDiscord() { - if ! command_exists discord; then + if ! command_exists com.discordapp.Discord && ! command_exists discord; then printf "%b\n" "${YELLOW}Installing Discord...${RC}" case "$PACKAGER" in apt-get|nala) @@ -20,6 +20,10 @@ installDiscord() { "$ESCALATION_TOOL" "$PACKAGER" install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm "$ESCALATION_TOOL" "$PACKAGER" install -y discord ;; + apk) + checkFlatpak + flatpak install -y flathub com.discordapp.Discord + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/communication-apps/jitsi-setup.sh b/core/tabs/applications-setup/communication-apps/jitsi-setup.sh index 2b6b4bbe0..f6f2f2001 100644 --- a/core/tabs/applications-setup/communication-apps/jitsi-setup.sh +++ b/core/tabs/applications-setup/communication-apps/jitsi-setup.sh @@ -3,7 +3,7 @@ . ../../common-script.sh installJitsi() { - if ! command_exists jitsi-meet; then + if ! command_exists org.jitsi.jitsi-meet && ! command_exists jitsi-meet; then printf "%b\n" "${YELLOW}Installing Jitsi meet...${RC}" case "$PACKAGER" in apt-get|nala) @@ -21,6 +21,10 @@ installJitsi() { dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y jitsi-meet ;; + apk) + checkFlatpak + flatpak install flathub org.jitsi.jitsi-meet + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/communication-apps/signal-setup.sh b/core/tabs/applications-setup/communication-apps/signal-setup.sh index cdd71b55c..18c462b1c 100644 --- a/core/tabs/applications-setup/communication-apps/signal-setup.sh +++ b/core/tabs/applications-setup/communication-apps/signal-setup.sh @@ -23,6 +23,10 @@ installSignal() { checkFlatpak flatpak install -y flathub org.signal.Signal ;; + apk) + checkFlatpak + flatpak install -y flathub org.signal.Signal + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/communication-apps/telegram-setup.sh b/core/tabs/applications-setup/communication-apps/telegram-setup.sh index a21b53e40..54916f60b 100644 --- a/core/tabs/applications-setup/communication-apps/telegram-setup.sh +++ b/core/tabs/applications-setup/communication-apps/telegram-setup.sh @@ -9,6 +9,9 @@ installTelegram() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm telegram-desktop ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add telegram-desktop + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y telegram-desktop ;; diff --git a/core/tabs/applications-setup/communication-apps/thunderbird-setup.sh b/core/tabs/applications-setup/communication-apps/thunderbird-setup.sh index f49dcb78b..f7e80e5ac 100644 --- a/core/tabs/applications-setup/communication-apps/thunderbird-setup.sh +++ b/core/tabs/applications-setup/communication-apps/thunderbird-setup.sh @@ -9,6 +9,9 @@ installThunderBird() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm thunderbird ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add thunderbird + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y thunderbird ;; diff --git a/core/tabs/applications-setup/docker-setup.sh b/core/tabs/applications-setup/docker-setup.sh index 4844d10e5..c4fc53ffc 100755 --- a/core/tabs/applications-setup/docker-setup.sh +++ b/core/tabs/applications-setup/docker-setup.sh @@ -1,10 +1,10 @@ #!/bin/sh -e . ../common-script.sh +. ../common-service-script.sh # Function to prompt the user for installation choice choose_installation() { - clear printf "%b\n" "${YELLOW}Choose what to install:${RC}" printf "%b\n" "1. ${YELLOW}Docker${RC}" printf "%b\n" "2. ${YELLOW}Docker Compose${RC}" @@ -34,19 +34,20 @@ install_docker() { ;; zypper) "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install docker - "$ESCALATION_TOOL" systemctl enable docker - "$ESCALATION_TOOL" systemctl start docker ;; pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm docker - "$ESCALATION_TOOL" systemctl enable docker - "$ESCALATION_TOOL" systemctl start docker + ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add docker ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 ;; esac + + startAndEnableService docker } install_docker_compose() { @@ -66,6 +67,9 @@ install_docker_compose() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm docker-compose ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add docker-cli-compose + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/fastfetch-setup.sh b/core/tabs/applications-setup/fastfetch-setup.sh index cb523441f..5374805ea 100644 --- a/core/tabs/applications-setup/fastfetch-setup.sh +++ b/core/tabs/applications-setup/fastfetch-setup.sh @@ -14,6 +14,9 @@ installFastfetch() { "$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb rm /tmp/fastfetch.deb ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add fastfetch + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch ;; diff --git a/core/tabs/applications-setup/kitty-setup.sh b/core/tabs/applications-setup/kitty-setup.sh index 85ef129b6..c919969d6 100755 --- a/core/tabs/applications-setup/kitty-setup.sh +++ b/core/tabs/applications-setup/kitty-setup.sh @@ -9,6 +9,9 @@ installKitty() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm kitty ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add kitty + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y kitty ;; diff --git a/core/tabs/applications-setup/linutil-installer.sh b/core/tabs/applications-setup/linutil-installer.sh index fd925e0b7..7b02af7c8 100755 --- a/core/tabs/applications-setup/linutil-installer.sh +++ b/core/tabs/applications-setup/linutil-installer.sh @@ -45,6 +45,13 @@ installLinutil() { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y . $HOME/.cargo/env ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add build-base + "$ESCALATION_TOOL" "$PACKAGER" add rustup + rustup-init + # shellcheck disable=SC1091 + . "$HOME/.cargo/env" + ;; *) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y . $HOME/.cargo/env diff --git a/core/tabs/applications-setup/linutil-updater.sh b/core/tabs/applications-setup/linutil-updater.sh index 8cf1762d3..4e399a024 100755 --- a/core/tabs/applications-setup/linutil-updater.sh +++ b/core/tabs/applications-setup/linutil-updater.sh @@ -19,6 +19,13 @@ updateLinutil() { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh . $HOME/.cargo/env ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add build-base + "$ESCALATION_TOOL" "$PACKAGER" add rustup + rustup-init + # shellcheck disable=SC1091 + . "$HOME/.cargo/env" + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y rustup ;; diff --git a/core/tabs/applications-setup/mybash-setup.sh b/core/tabs/applications-setup/mybash-setup.sh index c09df01e0..8cd98970f 100644 --- a/core/tabs/applications-setup/mybash-setup.sh +++ b/core/tabs/applications-setup/mybash-setup.sh @@ -11,6 +11,9 @@ installDepend() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add bash bash-completion tar bat tree unzip fontconfig git + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git ;; diff --git a/core/tabs/applications-setup/office-suites/libreoffice.sh b/core/tabs/applications-setup/office-suites/libreoffice.sh index f389abd8d..a55bd183e 100644 --- a/core/tabs/applications-setup/office-suites/libreoffice.sh +++ b/core/tabs/applications-setup/office-suites/libreoffice.sh @@ -16,6 +16,9 @@ installLibreOffice() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add libreoffice + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/applications-setup/pdf-suites/evince.sh b/core/tabs/applications-setup/pdf-suites/evince.sh index 9118d36d1..7740b5084 100644 --- a/core/tabs/applications-setup/pdf-suites/evince.sh +++ b/core/tabs/applications-setup/pdf-suites/evince.sh @@ -9,6 +9,9 @@ installEvince() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm evince ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add evince + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y evince ;; diff --git a/core/tabs/applications-setup/pdf-suites/okular.sh b/core/tabs/applications-setup/pdf-suites/okular.sh index 785d512cf..ab618f081 100644 --- a/core/tabs/applications-setup/pdf-suites/okular.sh +++ b/core/tabs/applications-setup/pdf-suites/okular.sh @@ -9,6 +9,9 @@ installOkular() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm okular ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add okular + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y okular ;; diff --git a/core/tabs/applications-setup/rofi-setup.sh b/core/tabs/applications-setup/rofi-setup.sh index 24ce1a67d..b4e2609a3 100755 --- a/core/tabs/applications-setup/rofi-setup.sh +++ b/core/tabs/applications-setup/rofi-setup.sh @@ -9,6 +9,9 @@ installRofi() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rofi ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add rofi + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y rofi ;; diff --git a/core/tabs/applications-setup/zsh-setup.sh b/core/tabs/applications-setup/zsh-setup.sh index a85b92404..65f090ec2 100644 --- a/core/tabs/applications-setup/zsh-setup.sh +++ b/core/tabs/applications-setup/zsh-setup.sh @@ -10,6 +10,9 @@ installZsh() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm zsh ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add zsh + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y zsh ;; diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh index d431c4889..f8188ac32 100644 --- a/core/tabs/common-script.sh +++ b/core/tabs/common-script.sh @@ -123,6 +123,12 @@ checkPackageManager() { fi done + ## Enable apk community packages + if [ "$PACKAGER" = "apk" ] && grep -qE '^#.*community' /etc/apk/repositories; then + "$ESCALATION_TOOL" sed -i '/community/s/^#//' /etc/apk/repositories + "$ESCALATION_TOOL" "$PACKAGER" update + fi + if [ -z "$PACKAGER" ]; then printf "%b\n" "${RED}Can't find a supported package manager${RC}" exit 1 @@ -169,7 +175,7 @@ checkEnv() { checkArch checkEscalationTool checkCommandRequirements "curl groups $ESCALATION_TOOL" - checkPackageManager 'nala apt-get dnf pacman zypper' + checkPackageManager 'nala apt-get dnf pacman zypper apk' checkCurrentDirectoryWritable checkSuperUser checkDistro diff --git a/core/tabs/common-service-script.sh b/core/tabs/common-service-script.sh new file mode 100644 index 000000000..c3a2053d0 --- /dev/null +++ b/core/tabs/common-service-script.sh @@ -0,0 +1,85 @@ +#!/bin/sh -e + +checkInitManager() { + for manager in $1; do + if command_exists "$manager"; then + INIT_MANAGER="$manager" + printf "%b\n" "${CYAN}Using ${manager} to interact with init system${RC}" + break + fi + done + + if [ -z "$INIT_MANAGER" ]; then + printf "%b\n" "${RED}Can't find a supported init system${RC}" + exit 1 + fi +} + +startService() { + case "$INIT_MANAGER" in + systemctl) + "$ESCALATION_TOOL" "$INIT_MANAGER" start "$1" + ;; + rc-service) + "$ESCALATION_TOOL" "$INIT_MANAGER" "$1" start + ;; + esac +} + +stopService() { + case "$INIT_MANAGER" in + systemctl) + "$ESCALATION_TOOL" "$INIT_MANAGER" stop "$1" + ;; + rc-service) + "$ESCALATION_TOOL" "$INIT_MANAGER" "$1" stop + ;; + esac +} + +enableService() { + case "$INIT_MANAGER" in + systemctl) + "$ESCALATION_TOOL" "$INIT_MANAGER" enable "$1" + ;; + rc-service) + "$ESCALATION_TOOL" rc-update add "$1" + ;; + esac +} + +disableService() { + case "$INIT_MANAGER" in + systemctl) + "$ESCALATION_TOOL" "$INIT_MANAGER" disable "$1" + ;; + rc-service) + "$ESCALATION_TOOL" rc-update del "$1" + ;; + esac +} + +startAndEnableService() { + case "$INIT_MANAGER" in + systemctl) + "$ESCALATION_TOOL" "$INIT_MANAGER" enable --now "$1" + ;; + rc-service) + enableService "$1" + startService "$1" + ;; + esac +} + +isServiceActive() { + case "$INIT_MANAGER" in + systemctl) + "$ESCALATION_TOOL" "$INIT_MANAGER" is-active --quiet "$1" + ;; + rc-service) + "$ESCALATION_TOOL" "$INIT_MANAGER" "$1" status --quiet + ;; + esac +} + +checkInitManager 'systemctl rc-service' \ No newline at end of file diff --git a/core/tabs/security/firewall-baselines.sh b/core/tabs/security/firewall-baselines.sh index 9c0810f4f..54145ea75 100644 --- a/core/tabs/security/firewall-baselines.sh +++ b/core/tabs/security/firewall-baselines.sh @@ -9,6 +9,9 @@ installPkg() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm ufw ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add ufw + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y ufw ;; diff --git a/core/tabs/system-setup/compile-setup.sh b/core/tabs/system-setup/compile-setup.sh index 74a96a417..bb6bb44a9 100755 --- a/core/tabs/system-setup/compile-setup.sh +++ b/core/tabs/system-setup/compile-setup.sh @@ -37,6 +37,9 @@ installDepend() { "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install $DEPENDENCIES $COMPILEDEPS "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add build-base multitail tar tree trash-cli unzip cmake jq + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES ;; diff --git a/core/tabs/system-setup/gaming-setup.sh b/core/tabs/system-setup/gaming-setup.sh index 076739525..86bc9f5d6 100755 --- a/core/tabs/system-setup/gaming-setup.sh +++ b/core/tabs/system-setup/gaming-setup.sh @@ -50,7 +50,8 @@ installDepend() { "$ESCALATION_TOOL" "$PACKAGER" -n install $DEPENDENCIES ;; *) - "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES + printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}" + exit 1 ;; esac } @@ -95,6 +96,8 @@ installAdditionalDepend() { "$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS ;; *) + printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}" + exit 1 ;; esac } diff --git a/core/tabs/system-setup/system-cleanup.sh b/core/tabs/system-setup/system-cleanup.sh index 57b827b95..573751a04 100755 --- a/core/tabs/system-setup/system-cleanup.sh +++ b/core/tabs/system-setup/system-cleanup.sh @@ -1,6 +1,7 @@ #!/bin/sh -e . ../common-script.sh +. ../common-service-script.sh cleanup_system() { printf "%b\n" "${YELLOW}Performing system cleanup...${RC}" @@ -23,6 +24,9 @@ cleanup_system() { "$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm "$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1 ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" cache clean + ;; *) printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}" ;; @@ -39,7 +43,9 @@ common_cleanup() { if [ -d /var/log ]; then "$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \; fi - "$ESCALATION_TOOL" journalctl --vacuum-time=3d + if [ "$INIT_MANAGER" = "systemctl" ]; then + "$ESCALATION_TOOL" journalctl --vacuum-time=3d + fi } clean_data() { diff --git a/core/tabs/system-setup/system-update.sh b/core/tabs/system-setup/system-update.sh index c213156ac..53f3a1df5 100755 --- a/core/tabs/system-setup/system-update.sh +++ b/core/tabs/system-setup/system-update.sh @@ -48,6 +48,9 @@ fastUpdate() { "$ESCALATION_TOOL" "$PACKAGER" ref "$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" update + ;; *) printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 @@ -74,6 +77,9 @@ updateSystem() { "$ESCALATION_TOOL" "$PACKAGER" ref "$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" upgrade + ;; *) printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 diff --git a/core/tabs/utils/bluetooth-control.sh b/core/tabs/utils/bluetooth-control.sh index da7ee23d3..6bfe266ba 100644 --- a/core/tabs/utils/bluetooth-control.sh +++ b/core/tabs/utils/bluetooth-control.sh @@ -1,6 +1,7 @@ #!/bin/sh -e . ../common-script.sh +. ../common-service-script.sh # Function to check Bluez is installed setupBluetooth() { @@ -10,6 +11,9 @@ setupBluetooth() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm bluez-utils ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add bluez + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y bluez ;; @@ -18,15 +22,7 @@ setupBluetooth() { printf "%b\n" "${GREEN}Bluez is already installed.${RC}" fi - # Check if bluetooth service is running - if ! systemctl is-active --quiet bluetooth; then - printf "%b\n" "${YELLOW}Bluetooth service is not running. Starting it now...${RC}" - "$ESCALATION_TOOL" systemctl start bluetooth - - if systemctl is-active --quiet bluetooth; then - printf "%b\n" "${GREEN}Bluetooth service started successfully.${RC}" - fi - fi + startService bluetooth } # Function to display the main menu diff --git a/core/tabs/utils/create-bootable-usb.sh b/core/tabs/utils/create-bootable-usb.sh index f05830d34..09b24d4d2 100644 --- a/core/tabs/utils/create-bootable-usb.sh +++ b/core/tabs/utils/create-bootable-usb.sh @@ -12,6 +12,7 @@ list_devices() { printf "\n" } +# shellcheck disable=SC2086 installDependencies() { DEPENDENCIES="xz gzip bzip2 jq" if ! command_exists ${DEPENDENCIES}; then @@ -23,6 +24,8 @@ installDependencies() { "${ESCALATION_TOOL}" "${PACKAGER}" install -y ${DEPENDENCIES};; pacman) "${ESCALATION_TOOL}" "${PACKAGER}" -S --noconfirm --needed ${DEPENDENCIES};; + apk) + "${ESCALATION_TOOL}" "${PACKAGER}" add ${DEPENDENCIES};; *) printf "%b\n" "${RED}Unsupported package manager.${RC}" exit 1 diff --git a/core/tabs/utils/encrypt_decrypt_tool.sh b/core/tabs/utils/encrypt_decrypt_tool.sh index 46fead9d3..40e006a25 100644 --- a/core/tabs/utils/encrypt_decrypt_tool.sh +++ b/core/tabs/utils/encrypt_decrypt_tool.sh @@ -19,6 +19,9 @@ if ! command_exists openssl; then zypper) "$ESCALATION_TOOL" "$PACKAGER" install openssl ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add openssl + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" exit 1 diff --git a/core/tabs/utils/numlock.sh b/core/tabs/utils/numlock.sh index f80ba3fba..a358b614e 100755 --- a/core/tabs/utils/numlock.sh +++ b/core/tabs/utils/numlock.sh @@ -1,10 +1,11 @@ #!/bin/sh -e . ../common-script.sh +. ../common-service-script.sh create_file() { - printf "%b\n" "Creating script..." - "$ESCALATION_TOOL" tee "/usr/local/bin/numlock" >/dev/null <<'EOF' + printf "%b\n" "Creating script..." + "$ESCALATION_TOOL" tee "/usr/local/bin/numlock" >/dev/null <<'EOF' #!/bin/bash for tty in /dev/tty{1..6} @@ -13,12 +14,12 @@ do done EOF - "$ESCALATION_TOOL" chmod +x /usr/local/bin/numlock + "$ESCALATION_TOOL" chmod +x /usr/local/bin/numlock } create_service() { - printf "%b\n" "Creating service..." - "$ESCALATION_TOOL" tee "/etc/systemd/system/numlock.service" >/dev/null <<'EOF' + printf "%b\n" "Creating service..." + "$ESCALATION_TOOL" tee "/etc/systemd/system/numlock.service" >/dev/null <<'EOF' [Unit] Description=numlock @@ -33,23 +34,28 @@ EOF } numlockSetup() { - if [ ! -f "/usr/local/bin/numlock" ]; then - create_file - fi - - if [ ! -f "/etc/systemd/system/numlock.service" ]; then - create_service - fi - - printf "%b" "Do you want to enable Numlock on boot? (y/N): " - read -r confirm - if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then - "$ESCALATION_TOOL" systemctl enable numlock.service --quiet - printf "%b\n" "Numlock will be enabled on boot" - else - "$ESCALATION_TOOL" systemctl disable numlock.service --quiet - printf "%b\n" "Numlock will not be enabled on boot" - fi + if [ "$INIT_MANAGER" = "rc-service" ]; then + printf "%b\n" "${RED}Unsupported init system.${RC}" + exit 1 + fi + + if [ ! -f "/usr/local/bin/numlock" ]; then + create_file + fi + + if [ ! -f "/etc/systemd/system/numlock.service" ]; then + create_service + fi + + printf "%b" "Do you want to enable Numlock on boot? (y/N): " + read -r confirm + if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then + enableService numlock + printf "%b\n" "Numlock will be enabled on boot" + else + disableService numlock + printf "%b\n" "Numlock will not be enabled on boot" + fi } checkEnv diff --git a/core/tabs/utils/ollama.sh b/core/tabs/utils/ollama.sh index 35453ba35..6c18374a4 100644 --- a/core/tabs/utils/ollama.sh +++ b/core/tabs/utils/ollama.sh @@ -11,7 +11,7 @@ installollama() { else printf "%b\n" "${YELLOW}Installing ollama...${RC}" curl -fsSL https://ollama.com/install.sh | sh - "$ESCALATION_TOOL" systemctl start ollama + startService ollama fi } diff --git a/core/tabs/utils/power-profile.sh b/core/tabs/utils/power-profile.sh index 536f7c692..1efdadcb5 100644 --- a/core/tabs/utils/power-profile.sh +++ b/core/tabs/utils/power-profile.sh @@ -19,6 +19,9 @@ installAutoCpufreq() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm git ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add git + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y git ;; diff --git a/core/tabs/utils/samba-ssh-setup.sh b/core/tabs/utils/samba-ssh-setup.sh index 52004a272..aa0dc30ea 100755 --- a/core/tabs/utils/samba-ssh-setup.sh +++ b/core/tabs/utils/samba-ssh-setup.sh @@ -11,6 +11,9 @@ install_package() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$PACKAGE" ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add "$PACKAGE" + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y "$PACKAGE" ;; @@ -34,23 +37,23 @@ setup_ssh() { install_package openssh SSH_SERVICE="sshd" ;; + apk) + install_package openssh + SSH_SERVICE="sshd" + ;; *) install_package openssh-server SSH_SERVICE="sshd" ;; esac - # Enable and start the appropriate SSH service - "$ESCALATION_TOOL" systemctl enable "$SSH_SERVICE" - "$ESCALATION_TOOL" systemctl start "$SSH_SERVICE" + startAndEnableService "$SSH_SERVICE" - # Get the local IP address LOCAL_IP=$(ip -4 addr show | awk '/inet / {print $2}' | tail -n 1) printf "%b\n" "${GREEN}Your local IP address is: $LOCAL_IP${RC}" - # Check if SSH is running - if systemctl is-active --quiet "$SSH_SERVICE"; then + if isServiceActive "$SSH_SERVICE"; then printf "%b\n" "${GREEN}SSH is up and running.${RC}" else printf "%b\n" "${RED}Failed to start SSH.${RC}" @@ -130,12 +133,11 @@ setup_samba() { EOL fi - # Enable and start Samba services - "$ESCALATION_TOOL" systemctl enable smb nmb - "$ESCALATION_TOOL" systemctl start smb nmb + for service in smb nmb; do + startAndEnableService "$service" + done - # Check if Samba is running - if systemctl is-active --quiet smb && systemctl is-active --quiet nmb; then + if isServiceActive smb && isServiceActive nmb; then printf "%b\n" "${GREEN}Samba is up and running.${RC}" printf "%b\n" "${YELLOW}Samba share available at: $SHARED_DIR${RC}" else diff --git a/core/tabs/utils/timeshift.sh b/core/tabs/utils/timeshift.sh index afe2c71dd..b38483e5c 100644 --- a/core/tabs/utils/timeshift.sh +++ b/core/tabs/utils/timeshift.sh @@ -12,9 +12,12 @@ install_timeshift() { pacman) "$ESCALATION_TOOL" "${PACKAGER}" -S --noconfirm timeshift ;; - *) + dnf|zypper|apt-get|nala) "$ESCALATION_TOOL" "${PACKAGER}" install -y timeshift ;; + *) + printf "%b\n" "${RED}Unsupported package manager.${RC}" + ;; esac else printf "%b\n" "${GREEN}Timeshift is already installed.${RC}" diff --git a/core/tabs/utils/utility_functions.sh b/core/tabs/utils/utility_functions.sh index b9ed31274..09f33c60a 100755 --- a/core/tabs/utils/utility_functions.sh +++ b/core/tabs/utils/utility_functions.sh @@ -13,6 +13,9 @@ setup_xrandr() { apt-get|nala) "$ESCALATION_TOOL" "$PACKAGER" install -y x11-xserver-utils ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add xrandr + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-server-utils ;; diff --git a/core/tabs/utils/wifi-control.sh b/core/tabs/utils/wifi-control.sh index 14faec0a6..d4ed2d10b 100755 --- a/core/tabs/utils/wifi-control.sh +++ b/core/tabs/utils/wifi-control.sh @@ -1,6 +1,7 @@ #!/bin/sh -e . ../common-script.sh +. ../common-service-script.sh # Function to check if NetworkManager is installed setupNetworkManager() { @@ -13,6 +14,9 @@ setupNetworkManager() { dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y NetworkManager-1 ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add networkmanager-wifi iwd + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y network-manager ;; @@ -22,13 +26,11 @@ setupNetworkManager() { fi # Check if NetworkManager service is running - if ! systemctl is-active --quiet NetworkManager; then + if ! isServiceActive NetworkManager; then printf "%b\n" "${YELLOW}NetworkManager service is not running. Starting it now...${RC}" - "$ESCALATION_TOOL" systemctl start NetworkManager - - if systemctl is-active --quiet NetworkManager; then - printf "%b\n" "${GREEN}NetworkManager service started successfully.${RC}" - fi + startService NetworkManager + else + printf "%b\n" "${GREEN}NetworkManager service started successfully.${RC}" fi } From 9dbb787ac596aa642100f3932912f5bd4524898f Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:34:53 +0530 Subject: [PATCH 06/12] Update ollama.sh (#815) Co-authored-by: Chris Titus --- core/tabs/utils/ollama.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/utils/ollama.sh b/core/tabs/utils/ollama.sh index 6c18374a4..5552c4f93 100644 --- a/core/tabs/utils/ollama.sh +++ b/core/tabs/utils/ollama.sh @@ -10,8 +10,8 @@ installollama() { printf "%b\n" "${GREEN}ollama is already installed.${RC}" else printf "%b\n" "${YELLOW}Installing ollama...${RC}" - curl -fsSL https://ollama.com/install.sh | sh - startService ollama + curl -fsSL https://ollama.com/install.sh | "$ESCALATION_TOOL" sh + "$ESCALATION_TOOL" startService ollama fi } From 159d2cb00fa2a15d8f4c08657ad78707022b7008 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:35:23 +0530 Subject: [PATCH 07/12] Update mybash-setup.sh (#819) --- core/tabs/applications-setup/mybash-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/mybash-setup.sh b/core/tabs/applications-setup/mybash-setup.sh index 8cd98970f..6d28b0a35 100644 --- a/core/tabs/applications-setup/mybash-setup.sh +++ b/core/tabs/applications-setup/mybash-setup.sh @@ -57,7 +57,7 @@ installStarshipAndFzf() { return fi - if ! curl -sSL https://starship.rs/install.sh | sh; then + if ! curl -sSL https://starship.rs/install.sh | "$ESCALATION_TOOL" sh; then printf "%b\n" "${RED}Something went wrong during starship install!${RC}" exit 1 fi From cb6e0f9cb65e5fc16434d5130081932c5d253e18 Mon Sep 17 00:00:00 2001 From: solomoncyj Date: Fri, 8 Nov 2024 03:07:28 +0800 Subject: [PATCH 08/12] Add OpenSUSE to list of linutil added to package managers (#820) * Add OpenSUSE to list of linutil added to package managers * Update README.md * set up install script * Update linutil-installer.sh * Update linutil-installer.sh * fixes * Update linutil-installer.sh * Update linutil-installer.sh * Update linutil-installer.sh * Update linutil-installer.sh * Update README.md * Update linutil-installer.sh * Update README.md * Update linutil-installer.sh * Apply suggestions from code review Co-authored-by: Adam Perkowski * Update core/tabs/applications-setup/linutil-installer.sh Co-authored-by: JEEVITHA KANNAN K S * Update linutil-installer.sh * Update linutil-installer.sh * Update README.md --------- Co-authored-by: Adam Perkowski Co-authored-by: JEEVITHA KANNAN K S Co-authored-by: Chris Titus --- README.md | 8 ++++++++ core/tabs/applications-setup/linutil-installer.sh | 9 ++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f8aa0ea35..33bb3bdb8 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,15 @@ paru -S linutil Replace `paru` with your preferred helper and `linutil` with your preferred package. +
+ OpenSUSE + +Linutil can be installed on OpenSUSE with: +```bash +sudo zypper install linutil +``` +
Cargo diff --git a/core/tabs/applications-setup/linutil-installer.sh b/core/tabs/applications-setup/linutil-installer.sh index 7b02af7c8..13776fc3c 100755 --- a/core/tabs/applications-setup/linutil-installer.sh +++ b/core/tabs/applications-setup/linutil-installer.sh @@ -25,6 +25,10 @@ installLinutil() { esac printf "%b\n" "${GREEN}Installed successfully.${RC}" ;; + zypper) + "$ESCALATION_TOOL" "$PACKAGER" install linutil -y + printf "%b\n" "${GREEN}Installed successfully.${RC}" + ;; *) printf "%b\n" "${RED}There are no official packages for your distro.${RC}" printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N): ${RC}" @@ -40,11 +44,6 @@ installLinutil() { dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man ;; - zypper) - "$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - . $HOME/.cargo/env - ;; apk) "$ESCALATION_TOOL" "$PACKAGER" add build-base "$ESCALATION_TOOL" "$PACKAGER" add rustup From 629b1290beb185ebfc3d0bbc4797b8bf1e20ef53 Mon Sep 17 00:00:00 2001 From: Sebastian <36822133+fortifyde@users.noreply.github.com> Date: Thu, 7 Nov 2024 20:07:49 +0100 Subject: [PATCH 09/12] Added required dependencies for Arch (#824) When installing dwm-titus with slstatus from a fresh Arch-Server install, several required dependencies are missing and need to be included. These are: - meson - libev - uthash - libconfig Tested only on another fresh Arch-Server install and script completed successfully. --- core/tabs/applications-setup/dwmtitus-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/dwmtitus-setup.sh b/core/tabs/applications-setup/dwmtitus-setup.sh index a4a5295ed..be23b9ad9 100755 --- a/core/tabs/applications-setup/dwmtitus-setup.sh +++ b/core/tabs/applications-setup/dwmtitus-setup.sh @@ -6,7 +6,7 @@ setupDWM() { printf "%b\n" "${YELLOW}Installing DWM-Titus...${RC}" case "$PACKAGER" in # Install pre-Requisites pacman) - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git unzip flameshot lxappearance feh mate-polkit + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git unzip flameshot lxappearance feh mate-polkit meson libev uthash libconfig ;; apt-get|nala) "$ESCALATION_TOOL" "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev libx11-xcb-dev libfontconfig1 libx11-6 libxft2 libxinerama1 libxcb-res0-dev git unzip flameshot lxappearance feh mate-polkit From 472c85eb7963905df77fcabce01981cfa52a2f24 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:38:20 +0530 Subject: [PATCH 10/12] Increase scroll length (#830) --- tui/src/running_command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tui/src/running_command.rs b/tui/src/running_command.rs index af642d0f7..798c67c0f 100644 --- a/tui/src/running_command.rs +++ b/tui/src/running_command.rs @@ -255,7 +255,7 @@ impl RunningCommand { // Process the buffer with a parser with the current screen size // We don't actually need to create a new parser every time, but it is so much easier this // way, and doesn't cost that much - let mut parser = vt100::Parser::new(size.height, size.width, 200); + let mut parser = vt100::Parser::new(size.height, size.width, 1000); let mutex = self.buffer.lock(); let buffer = mutex.as_ref().unwrap(); parser.process(buffer); From d033b0f36d02a7a677b6bf0c86e0f70ab9da7a15 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:39:18 +0530 Subject: [PATCH 11/12] feat: Add `--skip-confirmation` flag (#834) * feat: Add --skip-confirmation flag * add `--skip-confirmation` to the manpage --------- Co-authored-by: Adam Perkowski --- man/linutil.1 | 4 ++++ tui/src/main.rs | 13 ++++++++++++- tui/src/state.rs | 29 ++++++++++++++++++++--------- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/man/linutil.1 b/man/linutil.1 index a85bee968..5150b3517 100644 --- a/man/linutil.1 +++ b/man/linutil.1 @@ -32,6 +32,10 @@ Possible values: .br Defaults to \fIdefault\fR. +.TP +\fB\-y\fR, \fB\-\-skip\-confirmation\fR +Skip confirmation prompt before executing commands. + .TP \fB\-\-override\-validation\fR Show all available entries, disregarding compatibility checks. (\fBUNSAFE\fR) diff --git a/tui/src/main.rs b/tui/src/main.rs index 428e6b5bd..d8f7d0d15 100644 --- a/tui/src/main.rs +++ b/tui/src/main.rs @@ -34,6 +34,12 @@ struct Args { #[arg(default_value_t = Theme::Default)] #[arg(help = "Set the theme to use in the application")] theme: Theme, + #[arg( + short = 'y', + long, + help = "Skip confirmation prompt before executing commands" + )] + skip_confirmation: bool, #[arg(long, default_value_t = false)] #[clap(help = "Show all available options, disregarding compatibility checks (UNSAFE)")] override_validation: bool, @@ -45,7 +51,12 @@ struct Args { fn main() -> io::Result<()> { let args = Args::parse(); - let mut state = AppState::new(args.theme, args.override_validation, args.size_bypass); + let mut state = AppState::new( + args.theme, + args.override_validation, + args.size_bypass, + args.skip_confirmation, + ); stdout().execute(EnterAlternateScreen)?; enable_raw_mode()?; diff --git a/tui/src/state.rs b/tui/src/state.rs index 008d110b7..a164e1742 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -61,6 +61,7 @@ pub struct AppState { #[cfg(feature = "tips")] tip: String, size_bypass: bool, + skip_confirmation: bool, } pub enum Focus { @@ -85,7 +86,12 @@ enum SelectedItem { } impl AppState { - pub fn new(theme: Theme, override_validation: bool, size_bypass: bool) -> Self { + pub fn new( + theme: Theme, + override_validation: bool, + size_bypass: bool, + skip_confirmation: bool, + ) -> Self { let tabs = linutil_core::get_tabs(!override_validation); let root_id = tabs[0].tree.root().id(); @@ -103,6 +109,7 @@ impl AppState { #[cfg(feature = "tips")] tip: get_random_tip(), size_bypass, + skip_confirmation, }; state.update_items(); @@ -756,14 +763,18 @@ impl AppState { } } - let cmd_names = self - .selected_commands - .iter() - .map(|node| node.name.as_str()) - .collect::>(); - - let prompt = ConfirmPrompt::new(&cmd_names[..]); - self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40)); + if self.skip_confirmation { + self.handle_confirm_command(); + } else { + let cmd_names = self + .selected_commands + .iter() + .map(|node| node.name.as_str()) + .collect::>(); + + let prompt = ConfirmPrompt::new(&cmd_names[..]); + self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40)); + } } SelectedItem::None => {} } From e8e1a36a6308e6d1970661a596505cfd8e16b858 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:48:21 +0530 Subject: [PATCH 12/12] Linutil arguments when using `curl` (#835) * Use args * Include details about arguments * Update README.md Co-authored-by: Adam Perkowski --------- Co-authored-by: Adam Perkowski --- README.md | 20 ++++++++++++++++++++ start.sh | 2 +- startdev.sh | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 33bb3bdb8..e6c54db5e 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,26 @@ curl -fsSL https://christitus.com/linux | sh ```bash curl -fsSL https://christitus.com/linuxdev | sh ``` +
+ 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]. +- `--override-validation` : Show all available options, disregarding compatibility checks (UNSAFE). +- `-h, --help` : Print help. + +For more detailed usage, run: + +```bash +curl -fsSL https://christitus.com/linux | sh -s -- --help +``` + +```bash +linutil --help +``` +
+ ## ⬇️ Installation Linutil is also available as a package in various repositories: diff --git a/start.sh b/start.sh index 3c412fb6b..71e875833 100755 --- a/start.sh +++ b/start.sh @@ -43,7 +43,7 @@ check $? "Downloading linutil" chmod +x "$temp_file" check $? "Making linutil executable" -"$temp_file" +"$temp_file" "$@" check $? "Executing linutil" rm -f "$temp_file" diff --git a/startdev.sh b/startdev.sh index 5aad12ad8..8e27bbf09 100755 --- a/startdev.sh +++ b/startdev.sh @@ -69,7 +69,7 @@ check $? "Downloading linutil" chmod +x "$TMPFILE" check $? "Making linutil executable" -"$TMPFILE" +"$TMPFILE" "$@" check $? "Executing linutil" rm -f "$TMPFILE"