diff --git a/installs/README.md b/installs/README.md deleted file mode 100644 index 4e2a7cc..0000000 --- a/installs/README.md +++ /dev/null @@ -1,105 +0,0 @@ -## sh - -# đŸ› ī¸ **Script Collection** - -> [!TIP] -> Feel free to use and modify these scripts to suit your needs! - ---- - -## 🚀 **Quick Start** - -Clone the repository and start using the scripts: - -```bash -git clone https://git.k4li.de/scripts/sh.git scripts && cd scripts -``` - -Or run individual scripts directly: - -```bash -curl -fsSL | sh -``` - ---- - -## 📁 **Utility Scripts** - -- **🔑 `ssh-keyperm.sh`** - Fixes permissions for `.ssh/` keys. - - ```bash - curl -fsSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/snippets/ssh-keyperm.sh | sh - ``` - -- **đŸ‘Ŋī¸ `updates.sh`** - Updates system packages + flatpaks. - - ```bash - curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/setups/updates.sh | sh - ``` - -- **🚀 `postinstall.sh`** - Sets up basic post-install tasks. - - ```bash - curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/setup/postinstall.sh | sh -s -- -- - ``` - - | **Available Flag** | Description | - | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | --install-base | Installs base packages like zsh and tmux, zoxide and trash etc. | - | --optimize-os | Currently only supported by apt based systems. Installs nala and fetches best mirrors. Equivalent options might be made in the future for other packagemanagers. | - -> [!TIP] -> You can run all options together, with the `all` flag. -> -> ```bash -> curl -sSL https://git.k4li.de/scripts/sh/raw/branch/main/setup/postinstall.sh | sh -s -- --all -> ``` - ---- - -## đŸ“Ļ **Install Scripts** - -- **🐋 `docker.sh`** - Installs Docker (Debian, Ubuntu, Fedora). - - ```bash - curl -sSL https://git.k4li.de/scripts/sh/raw/branch/main/installs/docker.sh | sh - ``` - -- **✨ `neovim.sh`** - Installs Neovim 10.0+ (Debian, Ubuntu, Fedora). - - ```bash - curl -sSL https://git.k4li.de/scripts/sh/raw/branch/main/installs/neovim.sh | sh - ``` - -- **🎨 `neovide.sh`** - Installs Neovide with Cargo (includes Cargo setup). - - ```bash - curl -sSL https://git.k4li.de/scripts/sh/raw/branch/main/installs/neovide.sh | sh - ``` - -- **âšĄī¸`xmrig.sh`** - Installs xmrig in `$HOME/.bin/xmrig/`. - - ```bash - curl -sSL https://git.k4li.de/scripts/sh/raw/branch/main/installs/xmrig.sh | sh - ``` - -- **đŸ—ƒī¸ `yazi.sh`** - Installs [yazi](https://github.com/sxyazi/yazi) with Cargo. - ```bash - curl -fsSL https://git.k4li.de/scripts/sh/raw/branch/main/installs/yazi.sh | sh - ``` - ---- - -## 📚 **Browse More** - -Explore additional scripts in the repository. Modify them or use them as-is to streamline your workflow! - ---- diff --git a/installs/docker.sh b/installs/docker.sh deleted file mode 100755 index b07d514..0000000 --- a/installs/docker.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/sh -e - -# ─< ANSI color codes >─────────────────────────────────────────────────────────────────── -RED='\033[0;31m' -CYAN='\033[0;36m' -YELLOW='\033[0;33m' -LIGHT_GREEN='\033[0;92m' -BOLD='\033[1m' -NC='\033[0m' # No Color - -echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 -} - -echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" -} - -echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" -} - -echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" -} - -check_sudo() { - # check for $su - if [ "$USER" != "root" ]; then - if command -v sudo >/dev/null 2>&1; then - su="sudo" - else - echo "Are you sure you can handle this? You're not root and sudo cannot be found.. [y/n]" - read -r sud ──────────────────────────────────────── -check_dist() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # ─< Convert $ID and $ID_LIKE to lowercase >────────────────────────────────────────────── - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop) _ubuntu ;; - debian) _debian ;; - fedora) _fedora ;; - # alpine) _alpine ;; - arch | manjaro | garuda | endeavour) _arch ;; - opensuse*) inst_opensuse ;; - *) - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - _debian - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - _ubuntu - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - _arch - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - _fedora - # elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - # _opensuse - else - echo_error "Unsupported distribution: $ID" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi -} - -_debian() { - clear - echo_info "executing debian" - sleep 2 - $su apt-get update && - $su apt-get install -y ca-certificates curl && - $su install -m 0755 -d /etc/apt/keyrings && - $su curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && - $su chmod a+r /etc/apt/keyrings/docker.asc && - sleep 0.5 - if [ "$VERSION_CODENAME" == "trixie" ]; then - VERSION_CODENAME="bookworm" - fi - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | $su tee /etc/apt/sources.list.d/docker.list >/dev/null - clear && - echo_info "Addet repository. Updating and installing now.." - sleep 1 - $su apt-get update - $su apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -} - -_ubuntu() { - clear - echo_info "executing ubuntu" - sleep 2 - $su apt-get update && - $su apt-get install -y ca-certificates curl && - $su install -m 0755 -d /etc/apt/keyrings && - $su curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && - $su chmod a+r /etc/apt/keyrings/docker.asc - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | $su tee /etc/apt/sources.list.d/docker.list >/dev/null - clear && - echo_info "Addet repository. Updating and installing now.." - sleep 0.5 - $su apt-get update - $su apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -} - -_fedora() { - clear - echo_info "executing fedora" - sleep 2 - $su dnf -y install dnf-plugins-core - $su dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo - $su dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -} - -_arch() { - clear - echo_info "executing arch" - sleep 2 - $su pacman -S docker docker-compose --noconfirm -} - -init_docker() { - if command -v docker >/dev/null 2>&1; then - echo_info "Docker was installed correctly. Do you want to add $(whoami) to the docker group? (y/n)" - read -r dgroup &2 -} - -echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" -} - -echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" -} - -echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" -} - -# ─< Silent execution >───────────────────────────────────────────────────────────────── -silentexec() { - "$@" >/dev/null 2>&1 -} - -# ─< Check if the given command exists silently >───────────────────────────────────────── -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# Check if the user is root and set sudo variable if necessary -check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_note "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_note "Root access confirmed." - _sudo="" - fi -} - -flatpak_init() { - if command_exists flatpak; then - echo_info "Flatpak exists, initializing flathub repository!" - flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - else - echo_error "Flatpak was not found!" - fi -} - -inst_arch() { - echo_note "Using Arch script, btw!" - - if command_exists yay; then - i_arch="yay" - elif command_exists paru; then - i_arch="paru" - elif command_exists pacman; then - i_arch="$_sudo pacman" - fi - - if [ -n "$i_arch" ]; then - i_arch -S flatpak - else - echo_error "No packager for installation found.. (not even pacman...)" - fi - -} - -inst_debian() { - echo_note "Using Debian script!" - if command_exists nala; then - $_sudo nala update - $_sudo nala install flatpak -y - elif command_exists apt-get; then - echo_info "Couldn't find nala, falling back to apt-get" - $_sudo apt-get update - $_sudo apt-get install flatpak -y - fi -} - -inst_ubuntu() { - echo_note "Using Ubuntu script!" - if command_exists nala; then - $_sudo nala update - $_sudo nala install flatpak -y - elif command_exists apt-get; then - echo_info "Couldn't find nala, falling back to apt-get" - $_sudo apt-get update - $_sudo apt-get install flatpak -y - fi -} - -# ─< Distribution detection and installation >──────────────────────────────────────── -get_packager() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # Convert $ID and $ID_LIKE to lowercase - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop) inst_ubuntu ;; - debian) inst_debian ;; - fedora) inst_fedora ;; - alpine) inst_alpine ;; - arch | manjaro | garuda | endeavour) inst_arch ;; - opensuse*) inst_opensuse ;; - *) - # Use standard [ ] syntax for string matching - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - inst_debian - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - inst_ubuntu - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - inst_arch - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - inst_fedora - elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - inst_opensuse - else - echo_error "Unsupported distribution: $ID" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi -} - -install_flatpak() { - check_root && - get_packager && - flatpak_init -} - -install_flatpak diff --git a/installs/ghostty.sh b/installs/ghostty.sh deleted file mode 100644 index 47ee6e5..0000000 --- a/installs/ghostty.sh +++ /dev/null @@ -1,310 +0,0 @@ -#!/bin/sh - -# ╭───────────────╮ -# │ env functions │ -# ╰───────────────╯ -# ───────────────────────────────────< ANSI color codes >─────────────────────────────────── -RED='\033[0;31m' -CYAN='\033[0;36m' -YELLOW='\033[0;33m' -LIGHT_GREEN='\033[0;92m' -BOLD='\033[1m' -NC='\033[0m' # No Color - -echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 -} - -echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" -} - -echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" -} - -echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" -} - -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# ─────────────< Check if the user is root and set sudo variable if necessary >───────────── -check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_info "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi -} - -# ──────────────────────< Check if the given command exists silently >────────────────────── -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -_cd() { - cd "$1" || echo_error "Could not cd into $1!" -} - -# ─< Distribution detection and installation >──────────────────────────────────────── -# checks for variable dist={debian,ubuntu,fedora,arch,suse} -get_packager() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # ─< Convert $ID and $ID_LIKE to lowercase >────────────────────────────────────────────── - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop | linuxmint | elementary) dist="ubuntu" ;; - debian | kali | zorin | parrot | deepin | raspbian | devuan) dist="debian" ;; - fedora | nobara | rhel | centos) dist="fedora" ;; - arch | manjaro | garuda | endeavour | artix) dist="arch" ;; - opensuse*) dist="suse" ;; - *) - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - dist="debian" - echo_note "Detected Debian-based distribution" - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - dist="ubuntu" - echo_note "Detected Ubuntu-based distribution" - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - dist="arch" - echo_note "Detected Arch-based distribution" - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - dist="fedora" - echo_note "Detected Fedora-based distribution" - elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - dist="suse" - echo_note "Detected SUSE-based distribution" - else - echo_error "Unsupported distribution: $ID" - echo_note "Please report this issue with your distribution details" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi -} - -# ╭────────────────────────────────────╮ -# │ insert your scripts/functions here │ -# ╰────────────────────────────────────╯ -# ─────────────────────────────────────< dependencies >───────────────────────────────────── -deps_common="git curl tar" -deps_arch="$deps_common gtk4 libadwaita" -deps_deb="$deps_common libgtk-4-dev libadwaita-1-dev" -deps_fedora="$deps_common gtk4-devel zig libadwaita-devel" -deps_suse="$deps_common gtk4-tools libadwaita-devel pkgconf-pkg-config zig" - -checkDeps="" -checkDeps() { - get_packager - case "$dist" in - debian | ubuntu) - pkg="apt-get" - echo "Detected packagemanager ${RED}${pkg}" - echo_info "Updating sources.." - $_sudo apt-get update - - echo_info "Checking dependencies now.." - - sleep 3 - - for dep in $deps_deb; do - if ! command_exists $dep; then - echo_info "Installing $dep.." - $_sudo apt-get install "$dep" --assume-yes /dev/null 2>&1 - $_sudo ln -rs ./zig/zig /bin/zig -} - -cloneGhostty() { - if [ ! "$checkDeps" = "done" ]; then - echo_error "Dependencies are not installed, aborting now!" - exit 1 - fi - - # buildDir=$(mktemp -d) - buildDir="$HOME/.local/ghostty-build" - if [ -d "$buildDir" ] && [ -n "$(ls -A "$buildDir")" ]; then - echo_warning "Ghostty build directory already exists at ${buildDir}, do you want to remove it? (y/n)" - read -r removeBuildDir ─────────────────────────────── -main() { - if check_root; then - checkDeps || ErrorExit "Step 1/3" - checkZig || ErrorExit "Step 2/3" - cloneGhostty || ErrorExit "Step 3/3" - else - echo_error "Something went terribly wrong!" - fi -} - -main ─────────────────────────────────── -RED='\033[0;31m' -CYAN='\033[0;36m' -YELLOW='\033[0;33m' -LIGHT_GREEN='\033[0;92m' -BOLD='\033[1m' -NC='\033[0m' # No Color - -echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 -} - -echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" -} - -echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" -} - -echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" -} - -# ─────────────< Check if the user is root and set sudo variable if necessary >───────────── -check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_info "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi -} - -# ──────────────────────< Check if the given command exists silently >────────────────────── -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# ╭────────────────────────────────────╮ -# │ insert your scripts/functions here │ -# ╰────────────────────────────────────╯ -hyprSlim="hyprland hyprland-protocols hyprwayland-scanner libhyprcursor-dev wayland-utils wayland-protocols wl-clipboard nwg-look xdg-desktop-portal-hyprland liblz4" -hyprAdvanced="$menu pavucontrol pamixer btop bluez wlogout wob" - -OPTIONAL_SCREENSHOT="grimshot slurp swappy" -OPTIONAL_SCREENRECORD="wf-recorder" -OPTIONAL_AUDIO="pulseaudio pavucontrol" -OPTIONAL_NOTIFY="sway-notification-center libnotify" -OPTIONAL_UTILS="brightnessctl network-manager-gnome gnome-keyring swayidle playerctl" -OPTIONAL_FILES="xdg-user-dirs nautilus gvfs" -OPTIONAL_SDDM_DEPS="qml6-module-qtquick-controls qml6-module-qtquick-effects sddm" - -BUILD_DEPS="git gcc make cmake meson ninja-build pkg-config" -RUST_DEPS="cargo rustc" # Separate rust dependencies - -askThings() { - echo_note "Do you want to install hyprland? (y/N)" - read -r askHyprland ─────────────────────────────── -main() { - if check_root; then - askThings - if [ "$askHyprland" = "true" ]; then - checkDependencies - instDeps - instTools - checkConfig - fi - else - echo_error "Something went terribly wrong!" - fi -} - -main diff --git a/installs/hyprpanel.sh b/installs/hyprpanel.sh deleted file mode 100644 index 8a2c7a1..0000000 --- a/installs/hyprpanel.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh -c - -# ─< ANSI color codes >─────────────────────────────────────────────────────────────────── -RED='\033[0;31m' -CYAN='\033[0;36m' -YELLOW='\033[0;33m' -LIGHT_GREEN='\033[0;92m' -BOLD='\033[1m' -NC='\033[0m' # No Color - -echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 -} - -echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" -} - -echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" -} - -echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" -} - -# ─< Check if the given command exists silently >───────────────────────────────────────── -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# ─< Check if the user is root and set sudo variable if necessary >─────────────────────── -check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_info "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi -} - -inst_arch() { - dependencies="aylurs-gtk-shell grimblast hyprpicker" - if command_exists curl; then - if [ ! -d "$HOME/.bun" ]; then - echo_info "Downloading bun and linking it.." - curl -fsSL https://bun.sh/install | bash && $_sudo ln -s $HOME/.bun/bin/bun /usr/local/bin/bun - else - echo_note "Bun is already installed" - fi - - $_sudo pacman -S pipewire libgtop bluez bluez-utils btop networkmanager dart-sass wl-clipboard brightnessctl swww python gnome-bluetooth-3.0 pacman-contrib power-profiles-daemon gvfs --noconfirm - - if command_exists yay; then - echo_info "Using yay to install $dependencies" - yay -S --noconfirm $dependencies - elif command_exists paru; then - echo_info "Using paru to install $dependencies" - paru -S --noconfirm $dependencies - else - echo_error "No aur helper found.. Cannot continue!" - exit 1 - fi - else - echo_warning "No curl was found, cannot continue!" - exit 1 - fi - -} - -clone_to_ags() { - if [ ! -d "$HOME/.config/ags" ]; then - if command_exists git; then - git clone --depth=1 https://github.com/Jas-SinghFSU/HyprPanel "$HOME/.config/ags" - else - echo_error "There was no git found, cannot continue!" - exit 1 - fi - else - echo_note "ags is already present, try running 'ags' in your terminal" - fi -} - -main() { - if check_root; then - inst_arch - clone_to_ags - fi -} - -main diff --git a/installs/install-blesh.sh b/installs/install-blesh.sh deleted file mode 100755 index 4e03c4e..0000000 --- a/installs/install-blesh.sh +++ /dev/null @@ -1,71 +0,0 @@ -{ - #!/bin/bash - # ─< Helper functions >───────────────────────────────────────────────────────────────── - echo_error() { echo -e "\033[0;1;31mError: \033[0;31m\t${*}\033[0m"; } - echo_binfo() { echo -e "\033[0;1;34mINFO:\033[0;34m\t${*}\033[0m"; } - echo_info() { echo -e "\033[0;1;35mInfo: \033[0;35m${*}\033[0m"; } - - # ─< Check if the given command exists silently >───────────────────────────────────────── - command_exists() { - command -v "$@" >/dev/null 2>&1 - } - - # ─< Check root and set sudo variable if necessary >─────────────────────────────────────────────── - check_root() { - if [[ "${EUID}" -ne 0 ]]; then - if command_exists sudo; then - echo_binfo "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_binfo "Root access confirmed." - _sudo="" - fi - } - - install_pkg() { - bash -c "$(curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/snippets/install_pkg.sh)" -- "$@" - } - - i_blesh() { - dir="$(mktemp -d)" - local deps=("bash" "git" "make" "gawk") - for pkg in "${deps[@]}"; do - if ! command_exists "$pkg"; then - install_pkg "$pkg" - fi - done && - git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git "$dir" && - make -C "$dir" install PREFIX=$HOME/.local - } - - cleanup() { - echo_info "Do you want to clear the temp dir ($dir/) which was created for installation? [Y|n]" && read -r ask_dir - case "$ask_dir" in - [Nn]) - echo_info "All right, didn't clean anything!" - ;; - [Yy] | *) - $_sudo command rm -rf "$dir/" - ;; - esac - } - - main() { - # Check root access and set _sudo - if ! check_root; then - return 1 - fi - if [[ ! -f $HOME/.local/share/blesh/ble.sh ]]; then - i_blesh - cleanup - else - echo_info "Blesh is already installed" - fi - } - - main -} diff --git a/installs/neovide.sh b/installs/neovide.sh deleted file mode 100755 index faebbd2..0000000 --- a/installs/neovide.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/sh - -# ─< ANSI color codes >─────────────────────────────────────────────────────────────────── -RED='\033[0;31m' -CYAN='\033[0;36m' -YELLOW='\033[0;33m' -LIGHT_GREEN='\033[0;92m' -BOLD='\033[1m' -NC='\033[0m' # No Color - -echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 -} - -echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" -} - -echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" -} - -echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" -} - -# ─< check if command exists silently >─────────────────────────────────────────────────── -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# ─< Silent execution >───────────────────────────────────────────────────────────────── -silentexec() { - "$@" >/dev/null 2>&1 -} - -# ─< Check if the user is root and set _sudo variable if necessary >─────────────────────── -checkRoot() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_info "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi -} - -installNeovide() { - if ! command_exists cargo; then - curl --proto '=https' --tlsv1.2 -sSf "https://sh.rustup.rs" | sh - "$HOME/.cargo/bin/cargo" install --git https://github.com/neovide/neovide - else - cargo install --git https://github.com/neovide/neovide - fi - - if [ -e "$HOME/.cargo/bin/neovide" ]; then - $_sudo ln -rs "$HOME/.cargo/bin/neovide" /bin/neovide - fi -} - -i_arch() { - deps="base-devel fontconfig freetype2 libglvnd sndio cmake git gtk3 python sdl2 vulkan-intel libxkbcommon-x11" - $_sudo pacman -Sy - for dep in $deps; do - if ! command_exists $dep; then - silentexec $_sudo pacman --noconfirm -S "$dep" || echo_error "Couldn't install $dep" - fi - done -} - -i_debian() { - $_sudo apt-get update - deps="curl gnupg ca-certificates git gcc-multilib g++-multilib cmake libssl-dev pkg-config libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev libbz2-dev libsndio-dev freeglut3-dev libxmu-dev libxi-dev libfontconfig1-dev libxcursor-dev" - for dep in $deps; do - if ! command_exists $dep; then - silentexec $_sudo apt-get install --assume-yes "$dep" || echo_error "Couldn't install $dep" - fi - done -} - -i_fedora() { - deps="fontconfig-devel freetype-devel libX11-xcb libX11-devel libstdc++-static libstdc++-devel" - $_sudo dnf update - for dep in $deps; do - if ! command_exists $dep; then - silentexec $_sudo dnf install "$dep" || echo_error "Couldn't install $dep" - fi - done - $_sudo dnf groupinstall "Development Tools" "Development Libraries" - $_sudo dnf install dnf-plugins-core -} - -checkDistrosAndDependencies() { - if [ -f /etc/os-release ]; then - echo_info "Sourcing /etc/os-release to determine the distribution..." - . /etc/os-release - - case "$ID" in - debian | ubuntu | kali | linuxmint | pop | elementary | zorin | kubuntu | neon | kdeneon | deepin | linuxlite | linuxmintdebian | linuxmintubuntu | linuxmintkali | linuxmintpop | linuxmintelementary | linuxmintzorin | linuxmintkubuntu | linuxmintneon | linuxmintkdeneon | linuxmintdeepin | linuxmintlinuxlite) i_debian ;; - arch | manjaro | endeavouros) i_arch ;; - fedora | centos | rhel | rocky | almalinux) i_fedora ;; - *) - case "$ID_LIKE" in - *debian*) i_debian ;; - *arch*) i_arch ;; - *fedora*) i_fedora ;; - *) - echo_error "Unsupported distribution: $ID" - exit 1 - ;; - esac - ;; - esac - else - echo_error "No os-release file found under /etc/. Exiting now!" - exit 1 - fi -} - -main() { - if checkRoot; then - checkDistrosAndDependencies && installNeovide - fi -} - -main diff --git a/installs/neovim.sh b/installs/neovim.sh deleted file mode 100755 index fff14a1..0000000 --- a/installs/neovim.sh +++ /dev/null @@ -1,223 +0,0 @@ -{ - #!/bin/sh -e - - # ANSI color codes - RED='\033[0;31m' - CYAN='\033[0;36m' - YELLOW='\033[0;33m' - LIGHT_GREEN='\033[0;92m' - BOLD='\033[1m' - NC='\033[0m' # No Color - - echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 - } - - echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" - } - - echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" - } - - echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" - } - - # ─< Check if the given command exists silently >───────────────────────────────────────── - command_exists() { - command -v "$@" >/dev/null 2>&1 - } - - # Check if the user is root and set sudo variable if necessary - check_root() { - if [ "$(id -u)" -ne 0 ]; then - echo_note "checked $(id -u)" - if command_exists sudo; then - echo_note "Checking sudo" - echo_warning "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi - if [ -n "$_sudo" ]; then - echo_info "--- check_root done --- echo '$_sudo' |" - else - echo_warning "sudo variable is empty: $_sudo" - fi - } - - # ─< Dependencies >───────────────────────────────────────────────────────────────────── - deps="git cargo meson luarocks pipx curl ripgrep make composer npm gcc g++ unzip zip" - - # ─< Distribution-specific installation functions >───────────────────────────────────── - inst_ubuntu() { - $_sudo apt-get update - for _deps in $deps; do - $_sudo apt-get install -y "$_deps" ──────────────────────────────────────── - get_packager() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # Convert $ID and $ID_LIKE to lowercase - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop) inst_ubuntu ;; - debian) inst_debian ;; - fedora) inst_fedora ;; - alpine) inst_alpine ;; - arch | manjaro | garuda | endeavour) inst_arch ;; - opensuse*) inst_opensuse ;; - *) - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - inst_debian - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - inst_ubuntu - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - inst_arch - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - inst_fedora - elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - inst_opensuse - else - echo_error "Unsupported distribution: $ID" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi - } - - # ─< Main function >───────────────────────────────────────────────────────────────── - main() { - if command_exists nvim; then - checkVersion - if [ "$(printf '%s\n' "$latest_version" "$currentVersion" | sort -V | head -n1)" = "$latest_version" ]; then - echo_warning "Neovim is already installed in version: $currentVersion" - echo_error "Exiting now!" - exit 0 - fi - fi - - echo_info "Starting Neovim installation script..." - get_packager - if command -v nvim >/dev/null 2>&1; then - echo_note "Neovim has been successfully installed!" - echo_info "Neovim version: $(nvim --version | head -n1)" - else - echo_error "Neovim installation failed." - exit 1 - fi - } - - # ─< Script execution >───────────────────────────────────────────────────────────── - check_root && main -} diff --git a/installs/virt-manager.sh b/installs/virt-manager.sh deleted file mode 100755 index 88a56ef..0000000 --- a/installs/virt-manager.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/sh - -# ─< ANSI color codes >─────────────────────────────────────────────────────────────────── -RED='\033[0;31m' -CYAN='\033[0;36m' -YELLOW='\033[0;33m' -LIGHT_GREEN='\033[0;92m' -BOLD='\033[1m' -NC='\033[0m' - -# ─< Initialize storage variables >─────────────────────────────────────────────────────── -_STORED_ERRORS="" -_STORED_WARNINGS="" -_STORED_INFOS="" -_STORED_NOTES="" - -# ─< echo functions that store and display messages >──────────────────────────── -echo_error() { - message="${RED}$1${NC}\n" - printf "$message" >&2 - _STORED_ERRORS="${_STORED_ERRORS}${message}" -} - -echo_warning() { - message="${YELLOW}$1${NC}\n" - printf "$message" - _STORED_WARNINGS="${_STORED_WARNINGS}${message}" -} - -echo_info() { - message="${CYAN}$1${NC}\n" - printf "$message" - _STORED_INFOS="${_STORED_INFOS}${message}" -} - -echo_note() { - message="${LIGHT_GREEN}$1${NC}\n" - printf "$message" - _STORED_NOTES="${_STORED_NOTES}${message}" -} - -# ─< Improved display function that only shows categories with content >────────────────── -display_stored_messages() { - has_messages=0 - - # ─< First check if we have any messages at all >───────────────────────────────────────── - if [ -z "$_STORED_ERRORS" ] && [ -z "$_STORED_WARNINGS" ] && [ -z "$_STORED_INFOS" ] && [ -z "$_STORED_NOTES" ]; then - return 0 - fi - - # ─< Now display each non-empty category with proper spacing >──────────────────────────── - if [ -n "$_STORED_ERRORS" ]; then - printf "\n${BOLD}${RED}=== Errors ===${NC}\n" - printf "$_STORED_ERRORS" - has_messages=1 - fi - - if [ -n "$_STORED_WARNINGS" ]; then - [ "$has_messages" -eq 1 ] && printf "\n" - printf "${BOLD}${YELLOW}=== Warnings ===${NC}\n" - printf "$_STORED_WARNINGS" - has_messages=1 - fi - - if [ -n "$_STORED_INFOS" ]; then - [ "$has_messages" -eq 1 ] && printf "\n" - printf "${BOLD}${CYAN}=== Info ===${NC}\n" - printf "$_STORED_INFOS" - has_messages=1 - fi - - if [ -n "$_STORED_NOTES" ]; then - [ "$has_messages" -eq 1 ] && printf "\n" - printf "${BOLD}${LIGHT_GREEN}=== Notes ===${NC}\n" - printf "$_STORED_NOTES" - fi -} - -# ─< Check if the given command exists silently >───────────────────────────────────────── -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# ─< Check if the user is root and set $_sudo variable if necessary >─────────────────────── -check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_binfo "User is not root. Using $_sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_binfo "Root access confirmed." - _sudo="" - fi -} - -# ─< Distribution detection and installation >──────────────────────────────────────── -get_packager() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # ─< Convert $ID and $ID_LIKE to lowercase >────────────────────────────────────────────── - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop) install_debian ;; - debian) install_debian ;; - fedora) install_fedora ;; - # alpine) inst_alpine ;; - arch | manjaro | garuda | endeavour) install_arch ;; - # opensuse*) inst_opensuse ;; - *) - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - install_debian - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - install_debian - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - inst_arch - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - install_fedora - # elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - # inst_opensuse - else - echo_error "Unsupported distribution: $ID" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi -} - -# Function to add user to the 'libvirt' group and start services -configure_libvirt() { - echo_note "Adding user to 'libvirt' group..." - $_sudo usermod -aG libvirt "$(whoami)" - - echo_note "Starting and enabling libvirt service..." - if command -v systemctl &>/dev/null; then - $_sudo systemctl start libvirtd - $_sudo systemctl enable libvirtd - else - echo_warning "systemctl command not found, skipping service management." - fi - - echo_note "Configuration complete. You might need to log out and log back in for group changes to take effect." -} - -# Install packages for Debian/Ubuntu/Pop!_OS -install_debian() { - echo_info "Updating package list..." - $_sudo apt update -y - - echo_info "Installing virt-manager, qemu-full, and related packages..." - $_sudo apt install -y virt-manager qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils - - echo_note "Installation complete on Debian/Ubuntu/Pop!_OS!" -} - -# Install packages for Fedora -install_fedora() { - echo_info "Updating package list..." - $_sudo dnf check-update -y - - echo_info "Installing virt-manager, qemu-full, and related packages..." - $_sudo dnf install -y virt-manager qemu-kvm libvirt libvirt-client bridge-utils - - echo_note "Installation complete on Fedora!" -} - -# Install packages for Arch Linux/Manjaro/EndeavourOS -install_arch() { - echo_info "Updating package list..." - $_sudo pacman -Syu --noconfirm - - echo_info "Installing virt-manager, qemu-full, and related packages..." - $_sudo pacman -S --noconfirm virt-manager qemu-full libvirt dnsmasq bridge-utils - - echo_note "Installation complete on Arch Linux/Manjaro/EndeavourOS!" -} - -# Install packages for openSUSE -install_opensuse() { - echo_info "Updating package list..." - $_sudo zypper refresh - - echo_info "Installing virt-manager, qemu-full, and related packages..." - $_sudo zypper install -y virt-manager qemu-kvm libvirt libvirt-client bridge-utils - - echo_note "Installation complete on openSUSE!" -} - -main() { - check_root && - get_packager && - configure_libvirt - - display_stored_messages -} - -main diff --git a/installs/xmrig.sh b/installs/xmrig.sh deleted file mode 100755 index 1a680e3..0000000 --- a/installs/xmrig.sh +++ /dev/null @@ -1,187 +0,0 @@ -{ - #!/bin/sh - - # ANSI color codes - RED='\033[0;31m' - CYAN='\033[0;36m' - YELLOW='\033[0;33m' - LIGHT_GREEN='\033[0;92m' - BOLD='\033[1m' - NC='\033[0m' # No Color - - echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 - } - - echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" - } - - echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" - } - - echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" - } - - # Check if the user is root and set sudo variable if necessary - check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_info "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi - } - - # < Distribution detection and installation > - get_packager() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # < Convert $ID and $ID_LIKE to lowercase > - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop) _install() { - $_sudo apt-get install "$@" --assume-yes - } ;; - debian) _install() { - $_sudo apt-get install "$@" --assume-yes - } ;; - fedora) _install() { - $_sudo dnf install "$@" -y - } ;; - alpine) _install() { - $_sudo apk add "$@" - } ;; - arch | manjaro | garuda | endeavour) _install() { - $_sudo pacman -S "$@" --noconfirm - } ;; - opensuse*) _install() { $_sudo zypper in "$@" -y; } ;; - *) - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - _install() { $_sudo apt-get install "$@" --assume-yes; } - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - _install() { $_sudo apt-get install "$@" --assume-yes; } - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - _install() { $_sudo pacman -S "$@" --noconfirm; } - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - _install() { $_sudo dnf install "$@" -y; } - elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - _install() { $_sudo zypper in "$@" -y; } - else - echo_error "Unsupported distribution: $ID" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi - } - - # Check if a command exists - command_exists() { - command -v "$@" >/dev/null 2>&1 - } - - # Install dependencies - _dependencies() { - tools="git cmake make" - packages="libuv1-dev libssl-dev libhwloc-dev argon2" - - for tool in $tools; do - if command_exists "$tool"; then - echo_note "$tool is already installed" - else - echo_info "Installing $tool.." - _install "$tool" || echo_error "Failed to install $tool" - fi - done - - for package in $packages; do - echo_info "Installing $package" - _install "$package" || echo_error "Failed to install $package" - done - - echo_note "Dependency check completed!" - } - - # Clone the repository and prepare build directory - _git() { - xmrig_dir="$HOME/.bin/xmrig" - - if [ -d "$xmrig_dir" ]; then - echo_warning "$xmrig_dir already exists. Skipping clone." - else - echo_info "Cloning xmrig repository to $xmrig_dir" - mkdir -p "$HOME/.bin" - if ! git clone --depth=1 https://github.com/xmrig/xmrig.git "$xmrig_dir"; then - echo_error "Failed to clone xmrig repository." - return 1 - fi - fi - - build_dir="$xmrig_dir/build" - mkdir -p "$build_dir" || { - echo_error "Failed to create build directory: $build_dir" - return 1 - } - - cd "$build_dir" || { - echo_error "Failed to navigate to build directory: $build_dir" - return 1 - } - } - - # Initialize and build the application - _appinit() { - echo_info "Running cmake .." - if ! cmake ..; then - echo_error "CMake failed." - return 1 - fi - - echo_info "Running make (this could take a while)" - if ! make; then - echo_error "Make failed." - return 1 - fi - - $_sudo ln -s ./xmrig /usr/bin/xmrig || "Link of application failed hard! Is not accessible at /usr/bin/xmrig" - } - - # Main function - main() { - if ! check_root; then - echo_error "Root check failed. Exiting." - return 1 - fi - - if ! get_packager; then - echo_error "Failed to detect distribution or set packager." - return 1 - fi - - _dependencies || return 1 - - if _git; then - _appinit || echo_error "Build initialization failed." - else - echo_error "Failed during Git operations." - fi - } - - main -} diff --git a/installs/yazi.sh b/installs/yazi.sh deleted file mode 100644 index 518e6e0..0000000 --- a/installs/yazi.sh +++ /dev/null @@ -1,149 +0,0 @@ -{ - #!/bin/sh -e - - # ─< ANSI color codes >─────────────────────────────────────────────────────────────────── - RED='\033[0;31m' - CYAN='\033[0;36m' - YELLOW='\033[0;33m' - LIGHT_GREEN='\033[0;92m' - BOLD='\033[1m' - NC='\033[0m' # No Color - - echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 - } - - echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" - } - - echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" - } - - echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" - } - - # ─< Check if the given command exists silently >───────────────────────────────────────── - command_exists() { - command -v "$@" >/dev/null 2>&1 - } - - # ─< Check if the user is root and set sudo variable if necessary >─────────────────────── - check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_info "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi - } - - evalCargo() { - if [ -e "$HOME/.cargo/env" ]; then - echo_note "Using $HOME/.cargo/env.." - . "$HOME/.cargo/env" - fi - } - - i_cargo() { - # if ! command_exists make || ! command_exists gcc; then - # echo_error "The script might run into issues, because of make and gcc not being installed. Please install it, and run the script again, if it fails!" - # fi - evalCargo - if command_exists cargo; then - echo_info "Installing yazi through cargo" - elif command_exists curl; then - echo_note "no cargo found, using curl to install rustup" - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - - evalCargo - - rustup update - evalCargo - - echo_info "Installing yazi through cargo" - else - echo_warning "neither cargo, nor curl were found. Cannot continue!" - fi - - cargo install --locked yazi-fm yazi-cli - - c_yazi - } - - i_arch() { - $_sudo pacman -S yazi --noconfirm - c_yazi - } - - i_opensuse() { - $_sudo zypper install yazi - c_yazi - } - - c_yazi() { - if [ -e "$HOME/.config/yazi/package.toml" ]; then - if command_exists ya; then - ya pack -i - fi - else - echo_warning "There was no yazi config found.. " - fi - } - - # ─< Distribution detection and installation >──────────────────────────────────────── - get_packager() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # ─< Convert $ID and $ID_LIKE to lowercase >────────────────────────────────────────────── - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop) i_cargo ;; - debian) i_cargo ;; - fedora) i_cargo ;; - alpine) i_cargo ;; - arch | manjaro | garuda | endeavour) i_arch ;; - opensuse*) i_opensuse ;; - *) - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - i_cargo - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - i_cargo - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - i_arch - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - i_cargo - elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - i_opensuse - else - echo_error "Unsupported distribution: $ID" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi - } - - main() { - if check_root; then - get_packager - fi - } - - main -} diff --git a/installs/ytgo.sh b/installs/ytgo.sh deleted file mode 100644 index 091e2d8..0000000 --- a/installs/ytgo.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh - -# ╭───────────────╮ -# │ env functions │ -# ╰───────────────╯ -# ───────────────────────────────────< ANSI color codes >─────────────────────────────────── -RED='\033[0;31m' -CYAN='\033[0;36m' -YELLOW='\033[0;33m' -LIGHT_GREEN='\033[0;92m' -BOLD='\033[1m' -NC='\033[0m' # No Color - -echo_error() { - printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 -} - -echo_info() { - printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1" -} - -echo_warning() { - printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" -} - -echo_note() { - printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" -} - -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# ─────────────< Check if the user is root and set sudo variable if necessary >───────────── -check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_info "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi -} - -# ──────────────────────< Check if the given command exists silently >────────────────────── -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# ╭────────────────────────────────────╮ -# │ insert your scripts/functions here │ -# ╰────────────────────────────────────╯ - -# ─< Distribution detection and installation >──────────────────────────────────────── -get_packager() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # ─< Convert $ID and $ID_LIKE to lowercase >────────────────────────────────────────────── - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop) _install() { - $_sudo apt-get install --assume-yes "$@" - } ;; - debian) _install() { - $_sudo apt-get install --assume-yes "$@" - } ;; - fedora) _install() { - $_sudo dnf install -y "$@" - } ;; - alpine) inst_alpine ;; - arch | manjaro | garuda | endeavour) _install() { - $_sudo pacman -S --noconfirm "$@" - } ;; - opensuse*) inst_opensuse ;; - *) - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - _install() { - $_sudo apt-get install --assume-yes "$@" - } - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - _install() { - $_sudo apt-get install --assume-yes "$@" - } - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - _install() { - $_sudo pacman -S --noconfirm "$@" - } - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - _install() { - $_sudo dnf install -y "$@" - } - elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - inst_opensuse - else - echo_error "Unsupported distribution: $ID" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi -} - -_dependencies() { - get_packager - if [[ "$ID" == "arch" || "$ID_LIKE" == *"arch"* ]]; then - _deps="go git mpv yt-dlp" - else - _deps="golang git mpv yt-dlp" - fi - - for dependency in $_deps; do - if ! command_exists "$dependency"; then - echo_info "Installing $dependency" - _install "$dependency" || echo_error "$dependency could not be installed!" - else - echo_note "$dependency - was already installed." - fi - done -} - -_clone() { - tmpdir="$(mktemp --dir)" - repo="https://git.k4li.de/pika/ytgo.git" - - cd "$tmpdir" || echo_error "$tmpdir is not a valid directory!" - git clone --depth=1 "$repo" - cd ytgo || echo_error "$tmpdir/ytgo is not a valid directory!" -} - -_build() { - $_sudo make install -} - -# ───────────────────────────────< main function to execute >─────────────────────────────── -main() { - if check_root; then - _dependencies || echo_error "dependency function failed hard!" - _clone || echo_error "clone function failed hard!" - _build || echo_error "build function failed hard!" - else - echo_error "Something went terribly wrong!" - fi -} - -main diff --git a/installs/zellij.sh b/installs/zellij.sh deleted file mode 100644 index bd5ab5e..0000000 --- a/installs/zellij.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env bash -generic() { - set -euo pipefail - - # Configuration - INSTALL_DIR="${HOME}/.local/bin" # Prefer ~/.local/bin (add to PATH if not already) - BINARY_NAME="zellij" - REPO="zellij-org/zellij" - TMP_DIR=$(mktemp -d) - - # Cleanup on exit - trap 'rm -rf "$TMP_DIR"' EXIT - - # Ensure install directory exists - mkdir -p "$INSTALL_DIR" - - # Check if zellij is already installed - current_version="" - if command -v "$BINARY_NAME" >/dev/null 2>&1; then - current_version=$($BINARY_NAME --version | awk '{print $2}') - echo "â„šī¸ Found existing $BINARY_NAME (version: $current_version)" - fi - - # Fetch latest release from GitHub - echo "🔍 Checking latest release of $REPO..." - latest_release=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') - latest_version=${latest_release#v} # Remove 'v' prefix (e.g., v0.42.2 → 0.42.2) - download_url="https://github.com/$REPO/releases/download/$latest_release/$BINARY_NAME-x86_64-unknown-linux-musl.tar.gz" - - # Skip if already up-to-date - if [[ "$current_version" == "$latest_version" ]]; then - echo "✅ Already on the latest version ($latest_version). No action needed." - exit 0 - fi - - # Download and install - echo "âŦ‡ī¸ Downloading $BINARY_NAME $latest_version..." - curl -sL "$download_url" | tar -xz -C "$TMP_DIR" - - echo "đŸ› ī¸ Installing to $INSTALL_DIR..." - mv -f "$TMP_DIR/$BINARY_NAME" "$INSTALL_DIR/" - - # Verify - if [[ -f "$INSTALL_DIR/$BINARY_NAME" ]]; then - chmod +x "$INSTALL_DIR/$BINARY_NAME" - echo "🎉 Successfully installed $BINARY_NAME $latest_version to $INSTALL_DIR/" - echo "💡 Ensure '$INSTALL_DIR' is in your PATH:" - echo " export PATH=\"$INSTALL_DIR:\$PATH\"" - else - echo "❌ Installation failed!" >&2 - exit 1 - fi -} - -# ─< Check if the given command exists silently >───────────────────────────────────────── -command_exists() { - command -v "$@" >/dev/null 2>&1 -} - -# ─< Check if the user is root and set sudo variable if necessary >─────────────────────── -check_root() { - if [ "$(id -u)" -ne 0 ]; then - if command_exists sudo; then - echo_info "User is not root. Using sudo for privileged operations." - _sudo="sudo" - else - echo_error "No sudo found and you're not root! Can't install packages." - return 1 - fi - else - echo_info "Root access confirmed." - _sudo="" - fi -} - -# ─< Distribution detection and installation >──────────────────────────────────────── -get_packager() { - if [ -e /etc/os-release ]; then - echo_info "Detecting distribution..." - . /etc/os-release - - # ─< Convert $ID and $ID_LIKE to lowercase >────────────────────────────────────────────── - ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]') - ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]') - - case "$ID" in - ubuntu | pop) generic ;; - debian) generic ;; - fedora) generic ;; - alpine) generic ;; - arch | manjaro | garuda | endeavour) - if command_exists paru; then - paru -S --noconfirm zellij - elif command_exists yay; then - yay -S --noconfirm zellij - fi - ;; - opensuse*) generic ;; - *) - if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then - generic - elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then - generic - elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then - $_sudo pacman -S zellij - elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then - generic - elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then - generic - else - echo_error "Unsupported distribution: $ID" - exit 1 - fi - ;; - esac - else - echo_error "Unable to detect distribution. /etc/os-release not found." - exit 1 - fi -} - -if check_root; then - get_packager -fi