This commit is contained in:
pika 2025-05-24 02:34:45 +02:00
parent ec2d014f9d
commit d657ae4f4b

55
gbar.sh
View file

@ -19,7 +19,7 @@
# 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() { getImports() {
local url="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh" local url="https://git.k4li.de/scripts/imports/raw/branch/main/dreams.sh"
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
@ -36,7 +36,7 @@
} }
getDependencies() { getDependencies() {
echo_info "Checking build dependencies.." # pen bold yellow "Checking build dependencies.."
# INFO: # INFO:
# ╭─────────────────────────────────────────────────────────────────────────╮ # ╭─────────────────────────────────────────────────────────────────────────╮
@ -65,38 +65,51 @@
declare -n pkgArray="${deps[$distro]}" declare -n pkgArray="${deps[$distro]}"
case "$distro" in case "$distro" in
debian | ubuntu) checkAndInstall "${pkgArray[@]}" ;; debian | ubuntu) checkAndInstall ${pkgArray[@]} ;;
arch) return 0 ;; arch) return 0 ;;
*) *)
echo_error "Cannot install for $distro" echo-error "Cannot install for $distro"
return 69 return 69
;; ;;
esac esac
} }
main() { main() {
if $silent; then # if $silent; then
echo_warning "Executing script silently!" # echo_warning "Executing script silently!"
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
arch) arch)
checkAndInstall gbar-git checkAndInstall gbar-git bluez
;; ;;
debian | ubuntu) debian | ubuntu)
local cloneDir="$(mktemp -d)" local cloneDir="$(mktemp -d)"
echo_pkg clone "Cloning gBar source into $cloneDir/gbar" # echo_pkg clone "Cloning gBar source into $cloneDir/gbar"
spin bold yellow "Cloning gBar source into $cloneDir/gbar"
cd "$cloneDir" || mkdir "$cloneDir" && cd "$cloneDir" cd "$cloneDir" || silentexec mkdir "$cloneDir" && cd "$cloneDir"
git clone --depth=1 https://github.com/scorpion-26/gBar.git gbar && cd gbar if run --err err git clone --depth=1 https://github.com/scorpion-26/gBar.git gbar; then
check "Cloned $PACKAGE-sources"
cd gbar
else
throw "Error cloning $PACKAGE-sources!"
echo-error "${err:-}"
fi
run meson setup build spin "Building $PACKAGE.."
if run meson setup build && run ninja -C build; then
check "Build $PACKAGE"
else
throw "Error building $PACKAGE"
echo-error "${err:-}"
fi
run ninja -C build # run ninja -C build
$_sudo ninja -C build install $_sudo ninja -C build install
@ -105,7 +118,7 @@
if command_exists gBar; then if command_exists gBar; then
echo_pkg post-installation-check "Gbar was installed successfully" echo_pkg post-installation-check "Gbar was installed successfully"
else else
echo_warning "Something went wrong.. maybe.." pen bold yellow "Something went wrong.. maybe.."
fi fi
;; ;;
*) *)
@ -115,7 +128,13 @@
esac esac
} }
if getImports; then setup-env() {
if ! command_exists pkg-install && ! command_exists pen; then
getImports
fi
}
if setup-env; then
# ─< package variable >─────────────────────────────────────────────────────────────────── # ─< package variable >───────────────────────────────────────────────────────────────────
unset PACKAGE unset PACKAGE
@ -126,8 +145,8 @@
PACKAGE=gBar PACKAGE=gBar
if command_exists "$PACKAGE"; then if command_exists "$PACKAGE"; then
echo_warning "$PACKAGE is already installed!" pen bold yellow "$PACKAGE is already installed!"
echo_warning "Exiting now!" pen bold yellow "Exiting now!"
exit 69 exit 69
fi fi