testing more..

This commit is contained in:
pika 2025-05-24 12:58:57 +02:00
parent a32fca2999
commit 6564b42649

View file

@ -7,44 +7,44 @@ command_exists() {
command -v "$@" >/dev/null 2>&1 command -v "$@" >/dev/null 2>&1
} }
# WHY: source-script() {
# This import will give you the following variables: local url="$1"
# _sudo="sudo -E" <- only if non root user
# distro = <distro name, like 'arch', 'debian', 'fedora'..>
# arch = bool
# fedora = bool
# opensuse = bool....
# 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.
# CAUTION:
# 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..
getImports() {
local url="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
local import="$(mktemp)" 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" # ─< if $1 is a local file, source this one instead >─────────────────────────────────────
sleep 0.2 if [ -f "$url" ]; then
rm "$import" source "$url"
sleep 0.1
return 0
else
# ─< if $1 is a url, grab it and source it, also deletes afterwards >─────────────────────
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"
line
sleep 0.1
rm -f "$import"
fi
} }
checkComp() { checkComp() {
if ! $arch && ! $debian; then if ! $arch && ! $debian; then
echo_error "Your distro $distro is not compatible with this script" echo-error "Your distro $distro is not compatible with this script"
return 69 return 69
fi fi
if $debian; then if $debian; then
if ! $trixie; then if ! $trixie; then
echo_error "Your debian version is not compatible with this script" echo-error "Your debian version is not compatible with this script"
return 69 return 69
fi fi
fi fi
@ -80,26 +80,49 @@ getDependencies() {
# ╰────────────────────────────────────────────────────────────────╯ # ╰────────────────────────────────────────────────────────────────╯
declare -n pkgArray="${deps[$distro]}" declare -n pkgArray="${deps[$distro]}"
for pkg in "${pkgArray[@]}"; do case "$distro" in
case "$pkg" in arch) check-and-install ${pkgArray[@]} ;;
hyprgraphics) debian)
case "$distro" in for pkg in "${pkgArray[@]}"; do
arch) checkAndInstall hyprgraphics ;; case "$pkg" in
debian) hyprgraphics)
cloneAndBuildUtils cloneAndBuildUtils
cloneAndBuildGraphics cloneAndBuildGraphics
cloneAndBuildScanner cloneAndBuildScanner
cloneAndBuildLang cloneAndBuildLang
;; ;;
*)
pkg-install $pkg
;;
esac esac
;; done
*) ;;
if checkComp; then *)
checkAndInstall "$pkg" pen bold red "Cannot install currently for $distro!"
fi return 69
;; ;;
esac esac
done
# for pkg in "${pkgArray[@]}"; do
# case "$pkg" in
# hyprgraphics)
# case "$distro" in
# arch) check-and-install hyprgraphics ;;
# debian)
# cloneAndBuildUtils
# cloneAndBuildGraphics
# cloneAndBuildScanner
# cloneAndBuildLang
# ;;
# esac
# ;;
# *)
# if checkComp; then
# check-and-install "$pkg"
# fi
# ;;
# esac
# done
} }
buildGraphicsAndUtils() { buildGraphicsAndUtils() {
@ -112,7 +135,7 @@ cloneAndBuildGraphics() {
PACKAGE=hyprgraphics PACKAGE=hyprgraphics
if command_exists $PACKAGE; then if command_exists $PACKAGE; then
echo_error "hyprlang is already installed!" echo-error "hyprlang is already installed!"
return 69 return 69
fi fi
@ -126,7 +149,7 @@ cloneAndBuildGraphics() {
echo_pkg install echo_pkg install
$_sudo cmake --install build $_sudo cmake --install build
else else
echo_error "Build has failed for $distro compiling hyprgraphics" echo-error "Build has failed for $distro compiling hyprgraphics"
return 69 return 69
fi fi
} }
@ -135,7 +158,7 @@ cloneAndBuildUtils() {
PACKAGE=hyprutils PACKAGE=hyprutils
if command_exists $PACKAGE; then if command_exists $PACKAGE; then
echo_error "hyprlang is already installed!" echo-error "hyprlang is already installed!"
return 69 return 69
fi fi
@ -153,7 +176,7 @@ cloneAndBuildUtils() {
echo_pkg install echo_pkg install
$_sudo cmake --install build $_sudo cmake --install build
else else
echo_error "Build has failed for $distro compiling hyprutils" echo-error "Build has failed for $distro compiling hyprutils"
return 69 return 69
fi fi
} }
@ -168,7 +191,7 @@ cloneAndBuildScanner() {
PACKAGE=hyprwayland-scanner PACKAGE=hyprwayland-scanner
if command_exists $PACKAGE; then if command_exists $PACKAGE; then
echo_error "hyprlang is already installed!" echo-error "hyprlang is already installed!"
return 69 return 69
fi fi
@ -185,7 +208,7 @@ cloneAndBuildScanner() {
echo_pkg install echo_pkg install
$_sudo cmake --install build $_sudo cmake --install build
else else
echo_error "Build has failed for $distro compiling hyprlock" echo-error "Build has failed for $distro compiling hyprlock"
return 69 return 69
fi fi
} }
@ -200,7 +223,7 @@ cloneAndBuildLang() {
PACKAGE=hyprlang PACKAGE=hyprlang
if command_exists $PACKAGE; then if command_exists $PACKAGE; then
echo_error "hyprlang is already installed!" echo-error "hyprlang is already installed!"
return 69 return 69
fi fi
@ -217,7 +240,7 @@ cloneAndBuildLang() {
echo_pkg install "Installing hyprlang" echo_pkg install "Installing hyprlang"
$_sudo cmake --install build $_sudo cmake --install build
else else
echo_error "Build has failed for $distro compiling hyprlock" echo-error "Build has failed for $distro compiling hyprlock"
return 69 return 69
fi fi
} }
@ -244,7 +267,7 @@ cloneAndBuildLock() {
echo_pkg install echo_pkg install
$_sudo cmake --install build $_sudo cmake --install build
else else
echo_error "Build has failed for $distro compiling hyprlock" echo-error "Build has failed for $distro compiling hyprlock"
return 69 return 69
fi fi
} }
@ -255,7 +278,7 @@ main() {
fi fi
if ! getDependencies; then if ! getDependencies; then
echo_error "Error when installing dependencies.." echo-error "Error when installing dependencies.."
fi fi
case "$distro" in case "$distro" in
@ -266,13 +289,24 @@ main() {
cloneAndBuildLock cloneAndBuildLock
;; ;;
*) *)
echo_error "$distro is not supported by this script!" echo-error "$distro is not supported by this script!"
exit 1 exit 1
;; ;;
esac esac
} }
if getImports; then setup-env() {
# local beddu=https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.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
if ! command_exists pkg-install && ! command_exists check-and-install && ! command_exists spin; then
source-script $dream
line
fi
}
if setup-env; then
# ─< package variable >─────────────────────────────────────────────────────────────────── # ─< package variable >───────────────────────────────────────────────────────────────────
unset PACKAGE unset PACKAGE