This commit is contained in:
pika 2025-05-24 02:44:09 +02:00
parent ca72254d60
commit e7a1a851a8

View file

@ -6,6 +6,26 @@
command -v "$@" >/dev/null 2>&1 command -v "$@" >/dev/null 2>&1
} }
getImports() {
local url="$1"
local import="$(mktemp)"
if command_exists curl; then
curl -fsSL $url -o $import
elif command_exists wget; then
wget -O $import $url
else
echo "curl/wget is required, but missing.."
exit 69
fi
source "$import"
echo "${BLUE}Sourcing external script:${NC} $url"
sleep 0.1
rm -f "$import"
}
setup-env() {
# WHY: # WHY:
# This import will give you the following variables: # This import will give you the following variables:
# _sudo="sudo -E" <- only if non root user # _sudo="sudo -E" <- only if non root user
@ -15,35 +35,29 @@
# opensuse = bool.... # opensuse = bool....
# You can then use it for, `if $arch; then` # You can then use it for, `if $arch; then`
# Also this gives you the _install command, which installs a package pased on the packagemanager/distro used. # Also this gives you the _install command, which installs a package pased on the packagemanager/distro used.
#
# CAUTION: # CAUTION:
# This only wokrs for generic package names, like neovim, or vim, or tmux etc.. # This only wokrs for generic package names, like neovim, or vim, or tmux etc..
# not every package packagemanager has the same packagenames for their packages.. # not every package packagemanager has the same packagenames for their packages..
getImports() { #
local url="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh" # local beddu=https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh
local import="$(mktemp)" # local pika=https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh
if command_exists curl; then # dream ~= combined beddu and pika
curl -fsSL $url -o $import local dream=https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh
elif command_exists wget; then
wget -o $import $url
else
echo "curl/wget is required, but missing.."
exit 69
fi
source "$import" if ! command_exists pkg-install && ! command_exists check-and-install && ! command_exists pen; then
sleep 0.1 getImports $dream
rm -f "$import" fi
} }
getDependencies() { getDependencies() {
echo_info "Checking build dependencies.."
# INFO: # INFO:
# ╭─────────────────────────────────────────────────────────────────────────╮ # ╭─────────────────────────────────────────────────────────────────────────╮
# │ You can define dependencies for various linux distros here. It will │ # │ You can define dependencies for various linux distros here. It will │
# │ automagically be pulled via the $pkgArray[$distro] variable │ # │ automagically be pulled via the $pkgArray[$distro] variable │
# ╰─────────────────────────────────────────────────────────────────────────╯ # ╰─────────────────────────────────────────────────────────────────────────╯
depsDebian=() depsDebian=()
depsUbuntu=()
depsFedora=() depsFedora=()
depsOpensuse=() depsOpensuse=()
depsArch=() depsArch=()
@ -66,10 +80,10 @@
case "$distro" in case "$distro" in
debian | ubuntu | arch | fedora | alpine | opensuse) debian | ubuntu | arch | fedora | alpine | opensuse)
checkAndInstall "${pkgArray[@]}" check-and-install ${pkgArray[@]}
;; ;;
*) *)
echo_error "There are no dependencies to install for $distro" pen bold yellow "There are no dependencies to install for $distro"
return 69 return 69
;; ;;
esac esac
@ -77,11 +91,11 @@
main() { main() {
if $silent; then if $silent; then
echo_warning "Executing script silently!" pen yellow "ARG: Executing script silently!"
fi fi
if ! getDependencies; then if ! getDependencies; then
echo_error "Error when installing dependencies.." throw "Error when installing dependencies.."
fi fi
case "$distro" in case "$distro" in