From c20c6e2f383ca378f5115c06c5bd2995c6d2b390 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Wed, 6 Nov 2024 01:11:53 +0530 Subject: [PATCH 01/40] Add missing gaming deps (#761) --- core/tabs/system-setup/gaming-setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/tabs/system-setup/gaming-setup.sh b/core/tabs/system-setup/gaming-setup.sh index 92c666c7..07673952 100755 --- a/core/tabs/system-setup/gaming-setup.sh +++ b/core/tabs/system-setup/gaming-setup.sh @@ -21,12 +21,12 @@ installDepend() { alsa-utils alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib giflib lib32-giflib libpng lib32-libpng \ libldap lib32-libldap openal lib32-openal libxcomposite lib32-libxcomposite libxinerama lib32-libxinerama \ ncurses lib32-ncurses vulkan-icd-loader lib32-vulkan-icd-loader ocl-icd lib32-ocl-icd libva lib32-libva \ - gst-plugins-base-libs lib32-gst-plugins-base-libs sdl2" + gst-plugins-base-libs lib32-gst-plugins-base-libs sdl2 lib32-sdl2 v4l-utils lib32-v4l-utils sqlite lib32-sqlite" $AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS ;; apt-get|nala) - DISTRO_DEPS="libasound2 libsdl2 wine64 wine32" + DISTRO_DEPS="libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 wine64 wine32" "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" dpkg --add-architecture i386 @@ -36,7 +36,7 @@ installDepend() { "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS ;; dnf) - if [ "$(rpm -E %fedora)" -le 41 ]; then + if [ "$(rpm -E %fedora)" -le 41 ]; then "$ESCALATION_TOOL" "$PACKAGER" install ffmpeg ffmpeg-libs -y "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES else @@ -69,7 +69,7 @@ installAdditionalDepend() { version_no_v=$(echo "$version" | tr -d v) curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb" - + printf "%b\n" "${YELLOW}Installing Lutris...${RC}" "$ESCALATION_TOOL" "$PACKAGER" install ./lutris_"${version_no_v}"_all.deb From 48e8bab12c25ecc6cec26e86000975f3168d4c24 Mon Sep 17 00:00:00 2001 From: Sebastian <36822133+fortifyde@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:58:21 +0100 Subject: [PATCH 02/40] Add greeter install for lightdm during dwm-titus setup (#831) * Add greeter install for lightdm * Update core/tabs/applications-setup/dwmtitus-setup.sh Co-authored-by: Adam Perkowski --------- Co-authored-by: Adam Perkowski --- core/tabs/applications-setup/dwmtitus-setup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/tabs/applications-setup/dwmtitus-setup.sh b/core/tabs/applications-setup/dwmtitus-setup.sh index 01ec0ef1..c4fa5fc9 100755 --- a/core/tabs/applications-setup/dwmtitus-setup.sh +++ b/core/tabs/applications-setup/dwmtitus-setup.sh @@ -218,6 +218,9 @@ setupDisplayManager() { case "$PACKAGER" in pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DM" + if [ "$DM" = "lightdm" ]; then + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm lightdm-gtk-greeter + fi ;; apt-get|nala) "$ESCALATION_TOOL" "$PACKAGER" install -y "$DM" From 67b749942cf04f7c1015e17506b54621e26c924f Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Wed, 6 Nov 2024 01:29:57 +0530 Subject: [PATCH 03/40] refact: multi-selection to per cmd (#719) * Add per cmd multi-selection * Add colors for nm cmds * fix: conflicts --- core/src/inner.rs | 56 +++++++++++-------------- core/src/lib.rs | 2 +- core/tabs/system-setup/tab_data.toml | 4 +- core/tabs/utils/tab_data.toml | 5 ++- tui/src/state.rs | 63 ++++++++++++++++------------ tui/src/theme.rs | 7 ++++ 6 files changed, 76 insertions(+), 61 deletions(-) diff --git a/core/src/inner.rs b/core/src/inner.rs index a2274dfa..ed810b06 100644 --- a/core/src/inner.rs +++ b/core/src/inner.rs @@ -33,30 +33,18 @@ pub fn get_tabs(validate: bool) -> (TempDir, Vec) { let tabs: Vec = tabs .into_iter() - .map( - |( - TabEntry { - name, - data, - multi_selectable, - }, - directory, - )| { - let mut tree = Tree::new(Rc::new(ListNode { - name: "root".to_string(), - description: String::new(), - command: Command::None, - task_list: String::new(), - })); - let mut root = tree.root_mut(); - create_directory(data, &mut root, &directory, validate); - Tab { - name, - tree, - multi_selectable, - } - }, - ) + .map(|(TabEntry { name, data }, directory)| { + let mut tree = Tree::new(Rc::new(ListNode { + name: "root".to_string(), + description: String::new(), + command: Command::None, + task_list: String::new(), + multi_select: false, + })); + let mut root = tree.root_mut(); + create_directory(data, &mut root, &directory, validate, true); + Tab { name, tree } + }) .collect(); if tabs.is_empty() { @@ -74,12 +62,6 @@ struct TabList { struct TabEntry { name: String, data: Vec, - #[serde(default = "default_multi_selectable")] - multi_selectable: bool, -} - -fn default_multi_selectable() -> bool { - true } #[derive(Deserialize)] @@ -94,6 +76,12 @@ struct Entry { entry_type: EntryType, #[serde(default)] task_list: String, + #[serde(default = "default_true")] + multi_select: bool, +} + +fn default_true() -> bool { + true } #[derive(Deserialize)] @@ -174,8 +162,11 @@ fn create_directory( node: &mut NodeMut>, command_dir: &Path, validate: bool, + parent_multi_select: bool, ) { for entry in data { + let multi_select = parent_multi_select && entry.multi_select; + match entry.entry_type { EntryType::Entries(entries) => { let mut node = node.append(Rc::new(ListNode { @@ -183,8 +174,9 @@ fn create_directory( description: entry.description, command: Command::None, task_list: String::new(), + multi_select, })); - create_directory(entries, &mut node, command_dir, validate); + create_directory(entries, &mut node, command_dir, validate, multi_select); } EntryType::Command(command) => { node.append(Rc::new(ListNode { @@ -192,6 +184,7 @@ fn create_directory( description: entry.description, command: Command::Raw(command), task_list: String::new(), + multi_select, })); } EntryType::Script(script) => { @@ -210,6 +203,7 @@ fn create_directory( file: script, }, task_list: entry.task_list, + multi_select, })); } } diff --git a/core/src/lib.rs b/core/src/lib.rs index b7cd631e..4e795dd3 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -23,7 +23,6 @@ pub enum Command { pub struct Tab { pub name: String, pub tree: Tree>, - pub multi_selectable: bool, } #[derive(Clone, Hash, Eq, PartialEq)] @@ -32,4 +31,5 @@ pub struct ListNode { pub description: String, pub command: Command, pub task_list: String, + pub multi_select: bool, } diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 850ef38e..b912cd6c 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -1,5 +1,4 @@ name = "System Setup" -multi_selectable = false [[data]] name = "Arch Linux" @@ -14,6 +13,7 @@ name = "Arch Server Setup" description = "This command installs a minimal arch server setup under 5 minutes." script = "arch/server-setup.sh" task_list = "SI D" +multi_select = false [[data.entries]] name = "Paru AUR Helper" @@ -82,12 +82,14 @@ name = "Full System Cleanup" description = "This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash." script = "system-cleanup.sh" task_list = "RP PFM" +multi_select = false [[data]] name = "Full System Update" description = "This command updates your system to the latest packages available for your distro" script = "system-update.sh" task_list = "PFM" +multi_select = false [[data]] name = "Gaming Dependencies" diff --git a/core/tabs/utils/tab_data.toml b/core/tabs/utils/tab_data.toml index 00b68edf..a0f6d50e 100644 --- a/core/tabs/utils/tab_data.toml +++ b/core/tabs/utils/tab_data.toml @@ -1,8 +1,8 @@ name = "Utilities" -multi_selectable = false [[data]] name = "Monitor Control" +multi_select = false [[data.preconditions]] matches = true @@ -78,6 +78,7 @@ script = "monitor-control/set_resolutions.sh" [[data]] name = "User Account Manager" +multi_select = false [[data.entries]] name = "Add User" @@ -104,6 +105,7 @@ name = "Auto Mount Drive" description = "This utility is designed to help with automating the process of mounting a drive on to your system." script = "auto-mount.sh" task_list = "PFM" +multi_select = false [[data]] name = "Auto Login" @@ -120,6 +122,7 @@ name = "Bluetooth Manager" description = "This utility is designed to manage bluetooth in your system" script = "bluetooth-control.sh" task_list = "I SS" +multi_select = false [[data]] name = "Bootable USB Creator" diff --git a/tui/src/state.rs b/tui/src/state.rs index a07bf178..3670c779 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -153,12 +153,10 @@ impl AppState { hints.push(Shortcut::new("Select item below", ["j", "Down"])); hints.push(Shortcut::new("Next theme", ["t"])); hints.push(Shortcut::new("Previous theme", ["T"])); - - if self.is_current_tab_multi_selectable() { - hints.push(Shortcut::new("Toggle multi-selection mode", ["v"])); + hints.push(Shortcut::new("Multi-selection mode", ["v"])); + if self.multi_select { hints.push(Shortcut::new("Select multiple commands", ["Space"])); } - hints.push(Shortcut::new("Next tab", ["Tab"])); hints.push(Shortcut::new("Previous tab", ["Shift-Tab"])); hints.push(Shortcut::new("Important actions guide", ["g"])); @@ -330,7 +328,12 @@ impl AppState { let (indicator, style) = if is_selected { (self.theme.multi_select_icon(), Style::default().bold()) } else { - ("", Style::new()) + let ms_style = if self.multi_select && !node.multi_select { + Style::default().fg(self.theme.multi_select_disabled_color()) + } else { + Style::new() + }; + ("", ms_style) }; if *has_children { Line::from(format!( @@ -340,6 +343,7 @@ impl AppState { indicator )) .style(self.theme.dir_color()) + .patch_style(style) } else { Line::from(format!( "{} {} {}", @@ -357,13 +361,21 @@ impl AppState { |ListEntry { node, has_children, .. }| { + let ms_style = if self.multi_select && !node.multi_select { + Style::default().fg(self.theme.multi_select_disabled_color()) + } else { + Style::new() + }; if *has_children { - Line::from(" ").style(self.theme.dir_color()) + Line::from(" ") + .style(self.theme.dir_color()) + .patch_style(ms_style) } else { Line::from(format!("{} ", node.task_list)) .alignment(Alignment::Right) .style(self.theme.cmd_color()) .bold() + .patch_style(ms_style) } }, )); @@ -479,6 +491,13 @@ impl AppState { // enabled, need to clear it to prevent state corruption if !self.multi_select { self.selected_commands.clear() + } else { + // Prevents non multi_selectable cmd from being pushed into the selected list + if let Some(node) = self.get_selected_node() { + if !node.multi_select { + self.selected_commands.retain(|cmd| cmd.name != node.name); + } + } } } ConfirmStatus::Confirm => self.handle_confirm_command(), @@ -556,41 +575,31 @@ impl AppState { } fn toggle_multi_select(&mut self) { - if self.is_current_tab_multi_selectable() { - self.multi_select = !self.multi_select; - if !self.multi_select { - self.selected_commands.clear(); - } + self.multi_select = !self.multi_select; + if !self.multi_select { + self.selected_commands.clear(); } } fn toggle_selection(&mut self) { - if let Some(command) = self.get_selected_node() { - if self.selected_commands.contains(&command) { - self.selected_commands.retain(|c| c != &command); - } else { - self.selected_commands.push(command); + if let Some(node) = self.get_selected_node() { + if node.multi_select { + if self.selected_commands.contains(&node) { + self.selected_commands.retain(|c| c != &node); + } else { + self.selected_commands.push(node); + } } } } - pub fn is_current_tab_multi_selectable(&self) -> bool { - let index = self.current_tab.selected().unwrap_or(0); - self.tabs - .get(index) - .map_or(false, |tab| tab.multi_selectable) - } - fn update_items(&mut self) { self.filter.update_items( &self.tabs, self.current_tab.selected().unwrap(), self.visit_stack.last().unwrap().0, ); - if !self.is_current_tab_multi_selectable() { - self.multi_select = false; - self.selected_commands.clear(); - } + let len = self.filter.item_list().len(); if len > 0 { let current = self.selection.selected().unwrap_or(0); diff --git a/tui/src/theme.rs b/tui/src/theme.rs index 8337645a..d87e87ee 100644 --- a/tui/src/theme.rs +++ b/tui/src/theme.rs @@ -28,6 +28,13 @@ impl Theme { } } + pub fn multi_select_disabled_color(&self) -> Color { + match self { + Theme::Default => Color::DarkGray, + Theme::Compatible => Color::DarkGray, + } + } + pub fn tab_color(&self) -> Color { match self { Theme::Default => Color::Rgb(255, 255, 85), From 88d6fd12a2ab958194a9bef1d4e2b699667a16e7 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Wed, 6 Nov 2024 04:12:40 +0530 Subject: [PATCH 04/40] fix: flatpak path (#916) --- core/tabs/common-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh index a9dd5d62..d431c488 100644 --- a/core/tabs/common-script.sh +++ b/core/tabs/common-script.sh @@ -10,7 +10,7 @@ GREEN='\033[32m' command_exists() { for cmd in "$@"; do - export PATH=/home/jeeva/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH + export PATH="$HOME/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH" command -v "$cmd" >/dev/null 2>&1 || return 1 done return 0 From 565f507190cd55ef7555a9d28c2e8f1e1f9dfee0 Mon Sep 17 00:00:00 2001 From: nyx Date: Wed, 6 Nov 2024 10:40:55 -0500 Subject: [PATCH 05/40] implement word wrapping functionality (#755) * implement dynamic auto updating word wrapping functionality * run fmt * remove dupe space * run fmt * add remove comments back * fix compilation errors * run fmt * run docgen * run docgen * fix conflicts * run cargo xtask docgen * use boolean rather than enum --------- Co-authored-by: nyx --- Cargo.lock | 24 ++++++ core/tabs/applications-setup/tab_data.toml | 16 ++-- core/tabs/gaming/tab_data.toml | 2 +- core/tabs/security/tab_data.toml | 2 +- core/tabs/system-setup/tab_data.toml | 6 +- docs/userguide.md | 50 ++++-------- tui/Cargo.toml | 1 + tui/src/floating_text.rs | 89 +++++++++++++--------- tui/src/state.rs | 5 +- 9 files changed, 108 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc49af4c..e6f5151f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -443,6 +443,7 @@ dependencies = [ "rand", "ratatui", "temp-dir", + "textwrap", "tree-sitter-bash", "tree-sitter-highlight", "tui-term", @@ -889,6 +890,12 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + [[package]] name = "static_assertions" version = "1.1.0" @@ -955,6 +962,17 @@ dependencies = [ "libc", ] +[[package]] +name = "textwrap" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width 0.1.14", +] + [[package]] name = "thiserror" version = "1.0.64" @@ -1067,6 +1085,12 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + [[package]] name = "unicode-segmentation" version = "1.11.0" diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml index 44b74464..dce7fa79 100644 --- a/core/tabs/applications-setup/tab_data.toml +++ b/core/tabs/applications-setup/tab_data.toml @@ -200,7 +200,7 @@ task_list = "FI" [[data]] name = "Alacritty" -description = "Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows.\nThis command installs and condifures alacritty terminal emulator." +description = "Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows. This command installs and configures alacritty terminal emulator." script = "alacritty-setup.sh" task_list = "I FM" @@ -212,13 +212,13 @@ task_list = "I" [[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.\nIt is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful.\nThis command configures the key sections and functionalities defined in the .bashrc file from CTT's mybash repository.\nhttps://github.com/ChrisTitusTech/mybash" +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" script = "mybash-setup.sh" task_list = "I FM" [[data]] name = "Bottles" -description = "Bottles allows Windows software, like applications and games, to run on Linux.\nBottles also provides tools to categorize, organize and optimize your applications." +description = "Bottles allows Windows software, like applications and games, to run on Linux. Bottles also provides tools to categorize, organize and optimize your applications." script = "bottles-setup.sh" task_list = "FI" @@ -236,13 +236,13 @@ task_list = "I PFM SS" [[data]] name = "Fastfetch" -description = "Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily.\nIt is written mainly in C, with performance and customizability in mind.\nThis command installs fastfetch and configures from CTT's mybash repository.\nhttps://github.com/ChrisTitusTech/mybash" +description = "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" script = "fastfetch-setup.sh" task_list = "I FM" [[data]] name = "Flatpak / Flathub" -description = "Flatpak is a universal application sandbox for Linux that uses isolated packages from Flathub to prevent conflicts and system alterations, while alleviating dependency concerns.\nThis command installs Flatpak and adds the Flathub repository" +description = "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" script = "setup-flatpak.sh" task_list = "I" @@ -254,7 +254,7 @@ task_list = "PFM" [[data]] name = "Kitty" -description = "kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features.\nkitty is written in a mix of C and Python programming languages.\n This command installs and configures kitty." +description = "kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features. kitty is written in a mix of C and Python programming languages. This command installs and configures kitty." script = "kitty-setup.sh" task_list = "I FM" @@ -282,7 +282,7 @@ values = [ "linutil" ] [[data]] name = "Rofi" -description = "Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport.\nThis command installs and configures rofi with configuration from CTT's DWM repo.\nhttps://github.com/ChrisTitusTech/dwm-titus" +description = "Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport. This command installs and configures rofi with configuration from CTT's DWM repo. https://github.com/ChrisTitusTech/dwm-titus" script = "rofi-setup.sh" task_list = "I FM" @@ -298,6 +298,6 @@ values = [ "wayland", "Wayland" ] [[data]] name = "ZSH Prompt" -description = "The Z shell is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.\nThis command installs ZSH prompt and provides basic configuration." +description = "The Z shell is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh. This command installs ZSH prompt and provides basic configuration." script = "zsh-setup.sh" task_list = "I FM" \ No newline at end of file diff --git a/core/tabs/gaming/tab_data.toml b/core/tabs/gaming/tab_data.toml index 14eebd51..869a4180 100644 --- a/core/tabs/gaming/tab_data.toml +++ b/core/tabs/gaming/tab_data.toml @@ -5,6 +5,6 @@ name = "Diablo II Resurrected" [[data.entries]] name = "Loot Filter" -description = "This is a loot filter for Diablo II Resurrected.\nIt's designed to be a simple, clean, and easy to read loot filter that highlights the most important items.\nWorks on battle.net and single player.\nNo frills, no config, just highlights high runes and other valuable items.\nFor more information visit: https://github.com/ChrisTitusTech/d2r-loot-filter" +description = "This is a loot filter for Diablo II Resurrected. It's designed to be a simple, clean, and easy to read loot filter that highlights the most important items. Works on battle.net and single player. No frills, no config, just highlights high runes and other valuable items. For more information visit: https://github.com/ChrisTitusTech/d2r-loot-filter" script = "diablo-ii/d2r-loot-filters.sh" task_list = "FM" diff --git a/core/tabs/security/tab_data.toml b/core/tabs/security/tab_data.toml index 34de8174..ce8d7ac4 100644 --- a/core/tabs/security/tab_data.toml +++ b/core/tabs/security/tab_data.toml @@ -2,6 +2,6 @@ name = "Security" [[data]] name = "Firewall Baselines (CTT)" -description = "Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall.\nThis command installs UFW and configures UFW based on CTT's recommended rules.\nFor more information visit: https://christitus.com/linux-security-mistakes" +description = "Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall. This command installs UFW and configures UFW based on CTT's recommended rules. For more information visit: https://christitus.com/linux-security-mistakes" script = "firewall-baselines.sh" task_list = "I SS" diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index b912cd6c..2c439cab 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -17,13 +17,13 @@ multi_select = false [[data.entries]] name = "Paru AUR Helper" -description = "Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers" +description = "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" script = "arch/paru-setup.sh" task_list = "I" [[data.entries]] name = "Yay AUR Helper" -description = "Yet Another Yogurt - An AUR Helper Written in Go.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers" +description = "Yet Another Yogurt - An AUR Helper Written in Go. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers" script = "arch/yay-setup.sh" task_list = "I" @@ -55,7 +55,7 @@ task_list = "I" [[data.entries]] name = "RPM Fusion" -description = "RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship.\nThat software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit.\nFor more information visit: https://rpmfusion.org/" +description = "RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit. For more information visit: https://rpmfusion.org/" script = "fedora/rpm-fusion-setup.sh" task_list = "MP" diff --git a/docs/userguide.md b/docs/userguide.md index 8ad704e6..e3f50c81 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -45,15 +45,10 @@ https://github.com/ChrisTitusTech/neovim - **Thorium**: Thorium is a Chromium-based browser focused on privacy and performance. - **Vivaldi**: Vivaldi is a freeware, cross-platform web browser developed by Vivaldi Technologies. - **waterfox**: Waterfox is the privacy-focused web browser engineered to give you speed, control, and peace of mind on the internet. -- **Alacritty**: Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows. -This command installs and condifures alacritty terminal emulator. +- **Alacritty**: Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows. This command installs and configures alacritty terminal emulator. - **Android Debloater**: Universal Android Debloater (UAD) is a tool designed to help users remove bloatware and unnecessary pre-installed applications from Android devices, enhancing performance and user experience. -- **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. +- **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. - **DWM-Titus**: DWM is a dynamic window manager for X. It manages windows in tiled, monocle and floating layouts. @@ -61,41 +56,26 @@ All of the layouts can be applied dynamically, optimising the environment for th 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 -- **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 +- **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. -- **Kitty**: kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features. -kitty is written in a mix of C and Python programming languages. - This command installs and configures kitty. +- **Kitty**: kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features. kitty is written in a mix of C and Python programming languages. This command installs and configures kitty. - **Linutil Installer**: Installs a distro-specific Linutil package locally. - **Linutil Updater**: Updates your local Linutil crate installation. -- **Rofi**: Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport. -This command installs and configures rofi with configuration from CTT's DWM repo. -https://github.com/ChrisTitusTech/dwm-titus +- **Rofi**: Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport. This command installs and configures rofi with configuration from CTT's DWM repo. https://github.com/ChrisTitusTech/dwm-titus - **Waydroid**: Waydroid is an emulator that allows you to run Android apps and games on Linux. -- **ZSH Prompt**: The Z shell is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh. -This command installs ZSH prompt and provides basic configuration. +- **ZSH Prompt**: The Z shell is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh. This command installs ZSH prompt and provides basic configuration. ## Gaming ### Diablo II Resurrected -- **Loot Filter**: This is a loot filter for Diablo II Resurrected. -It's designed to be a simple, clean, and easy to read loot filter that highlights the most important items. -Works on battle.net and single player. -No frills, no config, just highlights high runes and other valuable items. -For more information visit: https://github.com/ChrisTitusTech/d2r-loot-filter +- **Loot Filter**: This is a loot filter for Diablo II Resurrected. It's designed to be a simple, clean, and easy to read loot filter that highlights the most important items. Works on battle.net and single player. No frills, no config, just highlights high runes and other valuable items. For more information visit: https://github.com/ChrisTitusTech/d2r-loot-filter ## Security -- **Firewall Baselines (CTT)**: Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall. -This command installs UFW and configures UFW based on CTT's recommended rules. -For more information visit: https://christitus.com/linux-security-mistakes +- **Firewall Baselines (CTT)**: Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall. This command installs UFW and configures UFW based on CTT's recommended rules. For more information visit: https://christitus.com/linux-security-mistakes ## System Setup @@ -103,19 +83,15 @@ For more information visit: https://christitus.com/linux-security-mistakes ### Arch Linux - **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes. -- **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 -- **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 +- **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 +- **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 - **Configure DNF**: Optimizes DNF for parallel downloads - **Multimedia Codecs**: This script is designed to install multimedia codecs, and to ensure RPM Fusion repositories are installed. - **Nvidia Proprietary Drivers**: This script is designed to download the proprietary NVIDIA drivers in Fedora. -- **RPM Fusion**: RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. -That software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit. -For more information visit: https://rpmfusion.org/ +- **RPM Fusion**: RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit. For more information visit: https://rpmfusion.org/ - **Upgrade to a New Fedora Release**: Upgrades system to the next Fedora release - **Virtualization**: Enables Virtualization through dnf - **Build Prerequisites**: This script is designed to handle the installation of various software dependencies across different Linux distributions diff --git a/tui/Cargo.toml b/tui/Cargo.toml index 337dc5c7..b411fb2d 100644 --- a/tui/Cargo.toml +++ b/tui/Cargo.toml @@ -27,6 +27,7 @@ rand = { version = "0.8.5", optional = true } linutil_core = { path = "../core", version = "24.9.28" } tree-sitter-highlight = "0.24.3" tree-sitter-bash = "0.23.1" +textwrap = "0.16.1" anstyle = "1.0.8" ansi-to-tui = "7.0.0" zips = "0.1.7" diff --git a/tui/src/floating_text.rs b/tui/src/floating_text.rs index be22958c..c7bb059f 100644 --- a/tui/src/floating_text.rs +++ b/tui/src/floating_text.rs @@ -20,16 +20,19 @@ use ratatui::{ use ansi_to_tui::IntoText; +use textwrap::wrap; use tree_sitter_bash as hl_bash; use tree_sitter_highlight::{self as hl, HighlightEvent}; use zips::zip_result; pub struct FloatingText { - pub src: Vec, + pub src: String, + wrapped_lines: Vec, max_line_width: usize, v_scroll: usize, h_scroll: usize, mode_title: String, + wrap_words: bool, frame_height: usize, } @@ -108,12 +111,6 @@ fn get_highlighted_string(s: &str) -> Option { Some(output) } -macro_rules! max_width { - ($($lines:tt)+) => {{ - $($lines)+.iter().fold(0, |accum, val| accum.max(val.len())) - }} -} - #[inline] fn get_lines(s: &str) -> Vec<&str> { s.lines().collect::>() @@ -125,50 +122,49 @@ fn get_lines_owned(s: &str) -> Vec { } impl FloatingText { - pub fn new(text: String, title: &str) -> Self { - let src = get_lines(&text) - .into_iter() - .map(|s| s.to_string()) - .collect::>(); + pub fn new(text: String, title: &str, wrap_words: bool) -> Self { + let max_line_width = 80; + let wrapped_lines = if wrap_words { + wrap(&text, max_line_width) + .into_iter() + .map(|cow| cow.into_owned()) + .collect() + } else { + get_lines_owned(&text) + }; - let max_line_width = max_width!(src); Self { - src, + src: text, + wrapped_lines, mode_title: title.to_string(), max_line_width, v_scroll: 0, h_scroll: 0, + wrap_words, frame_height: 0, } } pub fn from_command(command: &Command, title: String) -> Option { - let (max_line_width, src) = match command { - Command::Raw(cmd) => { - // just apply highlights directly - (max_width!(get_lines(cmd)), Some(cmd.clone())) - } - Command::LocalFile { file, .. } => { - // have to read from tmp dir to get cmd src - let raw = std::fs::read_to_string(file) - .map_err(|_| format!("File not found: {:?}", file)) - .unwrap(); + let src = match command { + Command::Raw(cmd) => Some(cmd.clone()), + Command::LocalFile { file, .. } => std::fs::read_to_string(file) + .map_err(|_| format!("File not found: {:?}", file)) + .ok(), + Command::None => None, + }?; - (max_width!(get_lines(&raw)), Some(raw)) - } - - // If command is a folder, we don't display a preview - Command::None => (0usize, None), - }; - - let src = get_lines_owned(&get_highlighted_string(&src?)?); + let max_line_width = 80; + let wrapped_lines = get_lines_owned(&get_highlighted_string(&src)?); Some(Self { src, + wrapped_lines, mode_title: title, max_line_width, h_scroll: 0, v_scroll: 0, + wrap_words: false, frame_height: 0, }) } @@ -197,6 +193,20 @@ impl FloatingText { self.h_scroll += 1; } } + + fn update_wrapping(&mut self, width: usize) { + if self.max_line_width != width { + self.max_line_width = width; + self.wrapped_lines = if self.wrap_words { + wrap(&self.src, width) + .into_iter() + .map(|cow| cow.into_owned()) + .collect() + } else { + get_lines_owned(&get_highlighted_string(&self.src).unwrap_or(self.src.clone())) + }; + } + } } impl FloatContent for FloatingText { @@ -217,13 +227,22 @@ impl FloatContent for FloatingText { // Calculate the inner area to ensure text is not drawn over the border let inner_area = block.inner(area); - let Rect { height, .. } = inner_area; + let Rect { width, height, .. } = inner_area; + + self.update_wrapping(width as usize); + let lines = self - .src + .wrapped_lines .iter() .skip(self.v_scroll) .take(height as usize) - .flat_map(|l| l.into_text().unwrap()) + .flat_map(|l| { + if self.wrap_words { + vec![Line::raw(l.clone())] + } else { + l.into_text().unwrap().lines + } + }) .map(|line| { let mut skipped = 0; let mut spans = line diff --git a/tui/src/state.rs b/tui/src/state.rs index 3670c779..92160bf7 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -718,7 +718,8 @@ impl AppState { fn enable_description(&mut self) { if let Some(command_description) = self.get_selected_description() { if !command_description.is_empty() { - let description = FloatingText::new(command_description, "Command Description"); + let description = + FloatingText::new(command_description, "Command Description", true); self.spawn_float(description, 80, 80); } } @@ -804,7 +805,7 @@ impl AppState { fn toggle_task_list_guide(&mut self) { self.spawn_float( - FloatingText::new(ACTIONS_GUIDE.to_string(), "Important Actions Guide"), + FloatingText::new(ACTIONS_GUIDE.to_string(), "Important Actions Guide", true), 80, 80, ); From f0734f361c8e01ef8bda51f296253f773af8d2d7 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Wed, 6 Nov 2024 16:49:26 +0100 Subject: [PATCH 06/40] =?UTF-8?q?=F0=9F=A6=80=20feat(ux):=20add=20a=20mini?= =?UTF-8?q?mum=20size=20bypass=20cli=20flag=20(#920)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * πŸ¦€ feat(ux): add a minimum size bypass cli flag * oopsie --- man/linutil.1 | 4 ++++ tui/src/main.rs | 5 ++++- tui/src/state.rs | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/man/linutil.1 b/man/linutil.1 index d31cf879..a85bee96 100644 --- a/man/linutil.1 +++ b/man/linutil.1 @@ -36,6 +36,10 @@ Defaults to \fIdefault\fR. \fB\-\-override\-validation\fR Show all available entries, disregarding compatibility checks. (\fBUNSAFE\fR) +.TP +\fB\-\-size\-bypass\fR +Bypass the terminal size limit + .TP \fB\-h\fR, \fB\-\-help\fR Print help. diff --git a/tui/src/main.rs b/tui/src/main.rs index 801e3b1d..df20e733 100644 --- a/tui/src/main.rs +++ b/tui/src/main.rs @@ -33,12 +33,15 @@ struct Args { #[arg(long, default_value_t = false)] #[clap(help = "Show all available options, disregarding compatibility checks (UNSAFE)")] override_validation: bool, + #[arg(long, default_value_t = false)] + #[clap(help = "Bypass the terminal size limit")] + size_bypass: bool, } fn main() -> io::Result<()> { let args = Args::parse(); - let mut state = AppState::new(args.theme, args.override_validation); + let mut state = AppState::new(args.theme, args.override_validation, args.size_bypass); stdout().execute(EnterAlternateScreen)?; enable_raw_mode()?; diff --git a/tui/src/state.rs b/tui/src/state.rs index 92160bf7..058dcc20 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -62,6 +62,7 @@ pub struct AppState { drawable: bool, #[cfg(feature = "tips")] tip: String, + size_bypass: bool, } pub enum Focus { @@ -86,7 +87,7 @@ enum SelectedItem { } impl AppState { - pub fn new(theme: Theme, override_validation: bool) -> Self { + pub fn new(theme: Theme, override_validation: bool, size_bypass: bool) -> Self { let (temp_dir, tabs) = linutil_core::get_tabs(!override_validation); let root_id = tabs[0].tree.root().id(); @@ -104,6 +105,7 @@ impl AppState { drawable: false, #[cfg(feature = "tips")] tip: get_random_tip(), + size_bypass, }; state.update_items(); @@ -186,7 +188,9 @@ impl AppState { pub fn draw(&mut self, frame: &mut Frame) { let terminal_size = frame.area(); - if terminal_size.width < MIN_WIDTH || terminal_size.height < MIN_HEIGHT { + if !self.size_bypass + && (terminal_size.height < MIN_HEIGHT || terminal_size.width < MIN_WIDTH) + { let warning = Paragraph::new(format!( "Terminal size too small:\nWidth = {} Height = {}\n\nMinimum size:\nWidth = {} Height = {}", terminal_size.width, From e463037e69841a8c949d0b40c4868d3aa352620a Mon Sep 17 00:00:00 2001 From: nev-al <149487875+nev-al@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:04:02 +0000 Subject: [PATCH 07/40] fix(dwmtitus-setup): dm picking (#823) Co-authored-by: usr --- core/tabs/applications-setup/dwmtitus-setup.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/dwmtitus-setup.sh b/core/tabs/applications-setup/dwmtitus-setup.sh index c4fa5fc9..a4a5295e 100755 --- a/core/tabs/applications-setup/dwmtitus-setup.sh +++ b/core/tabs/applications-setup/dwmtitus-setup.sh @@ -214,7 +214,22 @@ setupDisplayManager() { printf "%b\n" "${YELLOW}3. GDM ${RC}" printf "%b\n" "${YELLOW} ${RC}" printf "%b" "${YELLOW}Please select one: ${RC}" - read -r DM + read -r choice + case "$choice" in + 1) + DM="sddm" + ;; + 2) + DM="lightdm" + ;; + 3) + DM="gdm" + ;; + *) + printf "%b\n" "${RED}Invalid selection! Please choose 1, 2, or 3.${RC}" + exit 1 + ;; + esac case "$PACKAGER" in pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DM" From c36879e22f6b77ed87d7b3444ada0e86cfe8b167 Mon Sep 17 00:00:00 2001 From: nyx Date: Wed, 6 Nov 2024 15:01:19 -0500 Subject: [PATCH 08/40] Implement Rounded corners (#918) * add rounded corners * more * apply rounded corners to script boxes as well --- tui/src/confirmation.rs | 1 + tui/src/filter.rs | 7 ++++++- tui/src/floating_text.rs | 1 + tui/src/running_command.rs | 2 ++ tui/src/state.rs | 37 ++++++++++++++++++++++--------------- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/tui/src/confirmation.rs b/tui/src/confirmation.rs index d883fd2f..91d86c28 100644 --- a/tui/src/confirmation.rs +++ b/tui/src/confirmation.rs @@ -60,6 +60,7 @@ impl FloatContent for ConfirmPrompt { fn draw(&mut self, frame: &mut Frame, area: Rect) { let block = Block::default() .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) .title(" Confirm selections ") .title_bottom(" [y] to continue, [n] to abort ") .title_alignment(Alignment::Center) diff --git a/tui/src/filter.rs b/tui/src/filter.rs index 898fee74..0d9920de 100644 --- a/tui/src/filter.rs +++ b/tui/src/filter.rs @@ -123,7 +123,12 @@ impl Filter { //Create the search bar widget let search_bar = Paragraph::new(display_text) - .block(Block::default().borders(Borders::ALL).title(" Search ")) + .block( + Block::default() + .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) + .title(" Search "), + ) .style(Style::default().fg(search_color)); //Render the search bar (First chunk of the screen) diff --git a/tui/src/floating_text.rs b/tui/src/floating_text.rs index c7bb059f..a43361af 100644 --- a/tui/src/floating_text.rs +++ b/tui/src/floating_text.rs @@ -216,6 +216,7 @@ impl FloatContent for FloatingText { // Define the Block with a border and background color let block = Block::default() .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) .title(self.mode_title.clone()) .title_alignment(ratatui::layout::Alignment::Center) .title_style(Style::default().reversed()) diff --git a/tui/src/running_command.rs b/tui/src/running_command.rs index f2471778..e55690fe 100644 --- a/tui/src/running_command.rs +++ b/tui/src/running_command.rs @@ -53,6 +53,7 @@ impl FloatContent for RunningCommand { // Display a block indicating the command is running Block::default() .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) .title_top(Line::from("Running the command....").centered()) .title_style(Style::default().reversed()) .title_bottom(Line::from("Press Ctrl-C to KILL the command")) @@ -80,6 +81,7 @@ impl FloatContent for RunningCommand { Block::default() .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) .title_top(title_line.centered()) }; diff --git a/tui/src/state.rs b/tui/src/state.rs index 058dcc20..2e3933fb 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -217,19 +217,19 @@ impl AppState { self.drawable = true; } - let label_block = - Block::default() - .borders(Borders::all()) - .border_set(ratatui::symbols::border::Set { - top_left: " ", - top_right: " ", - bottom_left: " ", - bottom_right: " ", - vertical_left: " ", - vertical_right: " ", - horizontal_top: "*", - horizontal_bottom: "*", - }); + let label_block = Block::default() + .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) + .border_set(ratatui::symbols::border::Set { + top_left: " ", + top_right: " ", + bottom_left: " ", + bottom_right: " ", + vertical_left: " ", + vertical_right: " ", + horizontal_top: "*", + horizontal_bottom: "*", + }); let str1 = "Linutil "; let str2 = "by Chris Titus"; let label = Paragraph::new(Line::from(vec![ @@ -253,7 +253,8 @@ impl AppState { let keybinds_block = Block::default() .title(format!(" {} ", keybind_scope)) - .borders(Borders::all()); + .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED); let keybinds = create_shortcut_list(shortcuts, keybind_render_width); let n_lines = keybinds.len() as u16; @@ -297,7 +298,11 @@ impl AppState { }; let list = List::new(tabs) - .block(Block::default().borders(Borders::ALL)) + .block( + Block::default() + .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED), + ) .highlight_style(tab_hl_style) .highlight_symbol(self.theme.tab_icon()); frame.render_stateful_widget(list, left_chunks[1], &mut self.current_tab); @@ -409,6 +414,7 @@ impl AppState { .block( Block::default() .borders(Borders::ALL & !Borders::RIGHT) + .border_set(ratatui::symbols::border::ROUNDED) .title(title) .title_bottom(bottom_title), ) @@ -418,6 +424,7 @@ impl AppState { let disclaimer_list = List::new(task_items).highlight_style(style).block( Block::default() .borders(Borders::ALL & !Borders::LEFT) + .border_set(ratatui::symbols::border::ROUNDED) .title(task_list_title), ); From 6728e7ee9bde32d00486b5b6bc49b0f314effe13 Mon Sep 17 00:00:00 2001 From: Liam <33645555+lj3954@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:28:17 -0600 Subject: [PATCH 09/40] refact: Handle temporary directories entirely within core (#754) * refactor: Handle temporary directories entirely within core * fix (xtask): Handle modified tablist struct * refactor (xtask): Apply Clippy suggested changes * Fix size_bypass --------- Co-authored-by: Chris Titus --- core/src/inner.rs | 39 +++++++++++++++++++++++++++++++++------ core/src/lib.rs | 2 +- tui/src/state.rs | 10 +++------- xtask/src/docgen.rs | 24 +++++++++++------------- 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/core/src/inner.rs b/core/src/inner.rs index ed810b06..9d2e7162 100644 --- a/core/src/inner.rs +++ b/core/src/inner.rs @@ -1,6 +1,7 @@ use std::{ fs::File, io::{BufRead, BufReader, Read}, + ops::{Deref, DerefMut}, os::unix::fs::PermissionsExt, path::{Path, PathBuf}, rc::Rc, @@ -14,8 +15,34 @@ use temp_dir::TempDir; const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs"); -pub fn get_tabs(validate: bool) -> (TempDir, Vec) { - let (temp_dir, tab_files) = TabList::get_tabs(); +// Allow the unused TempDir to be stored for later destructor call +#[allow(dead_code)] +pub struct TabList(pub Vec, TempDir); + +// Implement deref to allow Vec methods to be called on TabList +impl Deref for TabList { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl DerefMut for TabList { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl IntoIterator for TabList { + type Item = Tab; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.0.into_iter() + } +} + +pub fn get_tabs(validate: bool) -> TabList { + let (temp_dir, tab_files) = TabDirectories::get_tabs(); let tabs: Vec<_> = tab_files .into_iter() @@ -50,11 +77,11 @@ pub fn get_tabs(validate: bool) -> (TempDir, Vec) { if tabs.is_empty() { panic!("No tabs found"); } - (temp_dir, tabs) + TabList(tabs, temp_dir) } #[derive(Deserialize)] -struct TabList { +struct TabDirectories { directories: Vec, } @@ -246,9 +273,9 @@ fn is_executable(path: &Path) -> bool { .unwrap_or(false) } -impl TabList { +impl TabDirectories { fn get_tabs() -> (TempDir, Vec) { - let temp_dir = TempDir::new().unwrap(); + let temp_dir = TempDir::with_prefix("linutil_scripts").unwrap(); TAB_DATA .extract(&temp_dir) .expect("Failed to extract the saved directory"); diff --git a/core/src/lib.rs b/core/src/lib.rs index 4e795dd3..891d8e84 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -5,7 +5,7 @@ use std::rc::Rc; use ego_tree::Tree; use std::path::PathBuf; -pub use inner::get_tabs; +pub use inner::{get_tabs, TabList}; #[derive(Clone, Hash, Eq, PartialEq)] pub enum Command { diff --git a/tui/src/state.rs b/tui/src/state.rs index 2e3933fb..49727258 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -9,7 +9,7 @@ use crate::{ }; use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers}; use ego_tree::NodeId; -use linutil_core::{ListNode, Tab}; +use linutil_core::{ListNode, TabList}; #[cfg(feature = "tips")] use rand::Rng; use ratatui::{ @@ -20,7 +20,6 @@ use ratatui::{ Frame, }; use std::rc::Rc; -use temp_dir::TempDir; const MIN_WIDTH: u16 = 100; const MIN_HEIGHT: u16 = 25; @@ -40,14 +39,12 @@ P* - privileged * "; pub struct AppState { - /// This must be passed to retain the temp dir until the end of the program - _temp_dir: TempDir, /// Selected theme theme: Theme, /// Currently focused area pub focus: Focus, /// List of tabs - tabs: Vec, + tabs: TabList, /// Current tab current_tab: ListState, /// This stack keeps track of our "current directory". You can think of it as `pwd`. but not @@ -88,11 +85,10 @@ enum SelectedItem { impl AppState { pub fn new(theme: Theme, override_validation: bool, size_bypass: bool) -> Self { - let (temp_dir, tabs) = linutil_core::get_tabs(!override_validation); + let tabs = linutil_core::get_tabs(!override_validation); let root_id = tabs[0].tree.root().id(); let mut state = Self { - _temp_dir: temp_dir, theme, focus: Focus::List, tabs, diff --git a/xtask/src/docgen.rs b/xtask/src/docgen.rs index 992b83aa..385c1134 100644 --- a/xtask/src/docgen.rs +++ b/xtask/src/docgen.rs @@ -11,7 +11,7 @@ pub fn userguide() -> Result { let mut md = String::new(); md.push_str("\n# Walkthrough\n"); - let tabs = linutil_core::get_tabs(false).1; + let tabs = linutil_core::get_tabs(false); for tab in tabs { #[cfg(debug_assertions)] @@ -24,7 +24,7 @@ pub fn userguide() -> Result { #[cfg(debug_assertions)] println!(" Directory: {}", entry.name); - if entry.name != "root".to_string() { + if entry.name != "root" { md.push_str(&format!("\n### {}\n\n", entry.name)); } @@ -36,18 +36,16 @@ pub fn userguide() -> Result { current_dir )); } */ // Commenting this for now, might be a good idea later - } else { - if !entry.description.is_empty() { - #[cfg(debug_assertions)] - println!(" Entry: {}", entry.name); - #[cfg(debug_assertions)] - println!(" Description: {}", entry.description); + } else if !entry.description.is_empty() { + #[cfg(debug_assertions)] + println!(" Entry: {}", entry.name); + #[cfg(debug_assertions)] + println!(" Description: {}", entry.description); - md.push_str(&format!("- **{}**: {}\n", entry.name, entry.description)); - } /* else { - md.push_str(&format!("- **{}**\n", entry.name)); - } */ // https://github.com/ChrisTitusTech/linutil/pull/753 - } + md.push_str(&format!("- **{}**: {}\n", entry.name, entry.description)); + } /* else { + md.push_str(&format!("- **{}**\n", entry.name)); + } */ // https://github.com/ChrisTitusTech/linutil/pull/753 } } From f2a1766289145aae169e8230991c9828264ff655 Mon Sep 17 00:00:00 2001 From: Albert de Palo Hardvendel <71041549+Albert-LGTM@users.noreply.github.com> Date: Wed, 6 Nov 2024 23:03:50 +0100 Subject: [PATCH 10/40] Added support for installing podman (#787) * Added support for installing podman * removed llm comment * Added podman to userguide * Added support for install pythona and pip in case of missing. changed pip install to rootless install * changed installing podman-compose with pip to packagemanager * Update core/tabs/applications-setup/podman-setup.sh Only install Podman if it is not installed already. Co-authored-by: nyx * Update core/tabs/applications-setup/podman-setup.sh Only install podman-compose if it is not installed already. Co-authored-by: nyx * added podman-compose install option * split podman install into podman and podman-compose * Update core/tabs/applications-setup/podman-setup.sh Co-authored-by: nyx * Update core/tabs/applications-setup/podman-setup.sh Co-authored-by: nyx * Update core/tabs/applications-setup/podman-compose-setup.sh Co-authored-by: nyx * Update core/tabs/applications-setup/podman-compose-setup.sh Co-authored-by: nyx * Update core/tabs/applications-setup/podman-compose-setup.sh Removed redundant quotes Co-authored-by: JEEVITHA KANNAN K S * Update core/tabs/applications-setup/podman-setup.sh Removed redundant quotes Co-authored-by: JEEVITHA KANNAN K S --------- Co-authored-by: nyx Co-authored-by: JEEVITHA KANNAN K S Co-authored-by: Chris Titus --- .../podman-compose-setup.sh | 33 +++++++++++++++++++ core/tabs/applications-setup/podman-setup.sh | 33 +++++++++++++++++++ core/tabs/applications-setup/tab_data.toml | 12 +++++++ docs/userguide.md | 3 ++ 4 files changed, 81 insertions(+) create mode 100644 core/tabs/applications-setup/podman-compose-setup.sh create mode 100644 core/tabs/applications-setup/podman-setup.sh diff --git a/core/tabs/applications-setup/podman-compose-setup.sh b/core/tabs/applications-setup/podman-compose-setup.sh new file mode 100644 index 00000000..02db3ed7 --- /dev/null +++ b/core/tabs/applications-setup/podman-compose-setup.sh @@ -0,0 +1,33 @@ +#!/bin/sh -e + +. ../common-script.sh + +installPodmanCompose() { + if ! command_exists podman-compose; then + printf "%b\n" "${YELLOW}Installing Podman Compose...${RC}" + case "$PACKAGER" in + apt-get|nala) + "$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose + ;; + zypper) + "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install podman-compose + ;; + pacman) + "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed podman-compose + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" + exit 1 + ;; + esac + else + printf "%b\n" "${GREEN}Podman Compose is already installed.${RC}" + fi +} + +checkEnv +checkEscalationTool +installPodmanCompose diff --git a/core/tabs/applications-setup/podman-setup.sh b/core/tabs/applications-setup/podman-setup.sh new file mode 100644 index 00000000..07a0b5f6 --- /dev/null +++ b/core/tabs/applications-setup/podman-setup.sh @@ -0,0 +1,33 @@ +#!/bin/sh -e + +. ../common-script.sh + +installPodman() { + if ! command_exists podman; then + printf "%b\n" "${YELLOW}Installing Podman...${RC}" + case "$PACKAGER" in + apt-get|nala) + "$ESCALATION_TOOL" "$PACKAGER" install -y podman + ;; + zypper) + "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install podman + ;; + pacman) + "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed podman + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y podman + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" + exit 1 + ;; + esac + else + printf "%b\n" "${GREEN}Podman is already installed.${RC}" + fi +} + +checkEnv +checkEscalationTool +installPodman diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml index dce7fa79..20233a92 100644 --- a/core/tabs/applications-setup/tab_data.toml +++ b/core/tabs/applications-setup/tab_data.toml @@ -228,6 +228,18 @@ description = "Docker is an open platform that uses OS-level virtualization to d script = "docker-setup.sh" task_list = "I SS" +[[data]] +name = "Podman" +description = "Podman is a daemon-less open platform that uses OS-level virtualization to deliver software in packages called containers." +script = "podman-setup.sh" +task_list = "I SS" + +[[data]] +name = "Podman-compose" +description = "Podman Compose is a tool for defining and running multi-container applications using Podman." +script = "podman-compose-setup.sh" +task_list = "I SS" + [[data]] name = "DWM-Titus" description = "DWM is a dynamic window manager for X.\nIt manages windows in tiled, monocle and floating layouts.\nAll of the layouts can be applied dynamically, optimising the environment for the application in use and the task performed.\nThis command installs and configures DWM and a desktop manager.\nThe list of patches applied can be found in CTT's DWM repository\nhttps://github.com/ChrisTitusTech/dwm-titus" diff --git a/docs/userguide.md b/docs/userguide.md index e3f50c81..d845e67f 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -56,6 +56,9 @@ All of the layouts can be applied dynamically, optimising the environment for th 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 d1a1812709f1cf4133d2d610df8a9e4ea07f1dbb Mon Sep 17 00:00:00 2001 From: leventbesli Date: Thu, 7 Nov 2024 01:05:26 +0300 Subject: [PATCH 11/40] feat: btrfs assistant & grub-btrfs (#789) * Btrfs Assistant(+snapper), grub-btrfs Setup added Adds fedora-btrfs-assistant.sh, updates tab_data and documentation. * updated doc, ta_data and sh * enable grub-btrfsd service added * updated some wording in notices. * updated wording and add prompts for actions * added fix for a possible grub error also some more enhancements and wording improvements. * user action removed reinstall snapper action removed because removing and reinstalling snapper is a very unlikely action. and also snapper can't handle ./snapsots folder in the disk after reinstalling: "creating btrfs subvolume .snapshots failed since it already exists". * firs snapshot order changed home snapshot taken first because it's config can be saved to first root snapshot. * better explanations in user prompts * improved y/n loop * formatting improvements * formatting improvement Co-authored-by: Adam Perkowski * formatting improvement Co-authored-by: Adam Perkowski * Update task list Co-authored-by: Adam Perkowski * removed a inline comment Co-authored-by: Adam Perkowski * removed an unnececary inline comment Co-authored-by: Adam Perkowski * removed an unnececary inline comment Co-authored-by: Adam Perkowski * improved sed -i Co-authored-by: Adam Perkowski * improved sed -i Co-authored-by: Adam Perkowski * improved sed -i Co-authored-by: Adam Perkowski * newlines removed from tab_data.toml Co-authored-by: Nyx * btrfs detection moved to toml Co-authored-by: Nyx * data.preconditions added - escalation tool used * $PACKAGER replaced with dnf * re-added packager Co-authored-by: Adam Perkowski * re-added packager Co-authored-by: Adam Perkowski * usergide updated with docgen * typo fix --------- Co-authored-by: Adam Perkowski Co-authored-by: Nyx --- .../fedora/fedora-btrfs-assistant.sh | 168 ++++++++++++++++++ core/tabs/system-setup/tab_data.toml | 11 ++ docs/userguide.md | 1 + 3 files changed, 180 insertions(+) create mode 100644 core/tabs/system-setup/fedora/fedora-btrfs-assistant.sh diff --git a/core/tabs/system-setup/fedora/fedora-btrfs-assistant.sh b/core/tabs/system-setup/fedora/fedora-btrfs-assistant.sh new file mode 100644 index 00000000..1d5dc2ff --- /dev/null +++ b/core/tabs/system-setup/fedora/fedora-btrfs-assistant.sh @@ -0,0 +1,168 @@ +#!/bin/sh -e + +. ../../common-script.sh + +# This script automates the installation and root and home snapshot configuration of Snapper and installs Grub-Btrfs on Fedora. +# Also installs python3-dnf-plugin-snapper package for automatic snapshots after dnf commands. + +# Install Btrfs-Assistant/snapper and dependencies +installBtrfsStack() { + if ! command_exists btrfs-assistant; then + printf "%b\n" "${YELLOW}==========================================${RC}" + printf "%b\n" "${YELLOW}Installing Btrfs Assistant with snapper...${RC}" + printf "%b\n" "${YELLOW}==========================================${RC}" + case "$PACKAGER" in + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y btrfs-assistant python3-dnf-plugin-snapper + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + exit 1 + ;; + esac + else + printf "%b\n" "${GREEN}Btrfs Assistant is already installed.${RC}" + fi +} + +# Create first snapper config for root and home and create new manual snapshots +configureSnapper() { + printf "%b\n" "${YELLOW}===========================================================================${RC}" + printf "%b\n" "${YELLOW}Creating snapper root(/) and /home config and taking the first snapshots...${RC}" + printf "%b\n" "${YELLOW}===========================================================================${RC}" + "$ESCALATION_TOOL" snapper -c home create-config /home && "$ESCALATION_TOOL" snapper -c home create --description "First home Snapshot" + "$ESCALATION_TOOL" snapper -c root create-config / && "$ESCALATION_TOOL" snapper -c root create --description "First root Snapshot" + printf "%b\n" "${YELLOW}Updating timeline settings...${RC}" + # Modifyling default timeline root config + "$ESCALATION_TOOL" sed -i'' ' + s/^TIMELINE_LIMIT_HOURLY="[^"]*"/TIMELINE_LIMIT_HOURLY="1"/; + s/^TIMELINE_LIMIT_DAILY="[^"]*"/TIMELINE_LIMIT_DAILY="2"/; + s/^TIMELINE_LIMIT_WEEKLY="[^"]*"/TIMELINE_LIMIT_WEEKLY="1"/; + s/^TIMELINE_LIMIT_MONTHLY="[^"]*"/TIMELINE_LIMIT_MONTHLY="0"/; + s/^TIMELINE_LIMIT_YEARLY="[^"]*"/TIMELINE_LIMIT_YEARLY="0"/ + ' /etc/snapper/configs/root + # Modifyling default timeline for home config + "$ESCALATION_TOOL" sed -i'' ' + s/^TIMELINE_LIMIT_HOURLY="[^"]*"/TIMELINE_LIMIT_HOURLY="2"/; + s/^TIMELINE_LIMIT_DAILY="[^"]*"/TIMELINE_LIMIT_DAILY="1"/; + s/^TIMELINE_LIMIT_WEEKLY="[^"]*"/TIMELINE_LIMIT_WEEKLY="0"/; + s/^TIMELINE_LIMIT_MONTHLY="[^"]*"/TIMELINE_LIMIT_MONTHLY="1"/; + s/^TIMELINE_LIMIT_YEARLY="[^"]*"/TIMELINE_LIMIT_YEARLY="0"/ + ' /etc/snapper/configs/home + printf "%b\n" "${GREEN}Snapper configs and first snapshots created.${RC}" +} + +# Starting services +serviceStartEnable() { + printf "%b\n" "${YELLOW}==================================================================================${RC}" + printf "%b\n" "${YELLOW}Starting and enabling snapper-timeline.timer and snapper-cleanup.timer services...${RC}" + printf "%b\n" "${YELLOW}==================================================================================${RC}" + "$ESCALATION_TOOL" systemctl enable --now snapper-timeline.timer + "$ESCALATION_TOOL" systemctl enable --now snapper-cleanup.timer + printf "%b\n" "${GREEN}Snapper services started and enabled.${RC}" +} + +# Ask user if they want to install grub-btrfs +askInstallGrubBtrfs() { + printf "%b\n" "${YELLOW}=====================================${RC}" + printf "%b\n" "${YELLOW}(optional) grub-btrfs installation...${RC}" + printf "%b\n" "${YELLOW}=====================================${RC}" + printf "%b\n" "${YELLOW}You can skip installing grub-btrfs and use only Btrfs Assistant GUI or snapper CLI.${RC}" + printf "%b\n" "${CYAN}Notice: grub-btrfs may cause problems with booting into snapshots and other OSes on systems with secure boot/tpm. You will be asked to apply mitigation for this issue in next step.${RC}" + + while true; do + printf "%b" "${YELLOW}Do you want to install grub-btrfs? Press (y) for yes, (n) for no, (f) to apply tpm mitigation to already installed grub-btrfs: ${RC}" + read -r response + case "$response" in + [yY]*) + installGrubBtrfs + break + ;; + [nN]*) + printf "%b\n" "${GREEN}Skipping grub-btrfs installation.${RC}" + break + ;; + [fF]*) + mitigateTpmError + break + ;; + *) + printf "%b\n" "${RED}Invalid input. Please enter 'y' for yes, 'n' for no, or (f) to apply tpm mitigation to already installed grub-btrfs.${RC}" + ;; + esac + done +} + +# Install grub-btrfs +installGrubBtrfs() { + # Check if the grub-btrfs dir exists before attempting to clone into it. + printf "%b\n" "${YELLOW}Downloading grub-btrfs and installing dependencies...${RC}" + if [ -d "$HOME/grub-btrfs" ]; then + rm -rf "$HOME/grub-btrfs" + fi + "$ESCALATION_TOOL" "$PACKAGER" install -y make git inotify-tools + cd "$HOME" && git clone https://github.com/Antynea/grub-btrfs + printf "%b\n" "${YELLOW}Installing grub-btrfs...${RC}" + cd "$HOME/grub-btrfs" + printf "%b\n" "${YELLOW}Modifying grub-btrfs configuration for Fedora...${RC}" + sed -i'' '/#GRUB_BTRFS_SNAPSHOT_KERNEL/a GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="systemd.volatile=state"' config + sed -i'' '/#GRUB_BTRFS_GRUB_DIRNAME/a GRUB_BTRFS_GRUB_DIRNAME="/boot/grub2"' config + sed -i'' '/#GRUB_BTRFS_MKCONFIG=/a GRUB_BTRFS_MKCONFIG=/sbin/grub2-mkconfig' config + sed -i'' '/#GRUB_BTRFS_SCRIPT_CHECK=/a GRUB_BTRFS_SCRIPT_CHECK=grub2-script-check' config + "$ESCALATION_TOOL" make install + printf "%b\n" "${YELLOW}Updating grub configuration and enabling grub-btrfsd service...${RC}" + "$ESCALATION_TOOL" grub2-mkconfig -o /boot/grub2/grub.cfg && "$ESCALATION_TOOL" systemctl enable --now grub-btrfsd.service + printf "%b\n" "${YELLOW}Cleaning up installation files...${RC}" + cd .. && rm -rf "$HOME/grub-btrfs" + printf "%b\n" "${GREEN}Grub-btrfs installed and service enabled.${RC}" + printf "%b\n" "${CYAN}Notice: To perform a system recovery via grub-btrfs, perform a restore operation with Btrfs Assistant GUI after booting into the snapshot.${RC}" + mitigateTpmError +} + +mitigateTpmError() { + printf "%b\n" "${YELLOW}===============================================${RC}" + printf "%b\n" "${YELLOW}Mitigation for 'tpm.c:150:unknown TPM error'...${RC}" + printf "%b\n" "${YELLOW}===============================================${RC}" + printf "%b\n" "${YELLOW}Some systems with secure boot/tpm may encounter 'tpm.c:150:unknown TPM error' when booting into snapshots.${RC}" + printf "%b\n" "${YELLOW}If you encounter this issue, you can come back later and apply this mitigation or you can apply it now.${RC}" + while true; do + printf "%b\n" "${YELLOW}Do you want to apply the TPM error mitigation? (y/n): ${RC}" + read -r response + case "$response" in + [yY]*) + printf "%b\n" "${YELLOW}Creating /etc/grub.d/02_tpm file...${RC}" + echo '#!/bin/sh' | "$ESCALATION_TOOL" tee /etc/grub.d/02_tpm > /dev/null + echo 'echo "rmmod tpm"' | "$ESCALATION_TOOL" tee -a /etc/grub.d/02_tpm > /dev/null + "$ESCALATION_TOOL" chmod +x /etc/grub.d/02_tpm # makes the file executable + "$ESCALATION_TOOL" grub2-mkconfig -o /boot/grub2/grub.cfg # updates grub config + printf "%b\n" "${GREEN}Mitigation applied and grub config updated.${RC}" + break + ;; + [nN]*) + printf "%b\n" "${GREEN}Skipping TPM error mitigation.${RC}" + break + ;; + *) + printf "%b\n" "${RED}Invalid input. Please enter 'y' for yes or 'n' for no.${RC}" + ;; + esac + done +} + +# Post install information +someNotices() { + printf "%b\n" "${YELLOW}================================NOTICES================================${RC}" + printf "%b\n" "${YELLOW}Notice: You can manage snapshots from GUI with Btrfs Assistant or CLI with snapper.${RC}" + printf "%b\n" "${YELLOW}Notice: You may change (Hourly, daily, weekly, monthly, yearly) timeline settings with Btrfs Assistant GUI.${RC}" + printf "%b\n" "${RED}Notice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately...${RC}" + printf "%b\n" "${YELLOW}================================NOTICES================================${RC}" + printf "%b\n" "${GREEN}Setup process completed.${RC}" +} + +checkEnv +checkEscalationTool +installBtrfsStack +configureSnapper +serviceStartEnable +askInstallGrubBtrfs +someNotices diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 2c439cab..7465ab83 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -71,6 +71,17 @@ description = "Enables Virtualization through dnf" script = "fedora/virtualization.sh" task_list = "I" +[[data.entries]] +name = "Btrfs Assistant, Snapper Config, grub-btrfs" +description = "Installs Btrfs Assistant, Snapper, dnf snapper plugin and takes the first root(/) and /home snapshots. Enables snapper-timeline and snapper-cleanup services. Installs Grub-Btrfs. Notice: To perform a system recovery via grub-btrfs, perform a restore operation with Btrfs Assistant GUI after booting into the snapshot. Notice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately." +script = "fedora/fedora-btrfs-assistant.sh" +task_list = "I PFM SS" + +[[data.preconditions]] +matches = true +data = "command_exists" +values = [ "btrfs" ] + [[data]] name = "Build Prerequisites" description = "This script is designed to handle the installation of various software dependencies across different Linux distributions" diff --git a/docs/userguide.md b/docs/userguide.md index d845e67f..261597a7 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -97,6 +97,7 @@ https://github.com/ChrisTitusTech/dwm-titus - **RPM Fusion**: RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit. For more information visit: https://rpmfusion.org/ - **Upgrade to a New Fedora Release**: Upgrades system to the next Fedora release - **Virtualization**: Enables Virtualization through dnf +- **Btrfs Assistant, Snapper Config, grub-btrfs**: Installs Btrfs Assistant, Snapper, dnf snapper plugin and takes the first root(/) and /home snapshots. Enables snapper-timeline and snapper-cleanup services. Installs Grub-Btrfs. Notice: To perform a system recovery via grub-btrfs, perform a restore operation with Btrfs Assistant GUI after booting into the snapshot. Notice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately. - **Build Prerequisites**: This script is designed to handle the installation of various software dependencies across different Linux distributions - **Full System Cleanup**: This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash. - **Full System Update**: This command updates your system to the latest packages available for your distro From 1234edd466b0e3d440175a98cab1b81bce44aa9a Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 7 Nov 2024 03:41:31 +0530 Subject: [PATCH 12/40] Change numlock description (#790) --- core/tabs/utils/numlock.sh | 7 ------- core/tabs/utils/tab_data.toml | 2 +- docs/userguide.md | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/core/tabs/utils/numlock.sh b/core/tabs/utils/numlock.sh index 742ceeb7..f80ba3fb 100755 --- a/core/tabs/utils/numlock.sh +++ b/core/tabs/utils/numlock.sh @@ -2,11 +2,6 @@ . ../common-script.sh -# setleds can be used in all distros -# This method works by calling a script using systemd service - -# Create a script to toggle numlock - create_file() { printf "%b\n" "Creating script..." "$ESCALATION_TOOL" tee "/usr/local/bin/numlock" >/dev/null <<'EOF' @@ -21,7 +16,6 @@ EOF "$ESCALATION_TOOL" chmod +x /usr/local/bin/numlock } -# Create a systemd service to run the script on boot create_service() { printf "%b\n" "Creating service..." "$ESCALATION_TOOL" tee "/etc/systemd/system/numlock.service" >/dev/null <<'EOF' @@ -39,7 +33,6 @@ EOF } numlockSetup() { - # Check if the script and service files exists if [ ! -f "/usr/local/bin/numlock" ]; then create_file fi diff --git a/core/tabs/utils/tab_data.toml b/core/tabs/utils/tab_data.toml index a0f6d50e..56ade826 100644 --- a/core/tabs/utils/tab_data.toml +++ b/core/tabs/utils/tab_data.toml @@ -136,7 +136,7 @@ task_list = "I FM" [[data]] name = "Numlock on Startup" -description = "This utility is designed to configure auto enabling of numlock on boot" +description = "This utility is designed to enable Num Lock at boot, rather than within desktop environments like KDE or GNOME" script = "numlock.sh" task_list = "PFM SS" diff --git a/docs/userguide.md b/docs/userguide.md index 261597a7..347f0ec3 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -128,7 +128,7 @@ https://github.com/ChrisTitusTech/dwm-titus - **Auto Mount Drive**: This utility is designed to help with automating the process of mounting a drive on to your system. - **Bluetooth Manager**: This utility is designed to manage bluetooth in your system -- **Numlock on Startup**: This utility is designed to configure auto enabling of numlock on boot +- **Numlock on Startup**: This utility is designed to enable Num Lock at boot, rather than within desktop environments like KDE or GNOME - **Ollama**: This utility is designed to manage ollama in your system - **Service Manager**: This utility is designed to manage services in your system - **WiFi Manager**: This utility is designed to manage wifi in your system From 9d1dc35f43d2a159ef2a5e142b78f386e49ef7d5 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Wed, 6 Nov 2024 23:20:16 +0100 Subject: [PATCH 13/40] =?UTF-8?q?=F0=9F=93=83=20feat:=20Linux=20Neptune=20?= =?UTF-8?q?(Valve's=20kernel=20for=20SteamDeck)=20installation=20(#683)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Linux Neptune installation script * fixed some stuff that's not supposed to be here Co-authored-by: nnyyxxxx * fix repo check * added audio patches https://github.com/ChrisTitusTech/linutil/issues/269#issuecomment-2380379049 * add linux neptune to docs (userguide) * steamdeck precondition Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com> * precondition fix * another precondition fix --------- Co-authored-by: nnyyxxxx Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com> Co-authored-by: Chris Titus --- core/tabs/system-setup/arch/linux-neptune.sh | 60 ++++++++++++++++++++ core/tabs/system-setup/tab_data.toml | 11 ++++ docs/userguide.md | 1 + tui/src/state.rs | 1 + 4 files changed, 73 insertions(+) create mode 100755 core/tabs/system-setup/arch/linux-neptune.sh diff --git a/core/tabs/system-setup/arch/linux-neptune.sh b/core/tabs/system-setup/arch/linux-neptune.sh new file mode 100755 index 00000000..30d4b134 --- /dev/null +++ b/core/tabs/system-setup/arch/linux-neptune.sh @@ -0,0 +1,60 @@ +#!/bin/sh -e + +. ../../common-script.sh + +setUpRepos() { + if ! grep -q "^\s*\[jupiter-staging\]" /etc/pacman.conf; then + printf "%b\n" "${CYAN}Adding jupiter-staging to pacman repositories...${RC}" + echo "[jupiter-staging]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf + echo "Server = https://steamdeck-packages.steamos.cloud/archlinux-mirror/\$repo/os/\$arch" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf + echo "SigLevel = Never" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf + fi + if ! grep -q "^\s*\[holo-staging\]" /etc/pacman.conf; then + printf "%b\n" "${CYAN}Adding holo-staging to pacman repositories...${RC}" + echo "[holo-staging]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf + echo "Server = https://steamdeck-packages.steamos.cloud/archlinux-mirror/\$repo/os/\$arch" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf + echo "SigLevel = Never" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf + fi +} + +installKernel() { + if ! "$PACKAGER" -Q | grep -q "\blinux-neptune"; then + printf "%b\n" "${CYAN}Installing linux-neptune..." + "$ESCALATION_TOOL" "$PACKAGER" -Syyu --noconfirm + "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm linux-neptune linux-neptune-headers steamdeck-dsp jupiter-staging/alsa-ucm-conf + "$ESCALATION_TOOL" mkinitcpio -P + else + printf "%b\n" "${GREEN}linux-neptune detected. Skipping installation.${RC}" + fi + + if [ -f /etc/default/grub ]; then + printf "%b\n" "${CYAN}Updating GRUB...${RC}" + if ! grep -q '^UPDATEDEFAULT=' /etc/default/grub; then + echo 'UPDATEDEFAULT=yes' | "$ESCALATION_TOOL" tee -a /etc/default/grub + else + "$ESCALATION_TOOL" sed -i 's/^UPDATEDEFAULT=.*/UPDATEDEFAULT=yes/' /etc/default/grub + fi + if [ -f /boot/grub/grub.cfg ]; then + "$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg + else + printf "%b\n" "${RED}GRUB configuration file not found. Run grub-mkconfig manually.${RC}" + fi + else + printf "%b\n" "${RED}GRUB not detected. Manually set your bootloader to use linux-neptune.${RC}" + fi +} + +copyFirmwareFiles() { + printf "%b\n" "${CYAN}Copying firmware files...${RC}" + "$ESCALATION_TOOL" mkdir -p /usr/lib/firmware/cirrus + "$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-cali.bin /usr/lib/firmware/cirrus/ + "$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-cali.wmfw /usr/lib/firmware/cirrus/ + "$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-prot.bin /usr/lib/firmware/cirrus/ + "$ESCALATION_TOOL" cp /usr/lib/firmware/cs35l41-dsp1-spk-prot.wmfw /usr/lib/firmware/cirrus/ +} + +checkEnv +checkEscalationTool +setUpRepos +installKernel +copyFirmwareFiles diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 7465ab83..74f7f1d7 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -15,6 +15,17 @@ script = "arch/server-setup.sh" task_list = "SI D" multi_select = false +[[data.entries]] +name ="Linux Neptune for SteamDeck" +description = "Valve's fork of Linux Kernel for the SteamDeck" +script = "arch/linux-neptune.sh" +task_list = "I PFM K" + +[[data.entries.preconditions]] +matches = true +data = { file = "/sys/devices/virtual/dmi/id/board_vendor" } +values = [ "Valve" ] + [[data.entries]] name = "Paru AUR Helper" description = "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" diff --git a/docs/userguide.md b/docs/userguide.md index 347f0ec3..48bd9973 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -86,6 +86,7 @@ https://github.com/ChrisTitusTech/dwm-titus ### Arch Linux - **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes. +- **Linux Neptune for SteamDeck**: Valve's fork of Linux Kernel for the SteamDeck - **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 - **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 diff --git a/tui/src/state.rs b/tui/src/state.rs index 49727258..ac584070 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -30,6 +30,7 @@ D - disk modifications (ex. partitioning) (privileged) FI - flatpak installation FM - file modification I - installation (privileged) +K - kernel modifications (privileged) MP - package manager actions SI - full system installation SS - systemd actions (privileged) From 98e2f83f43bf6c96286b11634bb3dc4a90330207 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 7 Nov 2024 03:58:36 +0530 Subject: [PATCH 14/40] feat: Add arch nvidia installation script (#797) * Add arch nvidia script * Update model fetching * chore: formatting, git as dep --------- Co-authored-by: Chris Titus --- core/tabs/system-setup/arch/nvidia-drivers.sh | 120 ++++++++++++++++++ core/tabs/system-setup/tab_data.toml | 6 + docs/userguide.md | 1 + 3 files changed, 127 insertions(+) create mode 100755 core/tabs/system-setup/arch/nvidia-drivers.sh diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh new file mode 100755 index 00000000..7d696aec --- /dev/null +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -0,0 +1,120 @@ +#!/bin/sh -e + +. ../../common-script.sh + +LIBVA_DIR="$HOME/.local/share/linutil/libva" +MPV_CONF="$HOME/.config/mpv/mpv.conf" + +installDeps() { + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel dkms ninja meson git + + 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 +} + +checkNvidiaHardware() { + # Refer https://nouveau.freedesktop.org/CodeNames.html for model code names + model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep NVIDIA | sed 's/.*Corporation //;s/ .*//' | cut -c 1-2) + case "$model" in + GM | GP | GV) return 1 ;; + TU | GA | AD) return 0 ;; + *) printf "%b\n" "${RED}Unsupported hardware." && exit 1 ;; + esac +} + +checkIntelHardware() { + model=$(grep "model name" /proc/cpuinfo | head -n 1 | cut -d ':' -f 2 | cut -c 2-3) + [ "$model" -ge 11 ] +} + +promptUser() { + printf "%b" "Do you want to $1 ? [y/N]:" + read -r confirm + [ "$confirm" = "y" ] || [ "$confirm" = "Y" ] +} + +setKernelParam() { + PARAMETER="$1" + + if grep -q "$PARAMETER" /etc/default/grub; then + printf "%b\n" "${YELLOW}NVIDIA modesetting is already enabled in GRUB.${RC}" + else + "$ESCALATION_TOOL" sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"$/ $PARAMETER\"/" /etc/default/grub + printf "%b\n" "${CYAN}Added $PARAMETER to /etc/default/grub.${RC}" + "$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg + fi +} + +setupHardwareAcceleration() { + if ! command_exists grub-mkconfig; then + printf "%b\n" "${RED}Currently hardware acceleration is only available with GRUB.${RC}" + return + fi + + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver + + mkdir -p "$HOME/.local/share/linutil" + if [ -d "$LIBVA_DIR" ]; then + rm -rf "$LIBVA_DIR" + fi + + printf "%b\n" "${YELLOW}Cloning libva from https://github.com/intel/libva in ${LIBVA_DIR}${RC}" + git clone --branch=v2.22-branch --depth=1 https://github.com/intel/libva "$LIBVA_DIR" + + mkdir -p "$LIBVA_DIR/build" + cd "$LIBVA_DIR/build" && arch-meson .. -Dwith_legacy=nvctrl && ninja + "$ESCALATION_TOOL" ninja install + + "$ESCALATION_TOOL" sed -i '/^MOZ_DISABLE_RDD_SANDBOX/d' "/etc/environment" + "$ESCALATION_TOOL" sed -i '/^LIBVA_DRIVER_NAME/d' "/etc/environment" + + printf "LIBVA_DRIVER_NAME=nvidia\nMOZ_DISABLE_RDD_SANDBOX=1" | "$ESCALATION_TOOL" tee -a /etc/environment >/dev/null + + printf "%b\n" "${GREEN}Hardware Acceleration setup completed successfully.${RC}" + + if promptUser "enable Hardware Acceleration in MPV player"; then + mkdir -p "$HOME/.config/mpv" + if [ -f "$MPV_CONF" ]; then + sed -i '/^hwdec/d' "$MPV_CONF" + fi + printf "hwdec=auto" | tee -a "$MPV_CONF" >/dev/null + printf "%b\n" "${GREEN}MPV Hardware Acceleration enabled successfully.${RC}" + fi +} + +installDriver() { + # Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection + if checkNvidiaHardware && promptUser "install nvidia's open source drivers"; then + printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}" + installDeps + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-open-dkms nvidia-utils + else + printf "%b\n" "${YELLOW}Installing nvidia proprietary driver...${RC}" + installDeps + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms nvidia-utils + fi + + if checkIntelHardware; then + setKernelParam "ibt=off" + fi + + # Refer https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend + setKernelParam "nvidia.NVreg_PreserveVideoMemoryAllocations=1" + "$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service + + printf "%b\n" "${GREEN}Driver installed successfully.${RC}" + if promptUser "setup Hardware Acceleration"; then + setupHardwareAcceleration + fi + + printf "%b\n" "${GREEN}Please reboot your system for the changes to take effect.${RC}" +} + +checkEnv +checkEscalationTool +installDriver diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 74f7f1d7..abdab9bd 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -26,6 +26,12 @@ matches = true data = { file = "/sys/devices/virtual/dmi/id/board_vendor" } values = [ "Valve" ] +[[data.entries]] +name = "Nvidia Drivers && Hardware Acceleration" +description = "This script installs and configures nvidia drivers with Hardware Acceleration." +script = "arch/nvidia-drivers.sh" +task_list = "I FM SS" + [[data.entries]] name = "Paru AUR Helper" description = "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" diff --git a/docs/userguide.md b/docs/userguide.md index 48bd9973..bd1649e4 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -87,6 +87,7 @@ https://github.com/ChrisTitusTech/dwm-titus - **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes. - **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 - **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 From 176b19d6925050d1e9a34edc3e5d576040afa358 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 7 Nov 2024 03:59:52 +0530 Subject: [PATCH 15/40] Use ratatui bundled crossterm (#805) --- Cargo.lock | 1 - tui/Cargo.toml | 1 - tui/src/confirmation.rs | 2 +- tui/src/filter.rs | 2 +- tui/src/float.rs | 2 +- tui/src/floating_text.rs | 3 +-- tui/src/main.rs | 16 ++++++++++------ tui/src/running_command.rs | 2 +- tui/src/state.rs | 2 +- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6f5151f..094a02ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -435,7 +435,6 @@ dependencies = [ "ansi-to-tui", "anstyle", "clap", - "crossterm", "ego-tree", "linutil_core", "oneshot", diff --git a/tui/Cargo.toml b/tui/Cargo.toml index b411fb2d..baa0d995 100644 --- a/tui/Cargo.toml +++ b/tui/Cargo.toml @@ -15,7 +15,6 @@ tips = ["rand"] [dependencies] clap = { version = "4.5.20", features = ["derive"] } -crossterm = "0.28.1" ego-tree = { workspace = true } oneshot = "0.1.8" portable-pty = "0.8.1" diff --git a/tui/src/confirmation.rs b/tui/src/confirmation.rs index 91d86c28..96ab06ca 100644 --- a/tui/src/confirmation.rs +++ b/tui/src/confirmation.rs @@ -2,8 +2,8 @@ use std::borrow::Cow; use crate::{float::FloatContent, hint::Shortcut}; -use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ + crossterm::event::{KeyCode, KeyEvent}, layout::Alignment, prelude::*, widgets::{Block, Borders, Clear, List}, diff --git a/tui/src/filter.rs b/tui/src/filter.rs index 0d9920de..cc93ecee 100644 --- a/tui/src/filter.rs +++ b/tui/src/filter.rs @@ -1,8 +1,8 @@ use crate::{state::ListEntry, theme::Theme}; -use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use ego_tree::NodeId; use linutil_core::Tab; use ratatui::{ + crossterm::event::{KeyCode, KeyEvent, KeyModifiers}, layout::{Position, Rect}, style::{Color, Style}, text::Span, diff --git a/tui/src/float.rs b/tui/src/float.rs index 7b569752..993684b0 100644 --- a/tui/src/float.rs +++ b/tui/src/float.rs @@ -1,5 +1,5 @@ -use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ + crossterm::event::{KeyCode, KeyEvent}, layout::{Constraint, Direction, Layout, Rect}, Frame, }; diff --git a/tui/src/floating_text.rs b/tui/src/floating_text.rs index a43361af..50655df1 100644 --- a/tui/src/floating_text.rs +++ b/tui/src/floating_text.rs @@ -8,9 +8,8 @@ use crate::{float::FloatContent, hint::Shortcut}; use linutil_core::Command; -use crossterm::event::{KeyCode, KeyEvent}; - use ratatui::{ + crossterm::event::{KeyCode, KeyEvent}, layout::Rect, style::{Style, Stylize}, text::Line, diff --git a/tui/src/main.rs b/tui/src/main.rs index df20e733..428e6b5b 100644 --- a/tui/src/main.rs +++ b/tui/src/main.rs @@ -14,13 +14,17 @@ use std::{ use crate::theme::Theme; use clap::Parser; -use crossterm::{ - event::{self, DisableMouseCapture, Event, KeyEventKind}, - style::ResetColor, - terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, - ExecutableCommand, + +use ratatui::{ + backend::CrosstermBackend, + crossterm::{ + event::{self, DisableMouseCapture, Event, KeyEventKind}, + style::ResetColor, + terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, + ExecutableCommand, + }, + Terminal, }; -use ratatui::{backend::CrosstermBackend, Terminal}; use state::AppState; // Linux utility toolbox diff --git a/tui/src/running_command.rs b/tui/src/running_command.rs index e55690fe..af642d0f 100644 --- a/tui/src/running_command.rs +++ b/tui/src/running_command.rs @@ -1,11 +1,11 @@ use crate::{float::FloatContent, hint::Shortcut}; -use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use linutil_core::Command; use oneshot::{channel, Receiver}; use portable_pty::{ ChildKiller, CommandBuilder, ExitStatus, MasterPty, NativePtySystem, PtySize, PtySystem, }; use ratatui::{ + crossterm::event::{KeyCode, KeyEvent, KeyModifiers}, layout::{Rect, Size}, style::{Color, Style, Stylize}, text::{Line, Span}, diff --git a/tui/src/state.rs b/tui/src/state.rs index ac584070..ea598d05 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -7,12 +7,12 @@ use crate::{ running_command::RunningCommand, theme::Theme, }; -use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers}; use ego_tree::NodeId; use linutil_core::{ListNode, TabList}; #[cfg(feature = "tips")] use rand::Rng; use ratatui::{ + crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers}, layout::{Alignment, Constraint, Direction, Flex, Layout}, style::{Style, Stylize}, text::{Line, Span, Text}, From 8ea3da9843b3482f206efafb97352a15f93c09b3 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 7 Nov 2024 04:00:40 +0530 Subject: [PATCH 16/40] Remove dependabot ignores (#806) --- .github/dependabot.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 116841e4..5e655c35 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,11 +7,4 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" -ignore: - - dependency-name: "actions/stale" - versions: '>= 9' - - dependency-name: "actions/setup-python" - versions: '> 4' - - dependency-name: "crossterm" - versions: '> 0.27.0' + interval: "weekly" \ No newline at end of file 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 17/40] 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 bd1649e4..24a332c7 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 18/40] 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 50655df1..c307b854 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 19/40] 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 094a02ed..605cd30e 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 ef31b2a9..2fa6d68d 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 d3f42011..f07d4b77 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 891d8e84..aa0693c1 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 baa0d995..a486e1e4 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 cc93ecee..f44e89a1 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 b5f096ca..82c265c8 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 ea598d05..008d110b 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 20/40] 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 00000000..e7543abc --- /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 abdab9bd..9f80eec0 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 24a332c7..f8043d10 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 21/40] 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 | 46 +++++----- 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, 298 insertions(+), 66 deletions(-) create mode 100644 core/tabs/common-service-script.sh diff --git a/.shellcheckrc b/.shellcheckrc index 0b882066..6bf273ee 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 031a09ae..36c1cfe4 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 ac0d2637..7b3a980c 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 018616a6..3a9c7f0e 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 5b5615ca..d6c97212 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 25558fed..8149ebae 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 b4e1073a..63258023 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 8a7eab40..6618f0fe 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 e929dbc9..f9f14e74 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 67980858..cd36b6c4 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 a630b9c7..d8ed06b4 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 002ff7e3..f9283691 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 c45ebc80..dd0b20ef 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 3cef5106..28ec96dc 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 6c7a0a83..f96bd9f2 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 2b6b4bbe..f6f2f200 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 cdd71b55..18c462b1 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 a21b53e4..54916f60 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 f49dcb78..f7e80e5a 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 4844d10e..c4fc53ff 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 cb523441..5374805e 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 85ef129b..c919969d 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 fd925e0b..7b02af7c 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 8cf1762d..4e399a02 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 c09df01e..8cd98970 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 f389abd8..a55bd183 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 9118d36d..7740b508 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 785d512c..ab618f08 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 24ce1a67..b4e2609a 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 a85b9240..65f090ec 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 d431c488..f8188ac3 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 00000000..c3a2053d --- /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 9c0810f4..54145ea7 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 74a96a41..bb6bb44a 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 07673952..86bc9f5d 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 57b827b9..573751a0 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 c213156a..53f3a1df 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 da7ee23d..6bfe266b 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 f05830d3..09b24d4d 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 46fead9d..40e006a2 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 f80ba3fb..a358b614 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 [ "$INIT_MANAGER" = "rc-service" ]; then + printf "%b\n" "${RED}Unsupported init system.${RC}" + exit 1 + fi - if [ ! -f "/etc/systemd/system/numlock.service" ]; then - create_service - fi + if [ ! -f "/usr/local/bin/numlock" ]; then + create_file + 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 [ ! -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 35453ba3..6c18374a 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 536f7c69..1efdadcb 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 52004a27..aa0dc30e 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 afe2c71d..b38483e5 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 b9ed3127..09f33c60 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 14faec0a..d4ed2d10 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 22/40] 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 6c18374a..5552c4f9 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 23/40] 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 8cd98970..6d28b0a3 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 24/40] 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 f8aa0ea3..33bb3bdb 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 7b02af7c..13776fc3 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 25/40] 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 a4a5295e..be23b9ad 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 26/40] 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 af642d0f..798c67c0 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 27/40] 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 | 27 +++++++++++++++++++-------- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/man/linutil.1 b/man/linutil.1 index a85bee96..5150b351 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 428e6b5b..d8f7d0d1 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 008d110b..a164e174 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::>(); + 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)); + 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 28/40] 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 33bb3bdb..e6c54db5 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 3c412fb6..71e87583 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 5aad12ad..8e27bbf0 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" From 9f0863729f92cf38e84f05c26ea7b3d81e2b3e4f Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 00:51:37 +0530 Subject: [PATCH 29/40] feat: Add automation based on config file (#836) * feat: Add automation based on config file * docs: add configuration to the manpage & README * update roadmap --------- Co-authored-by: Adam Perkowski Co-authored-by: Chris Titus --- README.md | 22 ++++++++++++++++++++++ core/src/config.rs | 28 ++++++++++++++++++++++++++++ core/src/lib.rs | 15 +++++++++++++++ docs/roadmap.md | 2 +- man/linutil.1 | 4 ++++ tui/src/main.rs | 4 ++++ tui/src/state.rs | 28 +++++++++++++++++++++++++++- 7 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 core/src/config.rs diff --git a/README.md b/README.md index e6c54db5..78bd1d0e 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,28 @@ Note that crates installed using `cargo install` require manual updating with `c
+## Configuration + +Linutil supports configuration through a TOML config file. Path to the file can be specified with `--config` (or `-c`). + +Available options: +- `auto_execute` - a list of commands to execute automatically (can be combined with `--skip-confirmation`) + +Example config: +```toml +# example_config.toml + +auto_execute = [ + "Fastfetch", + "Alacritty", + "Kitty" +] +``` + +```bash +linutil --config /path/to/example_config.toml +``` + ## πŸ’– Support If you find Linutil helpful, please consider giving it a ⭐️ to show your support! diff --git a/core/src/config.rs b/core/src/config.rs new file mode 100644 index 00000000..d4f5e5c5 --- /dev/null +++ b/core/src/config.rs @@ -0,0 +1,28 @@ +use serde::Deserialize; +use std::path::Path; +use std::process; + +#[derive(Deserialize)] +pub struct Config { + pub auto_execute: Vec, +} + +impl Config { + pub fn from_file(path: &Path) -> Self { + let content = match std::fs::read_to_string(path) { + Ok(content) => content, + Err(e) => { + eprintln!("Failed to read config file {}: {}", path.display(), e); + process::exit(1); + } + }; + + match toml::from_str(&content) { + Ok(config) => config, + Err(e) => { + eprintln!("Failed to parse config file: {}", e); + process::exit(1); + } + } + } +} diff --git a/core/src/lib.rs b/core/src/lib.rs index aa0693c1..986d9ac1 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -1,3 +1,4 @@ +mod config; mod inner; use std::rc::Rc; @@ -6,6 +7,7 @@ pub use ego_tree; use ego_tree::Tree; use std::path::PathBuf; +pub use config::Config; pub use inner::{get_tabs, TabList}; #[derive(Clone, Hash, Eq, PartialEq)] @@ -34,3 +36,16 @@ pub struct ListNode { pub task_list: String, pub multi_select: bool, } + +impl Tab { + pub fn find_command(&self, name: &str) -> Option> { + self.tree.root().descendants().find_map(|node| { + let value = node.value(); + if value.name == name && !node.has_children() { + Some(value.clone()) + } else { + None + } + }) + } +} diff --git a/docs/roadmap.md b/docs/roadmap.md index cc334348..71a7aaf5 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -13,7 +13,7 @@ ## Milestones ### Q4 2024 - [x] Finish the foundation of the project's CLI -- [ ] Implement CLI arguments and configuration support +- [x] Implement CLI arguments and configuration support - [ ] Add an option for logging script executions ### Q1 2025 diff --git a/man/linutil.1 b/man/linutil.1 index 5150b351..f846614f 100644 --- a/man/linutil.1 +++ b/man/linutil.1 @@ -22,6 +22,10 @@ curl -fsSL https://christitus.com/linux | sh curl -fsSL https://christitus.com/linuxdev | sh .SH OPTIONS +.TP +\fB\-c\fR, \fB\-\-config\fR \fI\fR +Path to the configuration file. + .TP \fB\-t\fR, \fB\-\-theme\fR \fI\fR Set the theme to use in the TUI. diff --git a/tui/src/main.rs b/tui/src/main.rs index d8f7d0d1..7a9f4067 100644 --- a/tui/src/main.rs +++ b/tui/src/main.rs @@ -9,6 +9,7 @@ mod theme; use std::{ io::{self, stdout}, + path::PathBuf, time::Duration, }; @@ -30,6 +31,8 @@ use state::AppState; // Linux utility toolbox #[derive(Debug, Parser)] struct Args { + #[arg(short, long, help = "Path to the configuration file")] + config: Option, #[arg(short, long, value_enum)] #[arg(default_value_t = Theme::Default)] #[arg(help = "Set the theme to use in the application")] @@ -52,6 +55,7 @@ fn main() -> io::Result<()> { let args = Args::parse(); let mut state = AppState::new( + args.config, args.theme, args.override_validation, args.size_bypass, diff --git a/tui/src/state.rs b/tui/src/state.rs index a164e174..5ee34079 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -8,7 +8,7 @@ use crate::{ theme::Theme, }; -use linutil_core::{ego_tree::NodeId, ListNode, TabList}; +use linutil_core::{ego_tree::NodeId, Config, ListNode, TabList}; #[cfg(feature = "tips")] use rand::Rng; use ratatui::{ @@ -19,6 +19,7 @@ use ratatui::{ widgets::{Block, Borders, List, ListState, Paragraph}, Frame, }; +use std::path::PathBuf; use std::rc::Rc; const MIN_WIDTH: u16 = 100; @@ -87,6 +88,7 @@ enum SelectedItem { impl AppState { pub fn new( + config_path: Option, theme: Theme, override_validation: bool, size_bypass: bool, @@ -95,6 +97,8 @@ impl AppState { let tabs = linutil_core::get_tabs(!override_validation); let root_id = tabs[0].tree.root().id(); + let auto_execute_commands = config_path.map(|path| Config::from_file(&path).auto_execute); + let mut state = Self { theme, focus: Focus::List, @@ -113,9 +117,31 @@ impl AppState { }; state.update_items(); + if let Some(auto_execute_commands) = auto_execute_commands { + state.handle_initial_auto_execute(&auto_execute_commands); + } + state } + fn handle_initial_auto_execute(&mut self, auto_execute_commands: &[String]) { + self.selected_commands = auto_execute_commands + .iter() + .filter_map(|name| self.tabs.iter().find_map(|tab| tab.find_command(name))) + .collect(); + + if !self.selected_commands.is_empty() { + let cmd_names: Vec<_> = 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)); + } + } + fn get_list_item_shortcut(&self) -> Box<[Shortcut]> { if self.selected_item_is_dir() { Box::new([Shortcut::new("Go to selected dir", ["l", "Right", "Enter"])]) From b36a7df11cec0b3190e3d4fce6815d0059a2dd7c Mon Sep 17 00:00:00 2001 From: Vorthas <24818280+Vorthas@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:23:13 -0500 Subject: [PATCH 30/40] feat: printer driver installation (#837) * Add basic script to install Epson printer drivers in Arch, Debian, and Fedora. * Add I to the task_list for this script. * Update core/tabs/utils/printers/install-epson-printer-drivers.sh Co-authored-by: JEEVITHA KANNAN K S * Update userguide.md based on adam's documentation update. * Add description to tab_data.toml for the printer addition. * Fix typo, oops. * Actually generate the updated userguide. * Add installation of CUPS as a pre-requisite for Epson printer drivers as well as standalone script for other printer drivers to be added in the future. * Update core/tabs/utils/printers/install-cups.sh Co-authored-by: Adam Perkowski * Update core/tabs/utils/printers/install-epson-printer-drivers.sh Co-authored-by: Adam Perkowski * Update core/tabs/utils/tab_data.toml Co-authored-by: Adam Perkowski * Update core/tabs/utils/tab_data.toml Co-authored-by: Adam Perkowski * Update docs after changes. --------- Co-authored-by: JEEVITHA KANNAN K S Co-authored-by: Adam Perkowski --- core/tabs/utils/printers/install-cups.sh | 27 +++++++++++++++++ .../printers/install-epson-printer-drivers.sh | 30 +++++++++++++++++++ core/tabs/utils/tab_data.toml | 15 ++++++++++ docs/userguide.md | 5 ++++ 4 files changed, 77 insertions(+) create mode 100644 core/tabs/utils/printers/install-cups.sh create mode 100644 core/tabs/utils/printers/install-epson-printer-drivers.sh diff --git a/core/tabs/utils/printers/install-cups.sh b/core/tabs/utils/printers/install-cups.sh new file mode 100644 index 00000000..b70df37a --- /dev/null +++ b/core/tabs/utils/printers/install-cups.sh @@ -0,0 +1,27 @@ +#!/bin/sh -e + +. ../../common-script.sh + +installCUPS() { + clear + + case "$PACKAGER" in + pacman) + "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm cups + ;; + apt-get | nala) + "$ESCALATION_TOOL" "$PACKAGER" install -y cups + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y cups + ;; + *) + printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}" + exit 1 + ;; + esac +} + +checkEnv +checkEscalationTool +installCUPS diff --git a/core/tabs/utils/printers/install-epson-printer-drivers.sh b/core/tabs/utils/printers/install-epson-printer-drivers.sh new file mode 100644 index 00000000..afaab4bc --- /dev/null +++ b/core/tabs/utils/printers/install-epson-printer-drivers.sh @@ -0,0 +1,30 @@ +#!/bin/sh -e + +. ../../common-script.sh +. ./install-cups.sh + +installEpsonPrinterDriver() { + clear + + case "$PACKAGER" in + pacman) + "$AUR_HELPER" -S --noconfirm epson-inkjet-printer-escpr + ;; + apt-get | nala) + "$ESCALATION_TOOL" "$PACKAGER" install -y printer-driver-escpr + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y epson-inkjet-printer-escpr + ;; + *) + printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}" + exit 1 + ;; + esac +} + +checkEnv +checkEscalationTool +checkAURHelper +installCUPS +installEpsonPrinterDriver diff --git a/core/tabs/utils/tab_data.toml b/core/tabs/utils/tab_data.toml index 56ade826..7afc2e27 100644 --- a/core/tabs/utils/tab_data.toml +++ b/core/tabs/utils/tab_data.toml @@ -76,6 +76,21 @@ name = "Set Resolution" description = "This script is designed to change the resolution of monitors connected to your system" script = "monitor-control/set_resolutions.sh" +[[data]] +name = "Printers" + +[[data.entries]] +name = "CUPS" +script = "printers/install-cups.sh" +description = "This script will install the CUPS system, required for most printer drivers on Linux." +task_list = "I" + +[[data.entries]] +name = "Epson printer drivers" +script = "printers/install-epson-printer-drivers.sh" +description = "This script will install the Epson printer drivers." +task_list = "I" + [[data]] name = "User Account Manager" multi_select = false diff --git a/docs/userguide.md b/docs/userguide.md index f8043d10..66ad5b9c 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -126,6 +126,11 @@ https://github.com/ChrisTitusTech/dwm-titus - **Set Primary Monitor**: This script is designed to set a Primary monitor in your system - **Set Resolution**: This script is designed to change the resolution of monitors connected to your system +### Printers + +- **CUPS**: This script will install the CUPS system, required for most printer drivers on Linux. +- **Epson printer drivers**: This script will install the Epson printer drivers. + ### User Account Manager - **Auto Mount Drive**: This utility is designed to help with automating the process of mounting a drive on to your system. From 51e2cbd607ecfa904eab9d08ccdd607c5f7f10b6 Mon Sep 17 00:00:00 2001 From: Harsh Vyapari Date: Fri, 8 Nov 2024 00:56:57 +0530 Subject: [PATCH 31/40] feat: whatsapp desktop app (#838) * feat(communication/whatsapp): add whatsapp desktop client * Update core/tabs/applications-setup/communication-apps/whatsapp-setup.sh Co-authored-by: JEEVITHA KANNAN K S * refactor: changing name to zapzap As per @Ilj3954 and @adamperkowski request, I'm changing both option and script name to zapzap (which was the original name of the app) * Update core/tabs/applications-setup/tab_data.toml Co-authored-by: Adam Perkowski * Update core/tabs/applications-setup/communication-apps/zapzap-setup.sh Co-authored-by: Adam Perkowski * Update core/tabs/applications-setup/communication-apps/zapzap-setup.sh Co-authored-by: Adam Perkowski * Update core/tabs/applications-setup/communication-apps/zapzap-setup.sh Co-authored-by: Adam Perkowski * Update core/tabs/applications-setup/communication-apps/zapzap-setup.sh Co-authored-by: Adam Perkowski * chore: adjusting indentation * Update core/tabs/applications-setup/communication-apps/zapzap-setup.sh Co-authored-by: Jeevitha Kannan K S * Update core/tabs/applications-setup/tab_data.toml Co-authored-by: Jeevitha Kannan K S --------- Co-authored-by: JEEVITHA KANNAN K S Co-authored-by: Adam Perkowski Co-authored-by: Chris Titus --- .../communication-apps/zapzap-setup.sh | 23 +++++++++++++++++++ core/tabs/applications-setup/tab_data.toml | 17 +++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 core/tabs/applications-setup/communication-apps/zapzap-setup.sh diff --git a/core/tabs/applications-setup/communication-apps/zapzap-setup.sh b/core/tabs/applications-setup/communication-apps/zapzap-setup.sh new file mode 100644 index 00000000..4aea8556 --- /dev/null +++ b/core/tabs/applications-setup/communication-apps/zapzap-setup.sh @@ -0,0 +1,23 @@ +#!/bin/sh -e + +. ../../common-script.sh + +installZapZap() { + if ! command_exists com.rtosta.zapzap && ! command_exists zapzap; then + printf "%b\n" "${YELLOW}Installing Zap-Zap...${RC}" + case "$PACKAGER" in + pacman) + "$AUR_HELPER" -S --needed --noconfirm zapzap + ;; + *) + checkFlatpak + flatpak install flathub com.rtosta.zapzap + ;; + esac + else + printf "%b\n" "${GREEN}Zap-Zap is already installed.${RC}" + fi +} + +checkEnv +installZapZap diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml index 20233a92..af3540cb 100644 --- a/core/tabs/applications-setup/tab_data.toml +++ b/core/tabs/applications-setup/tab_data.toml @@ -84,6 +84,17 @@ description = "Sublime Text is a fast, lightweight, and customizable text editor script = "Developer-tools/sublime-setup.sh" task_list = "I" +[[data.entries]] +name = "ZapZap" +description = "ZapZap is an open source whatsapp desktop client for Linux users developed by rafatosta." +script = "communication-apps/zapzap-setup.sh" +task_list = "I" + +[[data.entries]] +name = "Zoom" +description = "Zoom is a widely-used video conferencing platform that allows users to host virtual meetings, webinars, and online collaboration with features like screen sharing and recording." +script = "communication-apps/zoom-setup.sh" + [[data.entries]] name = "VS Code" description = "Visual Studio Code (VS Code) is a lightweight, open-source code editor with built-in support for debugging, version control, and extensions for various programming languages and frameworks." @@ -279,7 +290,7 @@ task_list = "I" [[data.preconditions]] matches = false data = "command_exists" -values = [ "linutil" ] +values = ["linutil"] [[data]] name = "Linutil Updater" @@ -290,7 +301,7 @@ task_list = "I" [[data.preconditions]] matches = true data = "command_exists" -values = [ "linutil" ] +values = ["linutil"] [[data]] name = "Rofi" @@ -306,7 +317,7 @@ task_list = "I SS" [[data.preconditions]] matches = true data = { environment = "XDG_SESSION_TYPE" } -values = [ "wayland", "Wayland" ] +values = ["wayland", "Wayland"] [[data]] name = "ZSH Prompt" From f5f38243f0044f254035045f34d5d2b5047ca137 Mon Sep 17 00:00:00 2001 From: Phoenix Mark Hale <69822350+phoenixhaleofficial@users.noreply.github.com> Date: Thu, 7 Nov 2024 20:49:35 +0100 Subject: [PATCH 32/40] feat: tor browser installation (#842) * Added Tor Browser to Web Browsers tab. * Ran cargo xtask docgen * removed unnecessary double quotes in tor-browser.sh Co-authored-by: JEEVITHA KANNAN K S --------- Co-authored-by: JEEVITHA KANNAN K S Co-authored-by: Chris Titus --- .../browsers/tor-browser.sh | 34 +++++++++++++++++++ core/tabs/applications-setup/tab_data.toml | 6 ++++ docs/userguide.md | 1 + 3 files changed, 41 insertions(+) create mode 100644 core/tabs/applications-setup/browsers/tor-browser.sh diff --git a/core/tabs/applications-setup/browsers/tor-browser.sh b/core/tabs/applications-setup/browsers/tor-browser.sh new file mode 100644 index 00000000..cfd6c5f2 --- /dev/null +++ b/core/tabs/applications-setup/browsers/tor-browser.sh @@ -0,0 +1,34 @@ +#!/bin/sh -e + +. ../../common-script.sh + +installTorBrowser() { + if ! command_exists torbrowser-launcher; then + printf "%b\n" "${YELLOW}Installing Tor Browser...${RC}" + case "$PACKAGER" in + apt-get|nala) + "$ESCALATION_TOOL" "$PACKAGER" install -y torbrowser-launcher + ;; + zypper) + "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install torbrowser-launcher + ;; + pacman) + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm torbrowser-launcher + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y torbrowser-launcher + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" + exit 1 + ;; + esac + else + printf "%b\n" "${GREEN}Tor Browser is already installed.${RC}" + fi +} + +checkEnv +checkEscalationTool +installTorBrowser + diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml index af3540cb..4e6df84a 100644 --- a/core/tabs/applications-setup/tab_data.toml +++ b/core/tabs/applications-setup/tab_data.toml @@ -203,6 +203,12 @@ description = "Vivaldi is a freeware, cross-platform web browser developed by Vi script = "browsers/vivaldi.sh" task_list = "I" +[[data.entries]] +name = "Tor Browser" +description = "Tor Browser is a free and open-source firefox-based web browser designed for anonymity and censorship circumvention." +script = "browsers/tor-browser.sh" +task_list = "I" + [[data.entries]] name = "waterfox" description = "Waterfox is the privacy-focused web browser engineered to give you speed, control, and peace of mind on the internet." diff --git a/docs/userguide.md b/docs/userguide.md index 66ad5b9c..11e598f8 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -44,6 +44,7 @@ https://github.com/ChrisTitusTech/neovim - **Mozilla Firefox**: Mozilla Firefox is a free and open-source web browser developed by the Mozilla Foundation. - **Thorium**: Thorium is a Chromium-based browser focused on privacy and performance. - **Vivaldi**: Vivaldi is a freeware, cross-platform web browser developed by Vivaldi Technologies. +- **Tor Browser**: Tor Browser is a free and open-source firefox-based web browser designed for anonymity and censorship circumvention. - **waterfox**: Waterfox is the privacy-focused web browser engineered to give you speed, control, and peace of mind on the internet. - **Alacritty**: Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows. This command installs and configures alacritty terminal emulator. - **Android Debloater**: Universal Android Debloater (UAD) is a tool designed to help users remove bloatware and unnecessary pre-installed applications from Android devices, enhancing performance and user experience. From da534df296550c0d3591926cb8e408758757a3e1 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 20:33:41 +0530 Subject: [PATCH 33/40] refactor: system-update.sh (#843) --- core/tabs/system-setup/system-update.sh | 64 +++++++++++-------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/core/tabs/system-setup/system-update.sh b/core/tabs/system-setup/system-update.sh index 53f3a1df..9052ad80 100755 --- a/core/tabs/system-setup/system-update.sh +++ b/core/tabs/system-setup/system-update.sh @@ -5,83 +5,85 @@ fastUpdate() { case "$PACKAGER" in pacman) - - $AUR_HELPER -S --needed --noconfirm rate-mirrors-bin + "$AUR_HELPER" -S --needed --noconfirm rate-mirrors-bin printf "%b\n" "${YELLOW}Generating a new list of mirrors using rate-mirrors. This process may take a few seconds...${RC}" - if [ -s /etc/pacman.d/mirrorlist ]; then + if [ -s "/etc/pacman.d/mirrorlist" ]; then "$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak fi # If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail - dtype_local=${DTYPE} - if [ "${DTYPE}" = "unknown" ]; then + dtype_local="$DTYPE" + if [ "$dtype_local" = "unknown" ]; then dtype_local="arch" fi - "$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root ${dtype_local} - if [ $? -ne 0 ] || [ ! -s /etc/pacman.d/mirrorlist ]; then + if ! "$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root "$dtype_local" > /dev/null || [ ! -s "/etc/pacman.d/mirrorlist" ]; then printf "%b\n" "${RED}Rate-mirrors failed, restoring backup.${RC}" "$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist fi ;; - apt-get|nala) - "$ESCALATION_TOOL" apt-get update - if ! command_exists nala; then - "$ESCALATION_TOOL" apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; } + if [ "$PACKAGER" = "apt-get" ]; then + printf "%b\n" "${YELLOW}Installing nala for faster updates.${RC}" + "$ESCALATION_TOOL" "$PACKAGER" update + if "$ESCALATION_TOOL" "$PACKAGER" install -y nala; then + PACKAGER="nala"; + printf "%b\n" "${CYAN}Using $PACKAGER as package manager${RC}" + else + printf "%b\n" "${RED}Nala installation failed.${RC}" + printf "%b\n" "${YELLOW}Falling back to apt-get.${RC}" + fi fi if [ "$PACKAGER" = "nala" ]; then - "$ESCALATION_TOOL" cp /etc/apt/sources.list /etc/apt/sources.list.bak - "$ESCALATION_TOOL" nala update - PACKAGER="nala" + if [ -f "/etc/apt/sources.list.d/nala-sources.list" ]; then + "$ESCALATION_TOOL" cp /etc/apt/sources.list.d/nala-sources.list /etc/apt/sources.list.d/nala-sources.list.bak + fi + if ! "$ESCALATION_TOOL" nala fetch --auto -y || [ ! -s "/etc/apt/sources.list.d/nala-sources.list" ]; then + printf "%b\n" "${RED}Nala fetch failed, restoring backup.${RC}" + "$ESCALATION_TOOL" cp /etc/apt/sources.list.d/nala-sources.list.bak /etc/apt/sources.list.d/nala-sources.list + fi fi - - "$ESCALATION_TOOL" "$PACKAGER" upgrade -y ;; dnf) "$ESCALATION_TOOL" "$PACKAGER" update -y ;; zypper) "$ESCALATION_TOOL" "$PACKAGER" ref - "$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup ;; apk) "$ESCALATION_TOOL" "$PACKAGER" update ;; *) - printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" + printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" exit 1 ;; esac } updateSystem() { - printf "%b\n" "${GREEN}Updating system${RC}" + printf "%b\n" "${YELLOW}Updating system packages.${RC}" case "$PACKAGER" in apt-get|nala) - "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" upgrade -y ;; dnf) - "$ESCALATION_TOOL" "$PACKAGER" update -y "$ESCALATION_TOOL" "$PACKAGER" upgrade -y ;; pacman) "$ESCALATION_TOOL" "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring - "$ESCALATION_TOOL" "$PACKAGER" -Su --noconfirm + "$AUR_HELPER" -Su --noconfirm ;; zypper) - "$ESCALATION_TOOL" "$PACKAGER" ref "$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup ;; apk) "$ESCALATION_TOOL" "$PACKAGER" upgrade ;; *) - printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" + printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" exit 1 ;; esac @@ -89,18 +91,8 @@ updateSystem() { updateFlatpaks() { if command_exists flatpak; then - printf "%b\n" "${YELLOW}Updating installed Flathub apps...${RC}" - installed_apps=$(flatpak list --app --columns=application) - - if [ -z "$installed_apps" ]; then - printf "%b\n" "${RED}No Flathub apps are installed.${RC}" - return - fi - - for app in $installed_apps; do - printf "%b\n" "${YELLOW}Updating $app...${RC}" - flatpak update -y "$app" - done + printf "%b\n" "${YELLOW}Updating flatpak packages.${RC}" + flatpak update -y fi } From a0630e0a681f719ed73ceac3fa1b5258499b9eee Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 20:34:42 +0530 Subject: [PATCH 34/40] fix: Debian && popos gaming deps (#859) * fix: debian gaming deps * fix: pop-os gaming dependency issue * Update gaming-setup.sh * fix: shellcheck warning , formatting --- core/tabs/system-setup/gaming-setup.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/core/tabs/system-setup/gaming-setup.sh b/core/tabs/system-setup/gaming-setup.sh index 86bc9f5d..ecd97c54 100755 --- a/core/tabs/system-setup/gaming-setup.sh +++ b/core/tabs/system-setup/gaming-setup.sh @@ -1,10 +1,11 @@ #!/bin/sh -e +# shellcheck disable=SC2086 + . ../common-script.sh installDepend() { - # Check for dependencies - DEPENDENCIES='wine dbus' + DEPENDENCIES='wine dbus git' printf "%b\n" "${YELLOW}Installing dependencies...${RC}" case "$PACKAGER" in pacman) @@ -25,13 +26,16 @@ installDepend() { $AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS ;; - apt-get|nala) + apt-get | nala) DISTRO_DEPS="libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 wine64 wine32" - "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" dpkg --add-architecture i386 - "$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common - "$ESCALATION_TOOL" apt-add-repository contrib -y + + if [ "$DTYPE" != "pop" ]; then + "$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common + "$ESCALATION_TOOL" apt-add-repository contrib -y + fi + "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS ;; @@ -62,7 +66,7 @@ installAdditionalDepend() { DISTRO_DEPS='steam lutris goverlay' "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS ;; - apt-get|nala) + apt-get | nala) version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris | grep -v 'beta' | tail -n1 | @@ -72,7 +76,7 @@ installAdditionalDepend() { curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb" printf "%b\n" "${YELLOW}Installing Lutris...${RC}" - "$ESCALATION_TOOL" "$PACKAGER" install ./lutris_"${version_no_v}"_all.deb + "$ESCALATION_TOOL" "$PACKAGER" install -y ./lutris_"${version_no_v}"_all.deb rm lutris_"${version_no_v}"_all.deb @@ -91,7 +95,6 @@ installAdditionalDepend() { "$ESCALATION_TOOL" "$PACKAGER" install -y $DISTRO_DEPS ;; zypper) - # Flatpak DISTRO_DEPS='lutris' "$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS ;; From 2badbe9ead396fed258ef352f65de2b94a2921ee Mon Sep 17 00:00:00 2001 From: Angaddeep Singh <159604852+Angxddeep@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:35:16 +0530 Subject: [PATCH 35/40] Delist Firewall setup on systems with Firewalld installed, such as fedora (#862) * fedora commit * Update core/tabs/security/tab_data.toml Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com> --------- Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com> --- core/tabs/security/tab_data.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/tabs/security/tab_data.toml b/core/tabs/security/tab_data.toml index ce8d7ac4..fe2c2818 100644 --- a/core/tabs/security/tab_data.toml +++ b/core/tabs/security/tab_data.toml @@ -5,3 +5,8 @@ name = "Firewall Baselines (CTT)" description = "Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall. This command installs UFW and configures UFW based on CTT's recommended rules. For more information visit: https://christitus.com/linux-security-mistakes" script = "firewall-baselines.sh" task_list = "I SS" + +[[data.preconditions]] +matches = false +data = "command_exists" +values = [ "firewalld" ] From 0d4688d53e21d94329c2e833fcae9c29a9d25f20 Mon Sep 17 00:00:00 2001 From: Angaddeep Singh <159604852+Angxddeep@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:35:45 +0530 Subject: [PATCH 36/40] Update multimedia-codecs.sh (#863) --- core/tabs/system-setup/fedora/multimedia-codecs.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/tabs/system-setup/fedora/multimedia-codecs.sh b/core/tabs/system-setup/fedora/multimedia-codecs.sh index 751e4547..5711f0d6 100644 --- a/core/tabs/system-setup/fedora/multimedia-codecs.sh +++ b/core/tabs/system-setup/fedora/multimedia-codecs.sh @@ -8,8 +8,6 @@ multimedia() { if [ -e /etc/yum.repos.d/rpmfusion-free.repo ] && [ -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then printf "%b\n" "${YELLOW}Installing Multimedia Codecs...${RC}" "$ESCALATION_TOOL" "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y - "$ESCALATION_TOOL" "$PACKAGER" update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y - "$ESCALATION_TOOL" "$PACKAGER" update @sound-and-video -y printf "%b\n" "${GREEN}Multimedia Codecs Installed...${RC}" else printf "%b\n" "${RED}RPM Fusion repositories not found. Please set up RPM Fusion first!${RC}" From 95cfbe8920b2675a148ce6c23d13d78bb8771afb Mon Sep 17 00:00:00 2001 From: Infinite State <165737308+infstate@users.noreply.github.com> Date: Fri, 8 Nov 2024 07:06:47 -0800 Subject: [PATCH 37/40] fix: Autocpu-freq script not detecting battery on laptops (#877) * Add refined check * remove an unneccessary comment Co-authored-by: nyx --------- Co-authored-by: Adam Perkowski Co-authored-by: nyx --- core/tabs/utils/power-profile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/utils/power-profile.sh b/core/tabs/utils/power-profile.sh index 1efdadcb..9c242c4d 100644 --- a/core/tabs/utils/power-profile.sh +++ b/core/tabs/utils/power-profile.sh @@ -48,7 +48,7 @@ configureAutoCpufreq() { if command_exists auto-cpufreq; then # Check if the system has a battery to determine if it's a laptop - if [ -d /sys/class/power_supply/BAT0 ]; 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 From 17ff41259560cd7bd73972686d12974a60121443 Mon Sep 17 00:00:00 2001 From: Infinite State <165737308+infstate@users.noreply.github.com> Date: Fri, 8 Nov 2024 07:07:35 -0800 Subject: [PATCH 38/40] fix(system-cleanup): failing with no orphan packages on arch (#882) * Add extra check * Update core/tabs/system-setup/system-cleanup.sh Co-authored-by: Adam Perkowski --------- Co-authored-by: Adam Perkowski --- core/tabs/system-setup/system-cleanup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/system-cleanup.sh b/core/tabs/system-setup/system-cleanup.sh index 573751a0..dccbcf3a 100755 --- a/core/tabs/system-setup/system-cleanup.sh +++ b/core/tabs/system-setup/system-cleanup.sh @@ -22,7 +22,7 @@ cleanup_system() { ;; pacman) "$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm - "$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1 + "$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null || true ;; apk) "$ESCALATION_TOOL" "$PACKAGER" cache clean From 8639da38553eaab015cbb7097d4efc5d5926a8ae Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Fri, 8 Nov 2024 20:40:31 +0530 Subject: [PATCH 39/40] feat: Command execution log (#898) * feat: option to save logs * refact: use time crate * fix: panics * hints * update roadmap --- Cargo.lock | 72 +++++++++++++++++++++++++++++++++++--- docs/roadmap.md | 2 +- tui/Cargo.toml | 1 + tui/src/running_command.rs | 42 ++++++++++++++++++++-- 4 files changed, 109 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 605cd30e..86b9ef04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -242,6 +242,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "downcast-rs" version = "1.2.1" @@ -412,9 +421,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "linutil_core" @@ -442,6 +451,7 @@ dependencies = [ "ratatui", "temp-dir", "textwrap", + "time", "tree-sitter-bash", "tree-sitter-highlight", "tui-term", @@ -538,6 +548,21 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -606,6 +631,12 @@ dependencies = [ "winreg", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -724,9 +755,9 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" dependencies = [ "bitflags 2.6.0", "errno", @@ -991,6 +1022,39 @@ dependencies = [ "syn", ] +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "toml" version = "0.8.19" diff --git a/docs/roadmap.md b/docs/roadmap.md index 71a7aaf5..2f6c7a9b 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -14,7 +14,7 @@ ### Q4 2024 - [x] Finish the foundation of the project's CLI - [x] Implement CLI arguments and configuration support -- [ ] Add an option for logging script executions +- [x] Add an option for logging script executions ### Q1 2025 - [ ] GUI Brainstorming and Planning diff --git a/tui/Cargo.toml b/tui/Cargo.toml index a486e1e4..4051d3b3 100644 --- a/tui/Cargo.toml +++ b/tui/Cargo.toml @@ -20,6 +20,7 @@ portable-pty = "0.8.1" ratatui = "0.29.0" tui-term = "0.2.0" temp-dir = "0.1.14" +time = { version = "0.3.36", features = ["local-offset", "macros", "formatting"] } unicode-width = "0.2.0" rand = { version = "0.8.5", optional = true } linutil_core = { path = "../core", version = "24.9.28" } diff --git a/tui/src/running_command.rs b/tui/src/running_command.rs index 798c67c0..779a0b3c 100644 --- a/tui/src/running_command.rs +++ b/tui/src/running_command.rs @@ -17,11 +17,11 @@ use std::{ sync::{Arc, Mutex}, thread::JoinHandle, }; +use time::{macros::format_description, OffsetDateTime}; use tui_term::{ vt100::{self, Screen}, widget::PseudoTerminal, }; - pub struct RunningCommand { /// A buffer to save all the command output (accumulates, until the command exits) buffer: Arc>>, @@ -37,6 +37,7 @@ pub struct RunningCommand { writer: Box, /// Only set after the process has ended status: Option, + log_path: Option, scroll_offset: usize, } @@ -79,10 +80,20 @@ impl FloatContent for RunningCommand { .style(Style::default()), ); - Block::default() + let mut block = Block::default() .borders(Borders::ALL) .border_set(ratatui::symbols::border::ROUNDED) - .title_top(title_line.centered()) + .title_top(title_line.centered()); + + if let Some(log_path) = &self.log_path { + block = + block.title_bottom(Line::from(format!(" Log saved: {} ", log_path)).centered()); + } else { + block = + block.title_bottom(Line::from(" Press 'l' to save command log ").centered()); + } + + block }; // Process the buffer and create the pseudo-terminal widget @@ -111,6 +122,11 @@ impl FloatContent for RunningCommand { KeyCode::PageDown => { self.scroll_offset = self.scroll_offset.saturating_sub(10); } + KeyCode::Char('l') if self.is_finished() => { + if let Ok(log_path) = self.save_log() { + self.log_path = Some(log_path); + } + } // Pass other key events to the terminal _ => self.handle_passthrough_key_event(key), } @@ -134,6 +150,7 @@ impl FloatContent for RunningCommand { Shortcut::new("Close window", ["Enter", "q"]), Shortcut::new("Scroll up", ["Page up"]), Shortcut::new("Scroll down", ["Page down"]), + Shortcut::new("Save log", ["l"]), ]), ) } else { @@ -237,6 +254,7 @@ impl RunningCommand { pty_master: pair.master, writer, status: None, + log_path: None, scroll_offset: 0, } } @@ -284,6 +302,24 @@ impl RunningCommand { } } + fn save_log(&self) -> std::io::Result { + let mut log_path = std::env::temp_dir(); + let date_format = format_description!("[year]-[month]-[day]-[hour]-[minute]-[second]"); + log_path.push(format!( + "linutil_log_{}.log", + OffsetDateTime::now_local() + .unwrap_or(OffsetDateTime::now_utc()) + .format(&date_format) + .unwrap() + )); + + let mut file = std::fs::File::create(&log_path)?; + let buffer = self.buffer.lock().unwrap(); + file.write_all(&buffer)?; + + Ok(log_path.to_string_lossy().into_owned()) + } + /// Convert the KeyEvent to pty key codes, and send them to the virtual terminal fn handle_passthrough_key_event(&mut self, key: &KeyEvent) { let input_bytes = match key.code { From 76f8e6438b9886c5d6cbf9ab8dbf7c201b8aea81 Mon Sep 17 00:00:00 2001 From: Real-MullaC Date: Fri, 8 Nov 2024 23:09:25 +0000 Subject: [PATCH 40/40] docs: new repo (#888) * Removes docs and mentions on readme * Update README.md * Update README.md Co-authored-by: Adam Perkowski * Update linutil.yml * Delete xtask.yml * Update preview.yml * Update README.md --------- Co-authored-by: Chris Titus Co-authored-by: Adam Perkowski --- .github/mkdocs.yml | 89 --------------------------- {docs/assets => .github}/preview.gif | Bin .github/workflows/github-pages.yml | 56 ----------------- .github/workflows/preview.yml | 6 +- .github/workflows/xtask.yml | 58 ----------------- README.md | 8 ++- docs/KnownIssues.md | 4 -- docs/assets/favicon.png | Bin 9793 -> 0 bytes docs/assets/preview.tape | 89 --------------------------- docs/contributing.md | 72 ---------------------- docs/faq.md | 4 -- docs/index.md | 76 ----------------------- docs/roadmap.md | 1 + docs/userguide.md | 1 + overrides/main.html | 12 ---- 15 files changed, 10 insertions(+), 466 deletions(-) delete mode 100644 .github/mkdocs.yml rename {docs/assets => .github}/preview.gif (100%) delete mode 100644 .github/workflows/github-pages.yml delete mode 100644 .github/workflows/xtask.yml delete mode 100644 docs/KnownIssues.md delete mode 100644 docs/assets/favicon.png delete mode 100644 docs/assets/preview.tape delete mode 100644 docs/contributing.md delete mode 100644 docs/faq.md delete mode 100644 docs/index.md delete mode 100644 overrides/main.html 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..07e2bd06 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -59,16 +59,16 @@ 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" + file-pattern: ".github/preview.gif" add-options: "--force" token: ${{ secrets.PAT_TOKEN }} branch: feature/preview-${{ env.tag_name }} 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/README.md b/README.md index 78bd1d0e..867d16ce 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. @@ -128,13 +128,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/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 a4f4bc5d1951b26eab658a917c9ae9d4eaded9e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9793 zcmV-HCcfE;P)EX>4Tx04R}tkv&MmP!xqv(@I4u4$UCqkfAzR5EXHhDi*;)X)CnqVDi#GXktiG zTpR`0f`dPcRR)O(t^Z~Tvt4P<6L%G;4?)tmzg6LiKTKED_zVgrbawP98)!&<_md` zRnA+SwOXCE_v9~(6!qmS*Xax+iAAK4h6Dw5R8fOXc~zm4Vj)BK2_OHE>razQAy*ZQ z9P`+K2HEw4|H1EUt=bb>jVfs16O*-ztIF{K1pwM zwAc|aunk;XcQj=WxZD8-pA6ZQT`5RMD3yTsGy0|i5WNNZR=wQX_c(n3a+KB54RCM> zjFxHkn$Np?yL0=ur=8yqa0YUwS75^100006VoOIv00000008+zyMF)x010qNS#tmY z4c7nw4c7reD4Tcy000McNliru=L7*0FfZUeSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{03ZNKL_t(|+U1>jbX3Qk?|)VI_NrYV0TM_cc7Xti9c(aQ zW5B!d!aK2zi5C)&?btK#*&fHSCz;74xWMlE}N~+|#0wy6e`bzQ6j_ud059!1zK2|3-q}5nV*^ zv(bB2K5IB!Xn?Bzt!ioxF_G-6a#Q0qBCzpd}7`_HTIw#QYm`)GmUoQSYH)1b--C(;`AlU1HAn(!eoQmn!o+!e^E(7M2Ar zQ@6xXJ#ZARQLhs9vljk6Z4lw}{(dlEV+t%12uI>{ophOL$XfU{0$k%XkeL2mHhDO< zz!CsBs8Q4B8w>-SWg-vU2iJKx)KI*jAJL86r43b zk%BqHz?~F$2USqBmKk|fI1OR2;SYux7r}Ng_3GesorvkDRjTe36X1Jf>1 za2){P3g6D~9Z@`6P>oaA$g51f&sqXBh-QBr_1|01)B`Of)2psteg< zxP~}Nk0?9>-A(;lV*CWcfK&`_BlseRPfzeT-%bS0ii5_QZysa^B^n2#e#AhJ)K8G= zN_k#A?Ig3%k!k}X&klSdP&%@x zb}K;@E3nymb5ix^2BzO^ zp1}+@W*je8)kd)0f(GC~o>A$jcyqB-_S{myj%Y?ihcNU=J%p(5qCI*{jf4;{A_oRD zJ-mmc74HTuBynpnYg)dv=Fj=K@r!Eh%cqW!rhVrD2v6xQ4*U@HKs0=XQoG8i-YCjv z2Hwh8TQr2_IcT)`W?{Rj_b&gAGd&GYynCXw_-9MNk>cjhBkBX_0*E7e)H{cTVbu{^=xX{pvy(a47uhvI$?M;Hw;GPXu42 zdZS1rVxnZMs;!uDmjHI3+9gj4Dp*@2FMD|*xJRZL&K(m1RR1p;;$b7dMYhrEvGBol zMY1v$!i6_Y!-Y3Z)2p^s=!af7Njgq8gdaS>fgj+QeOm1@WzJ}4h7I`=rf(+}po_w# zth%kjc7{!IbOVrFDX3uGc}UmX95mU$8;>>D zmzC{_f{kPk%3D?_U;T0!WK7Dj7c=VbmSuw}ZjoaOqCQK^U zBg+b;tA9~~a^{U4Kxmj3sx?x#CG&36(IF`A;v9h0koTumNNB-@we(XQ0NT8*a zs?Z>%Ahy3ZQa&5or_H_*bP;Ts0nLNW0uP&ZP+5)gXK!Brs+T5#5(1JGe zNH8pwndq6Q-*z)j8vW`)nbY&6#s5AX72Gfx5_e&X5k-;+=*eGoDtnyLlAkS+<~~11 z+xz4}y?XmOP_b&@56fawi;0V-4x^i1%QR`V9dVED4rd^ zvoQ#V4Q12)whN_=AB{`CGXa-8QJO@+yk$|u3UHCqMXOjvU!oITPo4#Ek4%+Tys}&> z`);xN`QIHS^?$7aq6Qcf@1nxE0jBS#qkHt2o-mFP7MOEZ&CVDH4Zw|3@^eth-%pfg z|9x39<&3nDX0YBsH{oa5yo*+{UY^-edqPP!UKx{f9PMW?v4@C1Z zO7t_Het99VO0W63>)-qF{S+vr+N4iln*E&jTdkq}yE|=nM zK+u_q{L3w_x4wOl`Yk{s=j6$^e4a-dzc{b$f4Y)1?X3ku{G4H4kOJ?ZX7p6Xi$|Qv zBoXZX_mC?q8%?~kKwA8>`5=2;gZ2D+%b{jw=8^|r2ZK!`GV>+^<4p?e@J9szm2_3N z5?@0*^5$g?8vM~q3*}orFC?`)&uIIfIYlm&Uts#+AmfMys1UBoK$n@AInPP!Q@A57 z9Z%X&BrX2wJaDACVX&`@pEYyV9Iz{li9z=qwfe$r=`+u>4OcLcL2`R={;COsT?Z&* z$_PB;ktrx^x)<7x=@4vFsA!dJQg+&edjKFMJXh@nfYk86Qve_halzDtbqB^%R;qN&3^=cl_mh-W-92e2%` z5L_sGW)7bD*ff+n)&-Z!RS0z`RGE#+@1m6Kp@4eCK`L)WO?no*Wl?77K7|@ z!Vq2B;qQM&>OMRL0KH-80SY?pxA2Ci{c4xMd^4TVy7$YWNu^tdK&y%iZ=3`}c%hMH zqj1UN)4`Da4`~GfLU{DjJUsL9 zVn7H%$H^e5y(&|FCr9ZifN%=RyJm`f{U5K9X8*$+aA&8$P+v-KKz(=hyU=s4fr9O$ z)J}(^Re{Q*%sZHX7pvE~=xdq5ODh-Ci6=>^GcV7D*Y5Tf5Y}R`j;52mAAP5zsbe@UF zU~N7A%IZx?^+nPk%V%e3g^rFTf0LY+gl78k7 z6{K!g3o3rNNSgQkK?z)#UTQ!Nn{o$S-uH#VR?0hEV3Wo#>$ESQEGNzT&jBI5l*1O} zcUUtdHsHjkCcUMK^E(a=dp#o@kN zp~mTbmW$}FAy@XL<4yYBCo0LsJ$0a~y_A}bfV1OtQ8o(G{pljb>m0?i;3NHIB+>=M z-_%MD{h*sv{-y=bd~6J!^YrYYk&uGJ<{ZaB2jUnqWp|%%*Y-SIP8$At5p;zeit$zr zv14&7ftmh3-ORjORXx3EL4nKLZs;+)PI~K`wf)a@YA61?St@%zA5VXzS$IHt%2|9?zy9p)*p@J1cpqG30)$Ky;N{Iwj&5K-(os)hYv+zRlL}8Le^WF(X!?^FBZ{>&8n( zB6Gk4#7+T591=&r=^`2-tzWCk_SrosXF-;9?dwxeYC(Del@3gqj50aJ5Bung721&( zJHoI7CeB!-I|L>$Cfa1dhQZnO?>gAn;bIh>6UE;h03c(GovEp*nO$971fsK3u-k1S zrj_+Pqg%PI0%_U{>ek68@R(&@Y3=(ZfaQUz5pf*L#47vDAF8#zPqagzwFCHDwAj@< zI;V^h&rizA%5t^0x6|DM&(iXEMs4Zh<$g121Z={g{<&#Mk~}|t@h8vUbkoht+-`Ro zMDMwd+`Q~l>`*WI)K)+JYoz|% zU#;eTe|gv;BzykFXBW3p9CVU1!QdCur*5bUAY5 z$PsJStew94`ZZS}gzyLNzxQV<T;^#+z=s zso}L(Up-P@US3D~wp*$YonDM*Vio2)BIEr;jnjc~q<%)Ks$z&lt+Ar2K=OuZN-5!s3!Tf~< z_ify`$mMdytiRJVEfPi!F%F$*6C<}@mkm62vp$_&cP0#DPMI=w!uNmhFB87{>hP(z z-r9b;_Wbz<;3o>EGfJ|KUNWx457&^y=E`H^c1JvMd|8$pv;zai$?&eEi@QvT8HY;_r@dv=x~@eWIZ?V1E61w{p(BGB zJTGGdB81pp`mF23EXDPJCKiSmIiTlf ziP)|$Uc^n9P$(Yg$i}}>JkY|{P3FYJuk=fly$Ul*w_9Jl)yiPf728(2(Rz3os6xZ$ zomDzEQOuQk#qJ>>5RZ8msoe5sB}!QXQK{(ApDPnQGW9)-oY!PEwxmEGh|-5eSq9;X zNfA!s8<-4u{vQvc$`}e24CXUh9VOXP?G*@}!2btIM>wg%};$8keI*qSu;>j_v$g7^Cw%_<<;WKr@ecfM$dK@_0RLvp!tE!r&8& z^^D_qDt1ks)sw4C3quUP(Cip&yWTtEl;v+ZK*KwmHqqZn5}|a_?#C#F6GGxpIx!2( zL_R-RB(5ew%{wFkSL2ak4-{a9B*@6)M5v}-yg8^5H6>ST?L8-&YTXKUrDgKSuTlb z1Vj-no?y3r;jGMTTY2b0A%$HlZ(HS7y?3s%fpa`|Yimn~oriF{-4ck`YDaws>8k30 zE8z-usGLg2%Sz|RG1v9H?sFv2+Qn%^F*9uG>FFsL z+w0T2y1IHmygywxiKRqACl;e{B8BwlpSe(Xp~ucc%wMpu5Ftb_=jCmA)&W2xtw)+k z%i;O~#-fZCUJe+%cIdgY5W9N^Aod(LY2?TpTm5+;5b$?&baaBflq1}c7q(%}Md?TS z!8bKG*;0C1T3SkadU^^4TIP83ecwg2khbT+@&qWIm$pL(Km%H4P0qi2hBWSLgxDq9 zJkK4^oH^50Hmj2-E6?k?&X(P3t{Ge2yPXVEYExrlv!W=ryzFVyr+b0FXrC^F7FK(c z_USkG#t&W6IelTcBIAcnx~ki>Pd6P8A1%rrAi(a+lVw?Uue;&Ksdm2O*wLen3~*K8 zmk^U79Kkk*XQJIG{rONrp^*RBv14cLJk0I4tuJCsJYVVI%nkafSE{v7?)^MY=#ec) z^idyu50jUlKQcdmY!*bHM9j-%5pLZiq@Q{1oU(P=F4FjAoxLty)+x~R zGlT$;y}*(lQnft~f2qEG)#t?57y&}7oVO{&2>`D3>+iIcLNyo&2J7nT8kzc5E%xog zsa0YSW;Mzo7n4Nr)Txsf?W*OWhaMh}F{Y1_q#e6R8R^_LA?Q5SsQ&q?z3Ps6ejwY9bN^r@58b{?u|;>5fO6DDLqbOHl< z`z}4ix}1rDXnxXixIz8n;=StIOFo6p(=8U1&L%$S+e(a3&{W(NKR>R#HugjP&<{?N zU|T!&_mR3F4DhJ*=#nIPHhuHKLc5|kaA1D}WuZb0d^)$gS%AjWdnba(kH&#ct4GrLl?=LKu%6dXYyS}$qZcR|@!^0E52LR`yMT>H#PMvD&xXrGv&d#c{XY1(tlvL0Cn>LL@2)TfFazr$EUQ*&9=pi4e-C3=? zK53`+@rJ)bpe;IXAh|TSoPskt=PJT6O4rZ*>7@GRtoO8!zj26k*EDi01aB*KOqLD+ zaOLFWWN-e~BXjMFVaJXgUn`2@69DIdHx0>Ri?McMVA|EFiU$Y;0)d`4x4m(|?gK7f zyma!KHEZ+W@`($qsh2oIITbEvd+1ZJ+S{d{edCm}rD&V>*|$Fi)z>!>gdI9u&i@j* zePQVRlSQOyZ?*dNl0Ru5-nN@uI$j6Srzfy^W9ZBh62zXT?nq5d&3Nv6&zB%%FSCN8 zD9VBT`>TO}wyXlyPHKt)&yI=B^1idXRoR1a`psE$bBl7_b*qbIS+=z^vt-t+G0n|Q z-F3CKK8VeX#0#T}^VRCX0BJdNk(~OUi{^}`Q^LV9Osr&cz1uI&??=FOX*7Yqb^)z#I0YSSKDE;?Pg z&Y1wZ-2Es$ep3I*Inr|Q0uYr|YTvDg6usi5qolo}8GvY<&!t}xC+NbS-ssBA%*=l7 zdoRq)%gf8LTL-(bbG(YI*v;_)dd zskYBSDJhvXCU?{*C_jEYpsK3I4BteHDCxYkdQ1Z#Y6xOegY^9!(RCoYXd*+D5>;?y z892v}AD{a#Km5_ctgNiK5+DB0Z+^YIs;a6c47n$)?q0?h37I%_+{qUs=*UF**Z{r+ z0J5fOsHVEwxBQwF)8cvXapMX`tXj1yudc4v*V57w3a_bS%Or{?Xb_v4T;rH*jj0?_ zqsPqrK#X?|08WqBn{mhbJH~DP)+6&|Ilkk{&YU@OZtLq?_UgLc69(>MOuHx|t zUjt64n2jc~{W9Tvmc(hy5vP()qvikrm&4)kmX?-|dhUBKEGV8aBkqL8s;a6l{@af~ z?CR=jrp$T|#2&sE6b#)=BXSam6VjLgr_HUz>F4|5pE+~7W6qq?F&P;dap!m)lb4ru z{hGDob8~X=xpOs|-|r8ZG+Leo;8h0VK$dyVDW&NCkg6m}?&-zFqn~~DyYp78Ts6tz z7}!BYKmYlEe{||(>*G=$xJX&pStsV>p6o}23$Sz>uwRpst5Ro}UF1EjR0e}l*?43GwYVOld|Kr>> zYu8Qnc)SBXclG0sKlsx6MpVO-;xtPp40vtbX|yFYQ)UwUcAkeH^oHdZwz8BL{J+9XR87 z-Xh2Te_v{A>$z~@LeHW_ixPHx$Ha+~a@Ve1R}>8RgBLGe)D%TwGcuZuHk=T93@3Y> zwhI6}1qB78AOFsiGw-_V?pfK{+3AUTh6{DI^)J5o;zxeJuaz@A>t%vTqJw)ZFOZZB zhH7TOd8sb2N#Bne8tU8Y>gu`^2_7MYN@mT@yME2u30+;?!N$f$Ej-NQLB_z(YfHnX zkI#1H9d-YvZ%%#SfrsYj<>h5Vg0C~DPuKk9Cog`~)!Erd z!Df~2XM!;*$9W@Wp;t4YU@~q;f`}a354z#dS@`|nb8>R>9((+Wt0zpDP>`$&Zf$Gp z_}y=RQ(0bK-m0pq0%0*Be{6e*XUZJHOI2ja4`8 zxbakOWZHELDkmbqR>5Nv@T}r#_^H&-UYE<2xpv(Rv)8Y`V+kbjYG`O^`Q^(movo>< z=?#t;~lXr3&yn(#YZ1Z->3Ng22ofze!@c!Z(dMXSeTzo_*GR^7k~NkFD|rQYEzdi zUgF+(|E5`zBuUBoK0*k2Yy0+nyLNq0?)UpUDF=;p*jRHO6gY2Myui(%n}HVvX4n}g zp1F_QDQrWKWjUp^v~=>OO%E(eOHUsjXP6J*I%51=O%8;w5`H@M-h!0sybu?ao-RV9~^T?!9NB$K&-}X|PXL zR#tD_y5&T5b@e$yNC5a}pVPxJvy+pxIQns76>2iT^CDbsf%+r23jn+xk0)c^yaf|B zZoGey%k6Rvci6S(&)09+^4jr=ii#>i2n{qK0L_|m-a$WROPwtPw+h{CXlDjq=1f?` zM7x*<;HJR?fIBrcE%U0YuAX@Jh7Ah_8oy7*b>YH=i?6==yJIISD{FLJXVvRx00#u7 zT-1Nt1)dP-RvbGdaPD|9Zl@r&&4Oneg)1{NGiUkoYbM;j{*L)}cYP+~YHMq~^!wlc z?(3sRj#O)!=3}4+1UGHQdCr=Zm9B9Cw+r1Wc%uatBGuFCcL}c@}`}3Y@vQxp}wTdi&&M%a)Z42JGJ6Uf&;Hd+p$X17B7LgTWpH z6$c>p*i9NVJ?`cW$JoUl2>~82^mxIut7~L|@*M{1r$+!$mLM-bKmYCx8>W?&&YhYJ z*r8A;^yap0hxY9G^sLY4>lA=yA+si&-KC;|@xHW#10M)0GaBq6hSs;a7Q|8d9RPd@p$s=K?pjREWDD4SiM&U)ht2ecJ+Cj|IF zq1*B5dGLAb=S9lrH2^oK?~g2W@JuKwD%iMj)2yPRqH*y?(RRN3&Y=%J_~1-uXGa@H z%_8$Hf^B5RbpwS%B7r9Yx>fLW*p_#UC%ej22Ekf##`)t-i}u6E7`vwz7f;x@@&2+g zWAa8>eW1_w>^{2Vk2@+`TUuH;<~k@CTl0opG;AX$O=Qj!4m?rNt$+tG-Za5mO)GN( zJUrFMENNn_fm4zs_ly}c#^1l`fkinvIU_|6ap>T|6Wh0ME3dDwZ-D3xjv)qefCD-d zrx~|m$`b}WkQ6$lzk_FxjJ_h6UY?6t?N1J~qrz`0H z+mw_P?~0YHW|hn=8Ta;?-7a`A zP`y!PPZGeV13qjFz)4vTIz1^sZ2laDqxcYK*rjrmE$Xue3Ogad0pd6x)r#W_;$;2E zq~L`43|?X*4WdtNRKidruMsf3wd=fmb-ay_3NxNo43r&@gJza+IcdO?rF65;Hao7{ zYM;-lp6B#AI6i?SfX=F26+j+HpKW{YJJG|q6bD52Z= zZmTBWtO1Dj)&cMn7ywwC<}`B5h867L0DT~;w+o+l#<&PN7$}+;{C+$j$#7QNa96z< ze24=&!~uKQ10PP%?UuzVd@z7+76yjDHQ15s{{frJ_$u8fV.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