diff --git a/postinstall.sh b/postinstall.sh index ed7dabb..8fa3375 100644 --- a/postinstall.sh +++ b/postinstall.sh @@ -3,16 +3,16 @@ PACKAGE=postinstallation # ─< Check if the given command exists silently >───────────────────────────────────────── -command_exists() { +command-exists() { command -v "$@" >/dev/null 2>&1 } source-script() { local url="$1" local import="$(mktemp)" - if command_exists curl; then + if command-exists curl; then curl -fsSL $url -o $import - elif command_exists wget; then + elif command-exists wget; then wget -o $import $url else echo "curl/wget is required, but missing.." @@ -24,7 +24,7 @@ source-script() { rm "$import" } -getDependencies() { +get-dependencies() { pen bold blue "Checking build dependencies.." # INFO: @@ -85,6 +85,7 @@ getDependencies() { # ╭────────────────────────────────────────────────────────────────╮ # │ This variable stores the packages you provided for each distro │ # ╰────────────────────────────────────────────────────────────────╯ + # declare -n pkgArray="${deps[$distro]}" case "$distro" in @@ -106,7 +107,7 @@ removeBloat() { if ! $arch; then spin "Removing bloat.." for pkg in "${generalBloat[@]}"; do - if run --err err pkg-remove $pkg; then + if run --err err pkg-remove "$pkg"; then upclear check "Removed $pkg" else @@ -115,11 +116,13 @@ removeBloat() { echo-error "${err:-}" fi done + else + pen bold blue "There are no pacakges to remove on arch.." fi } -_nala() { - if command_exists nala; then +init-nala() { + if command-exists nala; then # pen bold blue "Nala is already present, fetching mirros now!" # pen bold yellow "(This might take a minute or two, depending on your internet speed)" if confirm "Nala is already present. Do you want to auto fetch the best mirrors?"; then @@ -148,7 +151,7 @@ main() { fi # Getting general dependencies - if ! getDependencies; then + if ! get-dependencies; then echo-error "Error when installing dependencies.." fi @@ -172,7 +175,7 @@ main() { echo-error "Error: $sources_file not found" fi fi - _nala + init-nala ;; *) pen bold yellow "There are no distro specific things to install for your distro: $(pen bold red $distro)" @@ -197,7 +200,7 @@ setup-env() { # local pika=https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh local dream=https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh - if ! command_exists pkg-install && ! command_exists check-and-install && ! command_exists spin; then + if ! command-exists pkg-install && ! command-exists check-and-install && ! command-exists spin; then source-script $dream line fi