This commit is contained in:
pika 2025-05-18 18:26:57 +02:00
parent b194b822c8
commit 17fa06a193
4 changed files with 139 additions and 72 deletions

View file

@ -1,7 +1,5 @@
#!/usr/bin/env bash
PACKAGE=hyprland
# ╭───────────────╮
# │ env functions │
# ╰───────────────╯
@ -11,12 +9,30 @@ command_exists() {
command -v "$@" >/dev/null 2>&1
}
if command_exists $PACKAGE; then
echo_error "$PACKAGE is already installed!"
echo_error "Exiting now!!"
return 69
# ─< package variable >───────────────────────────────────────────────────────────────────
unset PACKAGE
# ─< argument list variables >────────────────────────────────────────────────────────────
silent=false
sleep 0.1
PACKAGE=hyprland
if command_exists "$PACKAGE"; then
echo_warning "$PACKAGE is already installed!"
echo_warning "Exiting now!"
exit 69
fi
# ─< parse arguments and get variable contents >──────────────────────────────────────────
for arg in "$@"; do
case "$arg" in
--silent | -s)
export silent=true
;;
esac
done
# WHY:
# This import will give you the following variables:
# _sudo="sudo -E" <- only if non root user
@ -86,7 +102,13 @@ askThings() {
bar="waybar"
;;
[Hh] | hyprpanel)
bar="hyprpanel"
if ! $debian; then
bar="hyprpanel"
else
echo_warning "hyprpanel is not available for $distro"
echo_warning "the script automatically chose gBar for you instead.."
bar="gBar"
fi
;;
[Gg] | gBar | gbar)
bar="gBar"
@ -134,9 +156,9 @@ askThings() {
echo_info "Set terminal to $terminal"
advDeps=(
${menu:-rofi}
${terminal:-foot}
$bar
$menu
$terminal
hyprshot
hyprlock
swww
@ -218,32 +240,58 @@ checkConfig() {
done
}
main() {
getDependencies() {
echo_info "Checking build dependencies.."
# INFO:
# ╭─────────────────────────────────────────────────────────────────────────╮
# │ You can define dependencies for various linux distros here. It will │
# │ automagically be pulled via the $pkgArray[$distro] variable │
# ╰─────────────────────────────────────────────────────────────────────────╯
depsDebian=(
hyprland
hyprland-dev
hyprland-protocols
wayland-protocols
xdg-desktop-portal-hyprland
kitty
)
depsFedora=()
depsOpensuse=()
depsArch=(
hyprland
hypridle
hyprpolkitagent
hyprland-protocols
wayland-utils
wayland-protocols
wl-clipboard
xdg-desktop-portal-hyprland
)
depsAlpine=()
declare -A deps=(
[debian]="depsDebian"
[ubuntu]="depsUbuntu"
[fedora]="depsFedora"
[arch]="depsArch"
[alpine]="depsAlpine"
[opensuse]="depsOpensuse"
)
# INFO:
# ╭────────────────────────────────────────────────────────────────╮
# │ This variable stores the packages you provided for each distro │
# ╰────────────────────────────────────────────────────────────────╯
declare -n pkgArray="${deps[$distro]}"
case "$distro" in
arch)
local deps=(
hyprland
hypridle
hyprpolkitagent
hyprland-protocols
wayland-utils
wayland-protocols
wl-clipboard
xdg-desktop-portal-hyprland
)
checkAndInstall "${deps[@]}"
checkAndInstall "${pkgArray[@]}"
;;
debian)
if $trixie; then
local deps=(
hyprland
hyprland-dev
hyprland-protocols
wayland-protocols
xdg-desktop-portal-hyprland
kitty
)
checkAndInstall "${deps[@]}"
checkAndInstall "${pkgArray[@]}"
else
echo_error "Your current distro of debian is not sufficient, you have to have trixie (13) installed"
echo "trixie: $trixie"
@ -255,29 +303,24 @@ main() {
fi
;;
*)
echo "$distro is not supported by this script!"
exit 1
echo "$distro is currently not supported by this script!"
exit 69
;;
esac
}
main() {
if $silent; then
echo_warning "Executing script silently!"
fi
checkEnv
askThings
getDependencies
instCustom
checkConfig
}
setup() {
if getImports; then
case "$@" in
--silent | -s)
echo_info "Executing script silently.."
silent=true
;;
*) silent=false ;;
esac
fi
}
if setup "$@"; then
checkEnv
askThings
if getImports; then
main
instCustom
fi

View file

@ -6,6 +6,30 @@
command -v "$@" >/dev/null 2>&1
}
# ─< package variable >───────────────────────────────────────────────────────────────────
unset PACKAGE
# ─< argument list variables >────────────────────────────────────────────────────────────
silent=false
sleep 0.1
PACKAGE=neovim
if command_exists "$PACKAGE"; then
echo_warning "$PACKAGE is already installed!"
echo_warning "Exiting now!"
exit 69
fi
# ─< parse arguments and get variable contents >──────────────────────────────────────────
for arg in "$@"; do
case "$arg" in
--silent | -s)
export silent=true
;;
esac
done
# WHY:
# This import will give you the following variables:
# _sudo="sudo -E" <- only if non root user
@ -34,14 +58,14 @@
echo_warning "cleaned $import"
}
installBuildDependencies() {
getDependencies() {
echo_info "Checking build dependencies, and installs missing.."
local depsDebian=(ninja-build gettext cmake curl build-essential)
local depsFedora=(ninja-build cmake gcc make gettext curl glibc-gconv-extra)
local depsOpensuse=(ninja cmake gcc-c++ gettext-tools curl)
local depsArch=(base-devel cmake ninja curl)
local depsAlpine=(build-base cmake coreutils curl gettext-tiny-dev)
local depsDebian=(git ninja-build gettext cmake curl build-essential)
local depsFedora=(git ninja-build cmake gcc make gettext curl glibc-gconv-extra)
local depsOpensuse=(git ninja cmake gcc-c++ gettext-tools curl)
local depsArch=(git base-devel cmake ninja curl)
local depsAlpine=(git build-base cmake coreutils curl gettext-tiny-dev)
declare -A deps=(
[debian]="depsDebian"
@ -117,24 +141,24 @@
fi
}
main() {
if $silent; then
echo_warning "Executing script silently!"
fi
if ! getDependencies; then
echo_error "Error when installing dependencies.."
fi
cloneSources
makeInstall
checkAndInitConfig
}
if getImports; then
case "$1" in
--silent | -s)
silent=true
echo_warning "Running the script silently.."
;;
*)
silent=false
;;
esac
main
fi
installBuildDependencies
cloneSources
makeInstall
checkAndInitConfig
echo_note "Cleaning up old $cloneDir directory.."
rm -rf "$cloneDir"
}

View file

@ -14,7 +14,7 @@
sleep 0.1
PACKAGE=packagename
PACKAGE=rofi
if command_exists "$PACKAGE"; then
echo_warning "$PACKAGE is already installed!"
echo_warning "Exiting now!"

View file

@ -14,7 +14,7 @@
sleep 0.1
PACKAGE=packagename
PACKAGE=swww
if command_exists "$PACKAGE"; then
echo_warning "$PACKAGE is already installed!"
echo_warning "Exiting now!"