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 #!/usr/bin/env bash
PACKAGE=hyprland
# ╭───────────────╮ # ╭───────────────╮
# │ env functions │ # │ env functions │
# ╰───────────────╯ # ╰───────────────╯
@ -11,12 +9,30 @@ command_exists() {
command -v "$@" >/dev/null 2>&1 command -v "$@" >/dev/null 2>&1
} }
if command_exists $PACKAGE; then # ─< package variable >───────────────────────────────────────────────────────────────────
echo_error "$PACKAGE is already installed!" unset PACKAGE
echo_error "Exiting now!!"
return 69 # ─< 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 fi
# ─< parse arguments and get variable contents >──────────────────────────────────────────
for arg in "$@"; do
case "$arg" in
--silent | -s)
export silent=true
;;
esac
done
# 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
@ -86,7 +102,13 @@ askThings() {
bar="waybar" bar="waybar"
;; ;;
[Hh] | hyprpanel) [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) [Gg] | gBar | gbar)
bar="gBar" bar="gBar"
@ -134,9 +156,9 @@ askThings() {
echo_info "Set terminal to $terminal" echo_info "Set terminal to $terminal"
advDeps=( advDeps=(
${menu:-rofi}
${terminal:-foot}
$bar $bar
$menu
$terminal
hyprshot hyprshot
hyprlock hyprlock
swww swww
@ -218,32 +240,58 @@ checkConfig() {
done 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 case "$distro" in
arch) arch)
local deps=( checkAndInstall "${pkgArray[@]}"
hyprland
hypridle
hyprpolkitagent
hyprland-protocols
wayland-utils
wayland-protocols
wl-clipboard
xdg-desktop-portal-hyprland
)
checkAndInstall "${deps[@]}"
;; ;;
debian) debian)
if $trixie; then if $trixie; then
local deps=( checkAndInstall "${pkgArray[@]}"
hyprland
hyprland-dev
hyprland-protocols
wayland-protocols
xdg-desktop-portal-hyprland
kitty
)
checkAndInstall "${deps[@]}"
else else
echo_error "Your current distro of debian is not sufficient, you have to have trixie (13) installed" echo_error "Your current distro of debian is not sufficient, you have to have trixie (13) installed"
echo "trixie: $trixie" echo "trixie: $trixie"
@ -255,29 +303,24 @@ main() {
fi fi
;; ;;
*) *)
echo "$distro is not supported by this script!" echo "$distro is currently not supported by this script!"
exit 1 exit 69
;; ;;
esac esac
}
main() {
if $silent; then
echo_warning "Executing script silently!"
fi
checkEnv
askThings
getDependencies
instCustom
checkConfig checkConfig
} }
setup() { if getImports; then
if getImports; then
case "$@" in
--silent | -s)
echo_info "Executing script silently.."
silent=true
;;
*) silent=false ;;
esac
fi
}
if setup "$@"; then
checkEnv
askThings
main main
instCustom
fi fi

View file

@ -6,6 +6,30 @@
command -v "$@" >/dev/null 2>&1 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: # 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
@ -34,14 +58,14 @@
echo_warning "cleaned $import" echo_warning "cleaned $import"
} }
installBuildDependencies() { getDependencies() {
echo_info "Checking build dependencies, and installs missing.." echo_info "Checking build dependencies, and installs missing.."
local depsDebian=(ninja-build gettext cmake curl build-essential) local depsDebian=(git ninja-build gettext cmake curl build-essential)
local depsFedora=(ninja-build cmake gcc make gettext curl glibc-gconv-extra) local depsFedora=(git ninja-build cmake gcc make gettext curl glibc-gconv-extra)
local depsOpensuse=(ninja cmake gcc-c++ gettext-tools curl) local depsOpensuse=(git ninja cmake gcc-c++ gettext-tools curl)
local depsArch=(base-devel cmake ninja curl) local depsArch=(git base-devel cmake ninja curl)
local depsAlpine=(build-base cmake coreutils curl gettext-tiny-dev) local depsAlpine=(git build-base cmake coreutils curl gettext-tiny-dev)
declare -A deps=( declare -A deps=(
[debian]="depsDebian" [debian]="depsDebian"
@ -117,24 +141,24 @@
fi 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 if getImports; then
case "$1" in main
--silent | -s)
silent=true
echo_warning "Running the script silently.."
;;
*)
silent=false
;;
esac
fi fi
installBuildDependencies
cloneSources
makeInstall
checkAndInitConfig
echo_note "Cleaning up old $cloneDir directory.." echo_note "Cleaning up old $cloneDir directory.."
rm -rf "$cloneDir" rm -rf "$cloneDir"
} }

View file

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

View file

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