diff --git a/blesh.sh b/blesh.sh deleted file mode 100644 index 8780309..0000000 --- a/blesh.sh +++ /dev/null @@ -1,71 +0,0 @@ -{ - #!/usr/bin/env 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/scripts/installs/raw/branch/main/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/flatpak.sh b/flatpak.sh deleted file mode 100644 index b359506..0000000 --- a/flatpak.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env 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" -} - -# ─< 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/postinstall2.sh b/postinstall2.sh deleted file mode 100644 index e79f838..0000000 --- a/postinstall2.sh +++ /dev/null @@ -1,357 +0,0 @@ -{ - #!/bin/sh - - # ╭──────────────╮ - # │ dependencies │ - # ╰──────────────╯ - deps="7zip bc btop exa fzf gawk gdu git make pv ripgrep rsync stow tmux trash-cli unzip zoxide zsh" - - # ╭─────────────╮ - # │ ENVIRONMENT │ - # ╰─────────────╯ - # 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="" - - # Modified 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}" - } - - # ─< Check if the given command exists silently >───────────────────────────────────────── - command_exists() { - command -v "$@" >/dev/null 2>&1 - } - - # ─────────────────────────────────────< get packager >───────────────────────────────────── - checkPkg() { - pkger="" - for pkg in apt-get dnf pacman apk zypper; do - if command_exists $pkg; then - printf "Using ${RED}${pkg}${NC} method.." - pkger="$pkg" - - # break - return 0 - fi - done - } - - # ─────────────────────────────────< check for root/sudo >─────────────────────────────── - # 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 -E" - 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 - # } - - # ╭─────╮ - # │ apt │ - # ╰─────╯ - aptCommentCDinSources() { - # Path to sources.list - sources_file="/etc/apt/sources.list" - - # Check if file exists - if [ ! -f "$sources_file" ]; then - echo_error "Error: $sources_file not found" - return 1 - fi - - # Comment out CD-ROM entries using sudo - $_sudo sed -i 's/^[[:space:]]*deb[[:space:]]\+cdrom:/#&/' "$sources_file" - echo_info "CD-ROM entries have been commented out in $sources_file" - } - - aptBase() { - aptCommentCDinSources - echo_info "Updating sources.." - $_sudo apt update - - if ! command_exists sudo; then - echo_note "Installing sudo" - apt install sudo --assume-yes - fi - - echo_note "Installing base packages: $deps" - - for _deps in $deps; do - if ! command_exists "$_deps"; then - echo_info "Installing $_deps.." - if ! $_sudo apt install "$_deps" --assume-yes; then - echo_error "$_deps - failed to install!" - fi - else - echo_note "$_deps - was already installed!" - fi - done - } - - aptOptimize() { - if command_exists nala; then - echo_info "Nala is already present, fetching mirros now! (This might take a minute or two, depending on your internet speed)" - $_sudo nala fetch --auto --assume-yes --https-only - else - echo_note "Nala is not installed on the system, do you want to install it now? (Y/n): " - read -r inst_nala