some fancy shit..

This commit is contained in:
pika 2025-06-02 14:29:30 +02:00
parent 1ff329b738
commit 2ef5a2ece8

View file

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