Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech committed Sep 20, 2024
2 parents d10c4f1 + 8385e38 commit 72ebf08
Show file tree
Hide file tree
Showing 84 changed files with 551 additions and 417 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/bashisms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Check for bashisms
on:
# push:
# paths:
# - tabs/**
# - core/tabs/**
# branches: [ "main" ]
pull_request:
paths:
- tabs/**
- core/tabs/**
merge_group:
workflow_dispatch:

Expand All @@ -24,8 +24,8 @@ jobs:

- name: Check for bashisms in changed files
run: |
for file in $(git diff --name-only origin/${{ github.base_ref }} HEAD tabs); do
if [[ "$file" == *.sh ]]; then
for file in $(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs); do
if [[ "$file" == *.sh ]] && [[ -f "$file" ]]; then
checkbashisms "$file"
fi
done
25 changes: 18 additions & 7 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@ name: ShellCheck
on:
pull_request:
paths:
- 'tabs/**/*.sh'
- 'core/tabs/**/*.sh'
workflow_dispatch:

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: 'tabs'
severity: error
- uses: actions/checkout@v4
- run: git fetch origin ${{ github.base_ref }}

- name: Download and set up shellcheck
run : |
wget https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz
tar -xf shellcheck-v0.10.0.linux.x86_64.tar.xz
cd shellcheck-v0.10.0
chmod +x shellcheck
- name: Run shellcheck
run: |
for file in $(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs); do
if [[ "$file" == *.sh ]] && [[ -f "$file" ]]; then
./shellcheck-v0.10.0/shellcheck -S error "$file"
fi
done
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace.package]
license = "MIT"
version = "0.1.0"
version = "24.9.19"

[workspace.dependencies]
ego-tree = "0.6.2"
Expand All @@ -16,4 +16,4 @@ lto = true
codegen-units = 1
panic = "abort"
strip = true
incremental = false
incremental = false
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![](https://dcbadge.limes.pink/api/server/https://discord.gg/bujFYKAHSp)](https://discord.gg/bujFYKAHSp)

<!-- TODO: crates.io package here + <br> -->
[![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)
[![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.png)

Expand Down Expand Up @@ -44,6 +44,11 @@ Thank you to everyone who has contributed to the development of Linutil. Your ef

[![Contributors](https://contrib.rocks/image?repo=ChrisTitusTech/linutil)](https://github.com/ChrisTitusTech/linutil/graphs/contributors)

## 📜 Credits
## 📜 Contributor Milestones

Linutil’s Rust shell was developed by [@JustLinuxUser](https://github.com/JustLinuxUser).
- 2024/07 - Original Linutil Rust TUI was developed by [@JustLinuxUser](https://github.com/JustLinuxUser).
- 2024/09 - TabList (Left Column) and various Rust Core/TUI Improvements developed by [@lj3954](https://github.com/lj3954)
- 2024/09 - Cargo Publish, AUR, Rust, and Bash additions done by [@adamperkowski](https://github.com/adamperkowski)
- 2024/09 - Rust TUI Min/Max, MultiSelection, and Bash additions done by [@jeevithakannan2](https://github.com/jeevithakannan2)
- 2024/09 - Various bash updates and standardization done by [@nnyyxxxx](https://github.com/nnyyxxxx)
- 2024/09 - Multiple bash script additions done by [@guruswarupa](https://github.com/guruswarupa)
7 changes: 7 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
[package]
name = "linutil_core"
description = "The backend of Linutil."
repository = "https://github.com/ChrisTitusTech/linutil/tree/main/core"
edition = "2021"
version.workspace = true
license.workspace = true
include = [
"src/*.rs",
"Cargo.toml",
"tabs/**",
]

[dependencies]
include_dir = "0.7.4"
Expand Down
2 changes: 1 addition & 1 deletion core/src/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use serde::Deserialize;
use std::path::{Path, PathBuf};
use tempdir::TempDir;

const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/../tabs");
const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs");

pub fn get_tabs(validate: bool) -> Vec<Tab> {
let tab_files = TabList::get_tabs();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions core/tabs/applications-setup/linutil-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/sh -e

. ../common-script.sh

installLinutil() {
printf "%b\n" "${YELLOW}Installing Linutil...${RC}"
case "$PACKAGER" in
pacman)
printf "%b\n" "-----------------------------------------------------"
printf "%b\n" "Select the package to install:"
printf "%b\n" "1. ${CYAN}linutil${RC} (stable release compiled from source)"
printf "%b\n" "2. ${CYAN}linutil-bin${RC} (stable release pre-compiled)"
printf "%b\n" "3. ${CYAN}linutil-git${RC} (compiled from the latest commit)"
printf "%b\n" "-----------------------------------------------------"
printf "%b" "Enter your choice: "
read -r choice
case $choice in
1) "$AUR_HELPER" -S --noconfirm linutil ;;
2) "$AUR_HELPER" -S --noconfirm linutil-bin ;;
3) "$AUR_HELPER" -S --noconfirm linutil-git ;;
*)
printf "%b\n" "${RED}Invalid choice:${RC} $choice"
exit 1
;;
esac
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}"
read -r choice
case $choice in
y|Y)
if ! command_exists cargo; then
printf "%b\n" "${YELLOW}Installing rustup...${RC}"
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. $HOME/.cargo/env
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y rustup
;;
esac
fi
rustup default stable
cargo install --force linutil_tui
printf "%b\n" "${GREEN}Installed successfully.${RC}"
;;
*) printf "%b\n" "${RED}Linutil not installed.${RC}" ;;
esac
esac
}

checkEnv
checkEscalationTool
checkAURHelper
installLinutil
45 changes: 45 additions & 0 deletions core/tabs/applications-setup/linutil-updater.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh -e

. ../common-script.sh

updateLinutil() {
if [ ! -e "$HOME/.cargo/bin/linutil" ]; then
printf "%b\n" "${RED}This script only updates the binary installed through cargo.\nlinutil_tui is not installed.${RC}"
exit 1
fi

if ! command_exists cargo; then
printf "%b\n" "${YELLOW}Installing rustup...${RC}"
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. $HOME/.cargo/env
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y rustup
;;
esac
fi

INSTALLED_VERSION=$(cargo install --list | grep "linutil_tui" | awk '{print $2}' | tr -d 'v:')
LATEST_VERSION=$(curl -s https://crates.io/api/v1/crates/linutil_tui | grep -oP '"max_version":\s*"\K[^"]+')

if [ "$INSTALLED_VERSION" = "$LATEST_VERSION" ]; then
printf "%b\n" "${GREEN}linutil_tui is up to date.${RC}"
exit 0
fi

printf "%b\n" "${YELLOW}Updating linutil_tui...${RC}"
rustup default stable
cargo install --force linutil_tui
printf "%b\n" "${GREEN}Updated successfully.${RC}"
}

checkEnv
checkEscalationTool
checkAURHelper
updateLinutil
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,23 @@ script = "rofi-setup.sh"
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."
script = "zsh-setup.sh"

[[data]]
name = "Install Linutil"
description = "Installs a distro-specific Linutil package locally."
script = "linutil-installer.sh"

[[data.preconditions]]
matches = false
data = "command_exists"
values = [ "linutil" ]

[[data]]
name = "Update Linutil"
description = "Updates your local Linutil crate installation."
script = "linutil-updater.sh"

[[data.preconditions]]
matches = true
data = "command_exists"
values = [ "linutil" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh -e

. ../common-script.sh

themeinstall(){
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ configure_firewall() {
}

setup_ssh_samba(){
printf "Samba and SSH Setup Script\n"
printf "----------------------------\n"
printf "%b\n" "Samba and SSH Setup Script"
printf "%b\n" "--------------------------"
clear

# Display menu
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 72ebf08

Please sign in to comment.