mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-21 21:09:42 +00:00
Merge branch 'ChrisTitusTech:main' into main
This commit is contained in:
commit
9424842ecf
4
.github/workflows/linutil.yml
vendored
4
.github/workflows/linutil.yml
vendored
|
@ -30,9 +30,7 @@ jobs:
|
||||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-cargo-index-
|
restore-keys: ${{ runner.os }}-cargo-index-
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --target-dir=build --release --verbose
|
run: cargo build --target-dir=build --release --verbose
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
|
|
31
.github/workflows/rust.yml
vendored
31
.github/workflows/rust.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: Rust Check
|
name: Rust Checks
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
@ -9,25 +9,46 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cargo_check:
|
cargo_check:
|
||||||
|
name: Cargo Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Cache Cargo registry
|
- name: Cache Cargo registry
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/registry
|
path: ~/.cargo/registry
|
||||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-cargo-registry-
|
restore-keys: ${{ runner.os }}-cargo-registry-
|
||||||
|
|
||||||
- name: Cache Cargo index
|
- name: Cache Cargo index
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/git
|
path: ~/.cargo/git
|
||||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-cargo-index-
|
restore-keys: ${{ runner.os }}-cargo-index-
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo check
|
run: cargo check
|
||||||
|
|
||||||
|
lints:
|
||||||
|
name: Lints
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: Run cargo fmt
|
||||||
|
run: cargo fmt --all --check
|
||||||
|
|
||||||
|
- name: Run cargo clippy
|
||||||
|
run: cargo clippy
|
||||||
|
|
16
README.md
16
README.md
|
@ -1,13 +1,23 @@
|
||||||
## Chris Titus Tech's Linux Utility
|
# Chris Titus Tech's Linux Utility
|
||||||
|
[![Version](https://img.shields.io/github/v/release/ChrisTitusTech/linutil?color=%230567ff&label=Latest%20Release&style=for-the-badge)](https://github.com/ChrisTitusTech/linutil/releases/latest)
|
||||||
|
![GitHub Downloads (specific asset, all releases)](https://img.shields.io/github/downloads/ChrisTitusTech/linutil/linutil?label=Total%20Downloads&style=for-the-badge)
|
||||||
|
|
||||||
![pv](https://i.imgur.com/quoAwXf.png)
|
![Preview](docs/assets/preview.png)
|
||||||
|
|
||||||
## Usage
|
## 💡 Usage
|
||||||
|
|
||||||
Open your terminal and paste this command
|
Open your terminal and paste this command
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL https://christitus.com/linux | sh
|
curl -fsSL https://christitus.com/linux | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 💖 Support
|
||||||
|
- To morally and mentally support the project, make sure to leave a ⭐️!
|
||||||
|
|
||||||
|
## 🏅 Thanks to all Contributors
|
||||||
|
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
||||||
|
|
||||||
|
[![Contributors](https://contrib.rocks/image?repo=ChrisTitusTech/linutil)](https://github.com/ChrisTitusTech/linutil/graphs/contributors)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
Rust Shell written by [@JustLinuxUser](https://github.com/JustLinuxUser)
|
Rust Shell written by [@JustLinuxUser](https://github.com/JustLinuxUser)
|
||||||
|
|
Binary file not shown.
BIN
docs/assets/preview.png
Normal file
BIN
docs/assets/preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
|
@ -1,28 +1,33 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
RC='\033[0m'
|
RC='\033[0m'
|
||||||
RED='\033[31m'
|
RED='\033[31m'
|
||||||
YELLOW='\033[33m'
|
YELLOW='\033[33m'
|
||||||
GREEN='\033[32m'
|
GREEN='\033[32m'
|
||||||
|
|
||||||
command_exists() {
|
command_exists() {
|
||||||
which $1 >/dev/null 2>&1
|
which "$1" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv() {
|
|
||||||
|
checkCommandRequirements() {
|
||||||
## Check for requirements.
|
## Check for requirements.
|
||||||
REQUIREMENTS='curl groups sudo'
|
REQUIREMENTS=$1
|
||||||
for req in ${REQUIREMENTS}; do
|
for req in ${REQUIREMENTS}; do
|
||||||
if ! command_exists ${req}; then
|
if ! command_exists "${req}"; then
|
||||||
echo -e "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
echo "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
## Check Package Handler
|
checkPackageManager() {
|
||||||
PACKAGEMANAGER='apt-get dnf pacman zypper'
|
## Check Package Manager
|
||||||
|
PACKAGEMANAGER=$1
|
||||||
for pgm in ${PACKAGEMANAGER}; do
|
for pgm in ${PACKAGEMANAGER}; do
|
||||||
if command_exists ${pgm}; then
|
if command_exists "${pgm}"; then
|
||||||
PACKAGER=${pgm}
|
PACKAGER=${pgm}
|
||||||
echo "Using ${pgm}"
|
echo "Using ${pgm}"
|
||||||
break
|
break
|
||||||
|
@ -33,11 +38,13 @@ checkEnv() {
|
||||||
echo -e "${RED}Can't find a supported package manager${RC}"
|
echo -e "${RED}Can't find a supported package manager${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkSuperUser() {
|
||||||
## Check SuperUser Group
|
## Check SuperUser Group
|
||||||
SUPERUSERGROUP='wheel sudo root'
|
SUPERUSERGROUP='wheel sudo root'
|
||||||
for sug in ${SUPERUSERGROUP}; do
|
for sug in ${SUPERUSERGROUP}; do
|
||||||
if groups | grep -q ${sug}; then
|
if groups | grep -q "${sug}"; then
|
||||||
SUGROUP=${sug}
|
SUGROUP=${sug}
|
||||||
echo "Super user group ${SUGROUP}"
|
echo "Super user group ${SUGROUP}"
|
||||||
break
|
break
|
||||||
|
@ -45,11 +52,22 @@ checkEnv() {
|
||||||
done
|
done
|
||||||
|
|
||||||
## Check if member of the sudo group.
|
## Check if member of the sudo group.
|
||||||
if ! groups | grep -q ${SUGROUP}; then
|
if ! groups | grep -q "${SUGROUP}"; then
|
||||||
echo -e "${RED}You need to be a member of the sudo group to run me!${RC}"
|
echo "${RED}You need to be a member of the sudo group to run me!${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkCurrentDirectoryWritable() {
|
||||||
|
## Check if the current directory is writable.
|
||||||
|
GITPATH="$(dirname "$(realpath "$0")")"
|
||||||
|
if [ ! -w "$GITPATH" ]; then
|
||||||
|
echo "${RED}Can't write to $GITPATH${RC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkDistro() {
|
||||||
DTYPE="unknown" # Default to unknown
|
DTYPE="unknown" # Default to unknown
|
||||||
# Use /etc/os-release for modern distro identification
|
# Use /etc/os-release for modern distro identification
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
|
@ -57,3 +75,10 @@ checkEnv() {
|
||||||
DTYPE=$ID
|
DTYPE=$ID
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkEnv() {
|
||||||
|
checkCommandRequirements 'curl groups sudo'
|
||||||
|
checkPackageManager 'apt-get dnf pacman zypper'
|
||||||
|
checkSuperUser
|
||||||
|
checkDistro
|
||||||
|
}
|
||||||
|
|
|
@ -1,61 +1,10 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
RC='\033[0m'
|
|
||||||
RED='\033[31m'
|
|
||||||
YELLOW='\033[33m'
|
|
||||||
GREEN='\033[32m'
|
|
||||||
|
|
||||||
command_exists() {
|
|
||||||
which $1 >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
checkEnv() {
|
checkEnv() {
|
||||||
## Check for requirements.
|
checkCommandRequirements 'curl groups sudo'
|
||||||
REQUIREMENTS='curl groups sudo'
|
checkPackageManager 'apt-get dnf pacman zypper'
|
||||||
for req in ${REQUIREMENTS}; do
|
checkSuperUser
|
||||||
if ! command_exists ${req}; then
|
checkDistro
|
||||||
echo -e "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check Package Handler
|
|
||||||
PACKAGEMANAGER='apt-get dnf pacman zypper'
|
|
||||||
for pgm in ${PACKAGEMANAGER}; do
|
|
||||||
if command_exists ${pgm}; then
|
|
||||||
PACKAGER=${pgm}
|
|
||||||
echo "Using ${pgm}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "${PACKAGER}" ]; then
|
|
||||||
echo -e "${RED}Can't find a supported package manager${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check SuperUser Group
|
|
||||||
SUPERUSERGROUP='wheel sudo root'
|
|
||||||
for sug in ${SUPERUSERGROUP}; do
|
|
||||||
if groups | grep -q ${sug}; then
|
|
||||||
SUGROUP=${sug}
|
|
||||||
echo "Super user group ${SUGROUP}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check if member of the sudo group.
|
|
||||||
if ! groups | grep -q ${SUGROUP}; then
|
|
||||||
echo -e "${RED}You need to be a member of the sudo group to run me!${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DTYPE="unknown" # Default to unknown
|
|
||||||
# Use /etc/os-release for modern distro identification
|
|
||||||
if [ -f /etc/os-release ]; then
|
|
||||||
. /etc/os-release
|
|
||||||
DTYPE=$ID
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupAlacritty() {
|
setupAlacritty() {
|
||||||
|
|
|
@ -1,61 +1,10 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
RC='\033[0m'
|
|
||||||
RED='\033[31m'
|
|
||||||
YELLOW='\033[33m'
|
|
||||||
GREEN='\033[32m'
|
|
||||||
|
|
||||||
command_exists() {
|
|
||||||
which $1 >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
checkEnv() {
|
checkEnv() {
|
||||||
## Check for requirements.
|
checkCommandRequirements 'curl groups sudo'
|
||||||
REQUIREMENTS='curl groups sudo'
|
checkPackageManager 'apt-get dnf pacman zypper'
|
||||||
for req in ${REQUIREMENTS}; do
|
checkSuperUser
|
||||||
if ! command_exists ${req}; then
|
checkDistro
|
||||||
echo -e "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check Package Handler
|
|
||||||
PACKAGEMANAGER='apt-get dnf pacman zypper'
|
|
||||||
for pgm in ${PACKAGEMANAGER}; do
|
|
||||||
if command_exists ${pgm}; then
|
|
||||||
PACKAGER=${pgm}
|
|
||||||
echo "Using ${pgm}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "${PACKAGER}" ]; then
|
|
||||||
echo -e "${RED}Can't find a supported package manager${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check SuperUser Group
|
|
||||||
SUPERUSERGROUP='wheel sudo root'
|
|
||||||
for sug in ${SUPERUSERGROUP}; do
|
|
||||||
if groups | grep -q ${sug}; then
|
|
||||||
SUGROUP=${sug}
|
|
||||||
echo "Super user group ${SUGROUP}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check if member of the sudo group.
|
|
||||||
if ! groups | grep -q ${SUGROUP}; then
|
|
||||||
echo -e "${RED}You need to be a member of the sudo group to run me!${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DTYPE="unknown" # Default to unknown
|
|
||||||
# Use /etc/os-release for modern distro identification
|
|
||||||
if [ -f /etc/os-release ]; then
|
|
||||||
. /etc/os-release
|
|
||||||
DTYPE=$ID
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupKitty() {
|
setupKitty() {
|
||||||
|
@ -63,10 +12,10 @@ setupKitty() {
|
||||||
if ! command_exists kitty; then
|
if ! command_exists kitty; then
|
||||||
case ${PACKAGER} in
|
case ${PACKAGER} in
|
||||||
pacman)
|
pacman)
|
||||||
sudo ${PACKAGER} -S --noconfirm kitty
|
sudo "${PACKAGER}" -S --noconfirm kitty
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
sudo ${PACKAGER} install -y kitty
|
sudo "${PACKAGER}" install -y kitty
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -74,11 +23,11 @@ setupKitty() {
|
||||||
fi
|
fi
|
||||||
echo "Copy Kitty config files"
|
echo "Copy Kitty config files"
|
||||||
if [ -d "${HOME}/.config/kitty" ]; then
|
if [ -d "${HOME}/.config/kitty" ]; then
|
||||||
cp -r ${HOME}/.config/kitty ${HOME}/.config/kitty-bak
|
cp -r "${HOME}"/.config/kitty "${HOME}"/.config/kitty-bak
|
||||||
fi
|
fi
|
||||||
mkdir -p ${HOME}/.config/kitty/
|
mkdir -p "${HOME}"/.config/kitty/
|
||||||
wget -O ${HOME}/.config/kitty/kitty.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/kitty.conf
|
wget -O "${HOME}"/.config/kitty/kitty.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/kitty.conf
|
||||||
wget -O ${HOME}/.config/kitty/nord.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/nord.conf
|
wget -O "${HOME}"/.config/kitty/nord.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/nord.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
|
|
|
@ -1,61 +1,10 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
RC='\033[0m'
|
|
||||||
RED='\033[31m'
|
|
||||||
YELLOW='\033[33m'
|
|
||||||
GREEN='\033[32m'
|
|
||||||
|
|
||||||
command_exists() {
|
|
||||||
which "$1" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
checkEnv() {
|
checkEnv() {
|
||||||
## Check for requirements.
|
checkCommandRequirements 'curl groups sudo'
|
||||||
REQUIREMENTS='curl groups sudo'
|
checkPackageManager 'apt-get dnf pacman zypper'
|
||||||
for req in $REQUIREMENTS; do
|
checkSuperUser
|
||||||
if ! command_exists "$req"; then
|
checkDistro
|
||||||
echo -e "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check Package Handler
|
|
||||||
PACKAGEMANAGER='apt-get dnf pacman zypper'
|
|
||||||
for pgm in $PACKAGEMANAGER; do
|
|
||||||
if command_exists "$pgm"; then
|
|
||||||
PACKAGER="$pgm"
|
|
||||||
echo "Using $pgm"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "$PACKAGER" ]; then
|
|
||||||
echo -e "${RED}Can't find a supported package manager${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check SuperUser Group
|
|
||||||
SUPERUSERGROUP='wheel sudo root'
|
|
||||||
for sug in $SUPERUSERGROUP; do
|
|
||||||
if groups | grep -q "$sug"; then
|
|
||||||
SUGROUP="$sug"
|
|
||||||
echo "Super user group $SUGROUP"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check if member of the sudo group.
|
|
||||||
if ! groups | grep -q "$SUGROUP"; then
|
|
||||||
echo -e "${RED}You need to be a member of the sudo group to run me!${RC}\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DTYPE="unknown" # Default to unknown
|
|
||||||
# Use /etc/os-release for modern distro identification
|
|
||||||
if [ -f /etc/os-release ]; then
|
|
||||||
. /etc/os-release
|
|
||||||
DTYPE="$ID"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupRofi() {
|
setupRofi() {
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
RC='\033[0m'
|
|
||||||
RED='\033[31m'
|
|
||||||
YELLOW='\033[33m'
|
|
||||||
GREEN='\033[32m'
|
|
||||||
|
|
||||||
# Check if the home directory and linuxtoolbox folder exist, create them if they don't
|
# Check if the home directory and linuxtoolbox folder exist, create them if they don't
|
||||||
LINUXTOOLBOXDIR="$HOME/linuxtoolbox"
|
LINUXTOOLBOXDIR="$HOME/linuxtoolbox"
|
||||||
|
|
||||||
|
@ -14,70 +9,24 @@ if [ ! -d "$LINUXTOOLBOXDIR" ]; then
|
||||||
echo -e "${GREEN}linuxtoolbox directory created: $LINUXTOOLBOXDIR${RC}"
|
echo -e "${GREEN}linuxtoolbox directory created: $LINUXTOOLBOXDIR${RC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$LINUXTOOLBOXDIR/linux-setup" ]; then
|
if [ ! -d "$LINUXTOOLBOXDIR/linutil" ]; then
|
||||||
echo -e "${YELLOW}Cloning linux-setup repository into: $LINUXTOOLBOXDIR/linux-setup${RC}"
|
echo -e "${YELLOW}Cloning linutil repository into: $LINUXTOOLBOXDIR/linutil${RC}"
|
||||||
git clone https://github.com/ChrisTitusTech/linux-setup "$LINUXTOOLBOXDIR/linux-setup"
|
git clone https://github.com/ChrisTitusTech/linutil "$LINUXTOOLBOXDIR/linutil"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo -e "${GREEN}Successfully cloned linux-setup repository${RC}"
|
echo -e "${GREEN}Successfully cloned linutil repository${RC}"
|
||||||
else
|
else
|
||||||
echo -e "${RED}Failed to clone linux-setup repository${RC}"
|
echo -e "${RED}Failed to clone linutil repository${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$LINUXTOOLBOXDIR/linux-setup" || exit
|
cd "$LINUXTOOLBOXDIR/linutil" || exit
|
||||||
|
|
||||||
command_exists() {
|
|
||||||
command -v "$1" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
checkEnv() {
|
checkEnv() {
|
||||||
## Check for requirements.
|
checkCommandRequirements 'curl groups sudo'
|
||||||
REQUIREMENTS='curl groups sudo'
|
checkPackageHandler 'apt yum dnf pacman zypper'
|
||||||
for req in $REQUIREMENTS; do
|
checkCurrentDirectoryWritable
|
||||||
if ! command_exists "$req"; then
|
checkSuperUser
|
||||||
echo -e "${RED}To run me, you need: $REQUIREMENTS${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check Package Manager
|
|
||||||
PACKAGEMANAGER='apt yum dnf pacman zypper'
|
|
||||||
for pgm in $PACKAGEMANAGER; do
|
|
||||||
if command_exists "$pgm"; then
|
|
||||||
PACKAGER="$pgm"
|
|
||||||
echo "Using $pgm"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "$PACKAGER" ]; then
|
|
||||||
echo -e "${RED}Can't find a supported package manager${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check if the current directory is writable.
|
|
||||||
GITPATH="$(dirname "$(realpath "$0")")"
|
|
||||||
if [ ! -w "$GITPATH" ]; then
|
|
||||||
echo -e "${RED}Can't write to $GITPATH${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check SuperUser Group
|
|
||||||
SUPERUSERGROUP='wheel sudo root'
|
|
||||||
for sug in $SUPERUSERGROUP; do
|
|
||||||
if groups | grep -q "$sug"; then
|
|
||||||
SUGROUP="$sug"
|
|
||||||
echo "Super user group $SUGROUP"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check if member of the sudo group.
|
|
||||||
if ! groups | grep -q "$SUGROUP"; then
|
|
||||||
echo -e "${RED}You need to be a member of the sudo group to run me!${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
installDepend() {
|
installDepend() {
|
||||||
|
@ -109,30 +58,30 @@ installDepend() {
|
||||||
echo "No AUR helper found. Please install yay or paru."
|
echo "No AUR helper found. Please install yay or paru."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
"$AUR_HELPER" --noconfirm -S $DEPENDENCIES
|
"$AUR_HELPER" --noconfirm -S "$DEPENDENCIES"
|
||||||
;;
|
;;
|
||||||
apt)
|
apt)
|
||||||
COMPILEDEPS='build-essential'
|
COMPILEDEPS='build-essential'
|
||||||
sudo "$PACKAGER" update
|
sudo "$PACKAGER" update
|
||||||
sudo dpkg --add-architecture i386
|
sudo dpkg --add-architecture i386
|
||||||
sudo "$PACKAGER" update
|
sudo "$PACKAGER" update
|
||||||
sudo "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
sudo "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
COMPILEDEPS='@development-tools'
|
COMPILEDEPS='@development-tools'
|
||||||
sudo "$PACKAGER" update
|
sudo "$PACKAGER" update
|
||||||
sudo "$PACKAGER" config-manager --set-enabled powertools
|
sudo "$PACKAGER" config-manager --set-enabled powertools
|
||||||
sudo "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
sudo "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
|
||||||
sudo "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
sudo "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
COMPILEDEPS='patterns-devel-base-devel_basis'
|
COMPILEDEPS='patterns-devel-base-devel_basis'
|
||||||
sudo "$PACKAGER" refresh
|
sudo "$PACKAGER" refresh
|
||||||
sudo "$PACKAGER" --non-interactive install $DEPENDENCIES $COMPILEDEPS
|
sudo "$PACKAGER" --non-interactive install "$DEPENDENCIES" $COMPILEDEPS
|
||||||
sudo "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
sudo "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
sudo "$PACKAGER" install -y $DEPENDENCIES
|
sudo "$PACKAGER" install -y "$DEPENDENCIES"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +1,10 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
RC='\e[0m'
|
|
||||||
RED='\e[31m'
|
|
||||||
YELLOW='\e[33m'
|
|
||||||
GREEN='\e[32m'
|
|
||||||
|
|
||||||
command_exists() {
|
|
||||||
command -v $1 >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
checkEnv() {
|
checkEnv() {
|
||||||
## Check for requirements.
|
checkCommandRequirements 'curl groups sudo'
|
||||||
REQUIREMENTS='curl groups sudo'
|
checkPackageManager 'apt-get yum dnf pacman zypper'
|
||||||
if ! command_exists ${REQUIREMENTS}; then
|
checkCurrentDirectoryWritable
|
||||||
echo -e "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
checkSuperUser
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check Package Handeler
|
|
||||||
PACKAGEMANAGER='apt-get yum dnf pacman zypper'
|
|
||||||
for pgm in ${PACKAGEMANAGER}; do
|
|
||||||
if command_exists ${pgm}; then
|
|
||||||
PACKAGER=${pgm}
|
|
||||||
echo "Using ${pgm}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "${PACKAGER}" ]; then
|
|
||||||
echo -e "${RED}Can't find a supported package manager"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check if the current directory is writable.
|
|
||||||
GITPATH="$(dirname "$(readlink -f "$0")")"
|
|
||||||
if [ ! -w ${GITPATH} ]; then
|
|
||||||
echo -e "${RED}Can't write to ${GITPATH}${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check SuperUser Group
|
|
||||||
SUPERUSERGROUP='wheel sudo root'
|
|
||||||
for sug in ${SUPERUSERGROUP}; do
|
|
||||||
if groups | grep ${sug}; then
|
|
||||||
SUGROUP=${sug}
|
|
||||||
echo "Super user group ${SUGROUP}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check if member of the sudo group.
|
|
||||||
if ! groups | grep ${SUGROUP} >/dev/null; then
|
|
||||||
echo -e "${RED}You need to be a member of the sudo group to run me!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
installDepend() {
|
installDepend() {
|
||||||
|
|
65
src/commands/system-setup/3-global-theme.sh
Normal file
65
src/commands/system-setup/3-global-theme.sh
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
# Check if the home directory and linuxtoolbox folder exist, create them if they don't
|
||||||
|
LINUXTOOLBOXDIR="$HOME/linuxtoolbox"
|
||||||
|
|
||||||
|
if [ ! -d "$LINUXTOOLBOXDIR" ]; then
|
||||||
|
echo -e "${YELLOW}Creating linuxtoolbox directory: $LINUXTOOLBOXDIR${RC}"
|
||||||
|
mkdir -p "$LINUXTOOLBOXDIR"
|
||||||
|
echo -e "${GREEN}linuxtoolbox directory created: $LINUXTOOLBOXDIR${RC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$LINUXTOOLBOXDIR" || exit
|
||||||
|
|
||||||
|
install_theme_tools() {
|
||||||
|
echo -e "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}"
|
||||||
|
case $PACKAGER in
|
||||||
|
apt-get)
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y qt6ct kvantum
|
||||||
|
;;
|
||||||
|
zypper)
|
||||||
|
sudo zypper refresh
|
||||||
|
sudo zypper --non-interactive install qt6ct kvantum
|
||||||
|
;;
|
||||||
|
dnf)
|
||||||
|
sudo dnf update
|
||||||
|
sudo dnf install -y qt6ct kvantum
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
sudo pacman -Sy
|
||||||
|
sudo pacman --noconfirm -S qt6ct kvantum
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_qt6ct() {
|
||||||
|
echo -e "${YELLOW}Configuring qt6ct...${RC}"
|
||||||
|
mkdir -p "$HOME/.config/qt6ct"
|
||||||
|
cat <<EOF > "$HOME/.config/qt6ct/qt6ct.conf"
|
||||||
|
[Appearance]
|
||||||
|
style=kvantum
|
||||||
|
color_scheme=default
|
||||||
|
icon_theme=breeze
|
||||||
|
EOF
|
||||||
|
echo -e "${GREEN}qt6ct configured successfully.${RC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_kvantum() {
|
||||||
|
echo -e "${YELLOW}Configuring Kvantum...${RC}"
|
||||||
|
mkdir -p "$HOME/.config/Kvantum"
|
||||||
|
cat <<EOF > "$HOME/.config/Kvantum/kvantum.kvconfig"
|
||||||
|
[General]
|
||||||
|
theme=Breeze
|
||||||
|
EOF
|
||||||
|
echo -e "${GREEN}Kvantum configured successfully.${RC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnv
|
||||||
|
install_theme_tools
|
||||||
|
configure_qt6ct
|
||||||
|
configure_kvantum
|
|
@ -1,60 +1,10 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
RC='\033[0m'
|
|
||||||
RED='\033[31m'
|
|
||||||
YELLOW='\033[33m'
|
|
||||||
GREEN='\033[32m'
|
|
||||||
|
|
||||||
command_exists() {
|
|
||||||
which $1 >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
checkEnv() {
|
checkEnv() {
|
||||||
## Check for requirements.
|
checkCommandRequirements 'curl groups sudo'
|
||||||
REQUIREMENTS='curl groups sudo'
|
checkPackageManager 'apt-get nala dnf pacman zypper yum xbps-install'
|
||||||
for req in ${REQUIREMENTS}; do
|
checkSuperUser
|
||||||
if ! command_exists ${req}; then
|
checkDistro
|
||||||
echo -e "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
## Check Package Handler
|
|
||||||
PACKAGEMANAGER='apt-get nala dnf pacman zypper yum xbps-install'
|
|
||||||
for pgm in ${PACKAGEMANAGER}; do
|
|
||||||
if command_exists ${pgm}; then
|
|
||||||
PACKAGER=${pgm}
|
|
||||||
echo "Using ${pgm}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "${PACKAGER}" ]; then
|
|
||||||
echo -e "${RED}Can't find a supported package manager${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check SuperUser Group
|
|
||||||
SUPERUSERGROUP='wheel sudo root'
|
|
||||||
for sug in ${SUPERUSERGROUP}; do
|
|
||||||
if groups | grep ${sug} >/dev/null; then
|
|
||||||
SUGROUP=${sug}
|
|
||||||
echo "Super user group ${SUGROUP}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check if member of the sudo group.
|
|
||||||
if ! groups | grep ${SUGROUP} >/dev/null; then
|
|
||||||
echo -e "${RED}You need to be a member of the sudo group to run me!${RC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DTYPE="unknown" # Default to unknown
|
|
||||||
# Use /etc/os-release for modern distro identification
|
|
||||||
if [ -f /etc/os-release ]; then
|
|
||||||
. /etc/os-release
|
|
||||||
DTYPE=$ID
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fastUpdate() {
|
fastUpdate() {
|
||||||
|
@ -125,15 +75,15 @@ updateSystem() {
|
||||||
echo -e "${GREEN}Updating system${RC}"
|
echo -e "${GREEN}Updating system${RC}"
|
||||||
case ${PACKAGER} in
|
case ${PACKAGER} in
|
||||||
nala|apt-get)
|
nala|apt-get)
|
||||||
sudo ${PACKAGER} update -y
|
sudo "${PACKAGER}" update -y
|
||||||
sudo ${PACKAGER} upgrade -y
|
sudo "${PACKAGER}" upgrade -y
|
||||||
;;
|
;;
|
||||||
yum|dnf)
|
yum|dnf)
|
||||||
sudo ${PACKAGER} update -y
|
sudo "${PACKAGER}" update -y
|
||||||
sudo ${PACKAGER} upgrade -y
|
sudo "${PACKAGER}" upgrade -y
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo ${PACKAGER} -Syu --noconfirm
|
sudo "${PACKAGER}" -Syu --noconfirm
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
sudo ${PACKAGER} ref
|
sudo ${PACKAGER} ref
|
||||||
|
|
34
src/list.rs
34
src/list.rs
|
@ -1,5 +1,3 @@
|
||||||
use std::usize;
|
|
||||||
|
|
||||||
use crate::{float::floating_window, theme::*};
|
use crate::{float::floating_window, theme::*};
|
||||||
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind};
|
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind};
|
||||||
use ego_tree::{tree, NodeId};
|
use ego_tree::{tree, NodeId};
|
||||||
|
@ -11,6 +9,15 @@ use ratatui::{
|
||||||
Frame,
|
Frame,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
macro_rules! with_common_script {
|
||||||
|
($command:expr) => {
|
||||||
|
concat!(
|
||||||
|
include_str!("commands/common-script.sh"),
|
||||||
|
include_str!($command)
|
||||||
|
)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
struct ListNode {
|
struct ListNode {
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
command: &'static str,
|
command: &'static str,
|
||||||
|
@ -57,7 +64,7 @@ impl CustomList {
|
||||||
} => {
|
} => {
|
||||||
ListNode {
|
ListNode {
|
||||||
name: "Full System Update",
|
name: "Full System Update",
|
||||||
command: include_str!("commands/system-update.sh"),
|
command: with_common_script!("commands/system-update.sh"),
|
||||||
},
|
},
|
||||||
ListNode {
|
ListNode {
|
||||||
name: "Setup Bash Prompt",
|
name: "Setup Bash Prompt",
|
||||||
|
@ -77,11 +84,15 @@ impl CustomList {
|
||||||
} => {
|
} => {
|
||||||
ListNode {
|
ListNode {
|
||||||
name: "Build Prerequisites",
|
name: "Build Prerequisites",
|
||||||
command: include_str!("commands/system-setup/1-compile-setup.sh"),
|
command: with_common_script!("commands/system-setup/1-compile-setup.sh"),
|
||||||
},
|
},
|
||||||
ListNode {
|
ListNode {
|
||||||
name: "Gaming Dependencies",
|
name: "Gaming Dependencies",
|
||||||
command: include_str!("commands/system-setup/2-gaming-setup.sh"),
|
command: with_common_script!("commands/system-setup/2-gaming-setup.sh"),
|
||||||
|
},
|
||||||
|
ListNode {
|
||||||
|
name: "Global Theme",
|
||||||
|
command: with_common_script!("commands/system-setup/3-global-theme.sh"),
|
||||||
},
|
},
|
||||||
ListNode {
|
ListNode {
|
||||||
name: "Recursion?",
|
name: "Recursion?",
|
||||||
|
@ -94,15 +105,15 @@ impl CustomList {
|
||||||
} => {
|
} => {
|
||||||
ListNode {
|
ListNode {
|
||||||
name: "Alacritty Setup",
|
name: "Alacritty Setup",
|
||||||
command: include_str!("commands/dotfiles/alacritty-setup.sh"),
|
command: with_common_script!("commands/dotfiles/alacritty-setup.sh"),
|
||||||
},
|
},
|
||||||
ListNode {
|
ListNode {
|
||||||
name: "Kitty Setup",
|
name: "Kitty Setup",
|
||||||
command: include_str!("commands/dotfiles/kitty-setup.sh"),
|
command: with_common_script!("commands/dotfiles/kitty-setup.sh"),
|
||||||
},
|
},
|
||||||
ListNode {
|
ListNode {
|
||||||
name: "Rofi Setup",
|
name: "Rofi Setup",
|
||||||
command: include_str!("commands/dotfiles/rofi-setup.sh"),
|
command: with_common_script!("commands/dotfiles/rofi-setup.sh"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -156,7 +167,10 @@ impl CustomList {
|
||||||
// node
|
// node
|
||||||
let list = List::new(items)
|
let list = List::new(items)
|
||||||
.highlight_style(Style::default().reversed())
|
.highlight_style(Style::default().reversed())
|
||||||
.block(Block::default().borders(Borders::ALL).title(format!("Linux Toolbox - {}", chrono::Local::now().format("%Y-%m-%d"))))
|
.block(Block::default().borders(Borders::ALL).title(format!(
|
||||||
|
"Linux Toolbox - {}",
|
||||||
|
chrono::Local::now().format("%Y-%m-%d")
|
||||||
|
)))
|
||||||
.scroll_padding(1);
|
.scroll_padding(1);
|
||||||
|
|
||||||
// Render it
|
// Render it
|
||||||
|
@ -238,7 +252,7 @@ impl CustomList {
|
||||||
// Get the selected command
|
// Get the selected command
|
||||||
if let Some(selected_command) = self.get_selected_command() {
|
if let Some(selected_command) = self.get_selected_command() {
|
||||||
// If command is a folder, we don't display a preview
|
// If command is a folder, we don't display a preview
|
||||||
if selected_command == "" {
|
if selected_command.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,5 @@ fn run<B: Backend>(terminal: &mut Terminal<B>) -> io::Result<()> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
27
start.sh
27
start.sh
|
@ -1,31 +1,34 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
RC='\033[0m'
|
rc='\033[0m'
|
||||||
RED='\033[0;31m'
|
red='\033[0;31m'
|
||||||
|
|
||||||
linutil="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"
|
binary_url="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
local exit_code=$1
|
exit_code=$1
|
||||||
local message=$2
|
message=$2
|
||||||
|
|
||||||
if [ $exit_code -ne 0 ]; then
|
if [ "$exit_code" -ne 0 ]; then
|
||||||
echo -e "${RED}ERROR: $message${RC}"
|
printf '%sERROR: %s%s\n' "$red" "$message" "$rc"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset exit_code
|
||||||
|
unset message
|
||||||
}
|
}
|
||||||
|
|
||||||
TMPFILE=$(mktemp)
|
temp_file=$(mktemp)
|
||||||
check $? "Creating the temporary file"
|
check $? "Creating the temporary file"
|
||||||
|
|
||||||
curl -fsL $linutil -o $TMPFILE
|
curl -fsL "$binary_url" -o "$temp_file"
|
||||||
check $? "Downloading linutil"
|
check $? "Downloading linutil"
|
||||||
|
|
||||||
chmod +x $TMPFILE
|
chmod +x "$temp_file"
|
||||||
check $? "Making linutil executable"
|
check $? "Making linutil executable"
|
||||||
|
|
||||||
"$TMPFILE"
|
"$temp_file"
|
||||||
check $? "Executing linutil"
|
check $? "Executing linutil"
|
||||||
|
|
||||||
rm -f $TMPFILE
|
rm -f "$temp_file"
|
||||||
check $? "Deleting the temporary file"
|
check $? "Deleting the temporary file"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user