wip
This commit is contained in:
parent
c7e49404ea
commit
43e88a3223
3 changed files with 53 additions and 31 deletions
|
@ -84,7 +84,7 @@ getDependencies() {
|
|||
case "$pkg" in
|
||||
hyprutils)
|
||||
if checkComp; then
|
||||
eval "$(curl -fsSL https://git.k4li.de/scripts/installs/raw/branch/main/hyprutils.sh)"
|
||||
eval "$(curl -fsSL https://git.k4li.de/scripts/installs/raw/branch/main/hypr/hyprutils.sh)"
|
||||
fi
|
||||
;;
|
||||
*)
|
76
hyprlock.sh
76
hyprlock.sh
|
@ -1,10 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
PACKAGE=hyprlock
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if command_exists $PACKAGE; then
|
||||
echo_warning "$PACKAGE is alread installed!"
|
||||
echo_warning "Exiting now!"
|
||||
exit 69
|
||||
fi
|
||||
|
||||
# WHY:
|
||||
# This import will give you the following variables:
|
||||
# _sudo="sudo -E" <- only if non root user
|
||||
|
@ -42,20 +50,20 @@ getDependencies() {
|
|||
# │ You can define dependencies for various linux distros here. It will │
|
||||
# │ automagically be pulled via the $pkgArray[$distro] variable │
|
||||
# ╰─────────────────────────────────────────────────────────────────────────╯
|
||||
depsDebian=(libcairo2-dev mesa-common-dev cmake libgbm-dev libdrm-dev libopengl-dev wayland-protocols wayland-utils libsdbus-c++-dev)
|
||||
depsDebian=(libcairo2-dev mesa-common-dev cmake libgbm-dev libdrm-dev libopengl-dev wayland-protocols wayland-utils libsdbus-c++-dev libhyprlang-dev hyprgraphics)
|
||||
# depsUbuntu=()
|
||||
depsFedora=()
|
||||
depsOpensuse=()
|
||||
depsArch=()
|
||||
depsAlpine=()
|
||||
# depsFedora=()
|
||||
# depsOpensuse=()
|
||||
# depsArch=()
|
||||
# depsAlpine=()
|
||||
|
||||
declare -A deps=(
|
||||
[debian]="depsDebian"
|
||||
[ubuntu]="depsUbuntu"
|
||||
[fedora]="depsFedora"
|
||||
[arch]="depsArch"
|
||||
[alpine]="depsAlpine"
|
||||
[opensuse]="depsOpensuse"
|
||||
# [ubuntu]="depsUbuntu"
|
||||
# [fedora]="depsFedora"
|
||||
# [arch]="depsArch"
|
||||
# [alpine]="depsAlpine"
|
||||
# [opensuse]="depsOpensuse"
|
||||
)
|
||||
|
||||
# INFO:
|
||||
|
@ -64,17 +72,43 @@ getDependencies() {
|
|||
# ╰────────────────────────────────────────────────────────────────╯
|
||||
declare -n pkgArray="${deps[$distro]}"
|
||||
|
||||
case "$distro" in
|
||||
debian | ubuntu | arch | fedora | alpine | opensuse) checkAndInstall "${pkgArray[@]}" ;;
|
||||
for pkg in "${pkgArray[@]}"; do
|
||||
case "$pkg" in
|
||||
hyprgraphics)
|
||||
if checkComp; then
|
||||
eval "$(curl -fsSL https://git.k4li.de/scripts/installs/raw/branch/main/hypr/hyprgraphics.sh)"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo_error "Cannot install for $distro"
|
||||
return 69
|
||||
if checkComp; then
|
||||
checkAndInstall "$pkg"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
build() {
|
||||
echo_info "Building $package"
|
||||
run cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
|
||||
run cmake --build ./build --config Release --target hyprlock -j$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)
|
||||
}
|
||||
|
||||
cloneAndBuild() {
|
||||
local cloneDir="$(mktemp -d)"
|
||||
|
||||
cd $cloneDir || mkdir -p $cloneDir && cd $cloneDir
|
||||
|
||||
git clone https://github.com/hyprwm/hyprlock.git &&
|
||||
cd hyprlock
|
||||
|
||||
if build; then
|
||||
echo_info "Installing $PACKAGE.."
|
||||
$_sudo cmake --install build
|
||||
else
|
||||
echo_error "Build has failed for $distro compiling $package"
|
||||
return 69
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
|
@ -83,19 +117,7 @@ main() {
|
|||
_install hyprlock
|
||||
;;
|
||||
debian)
|
||||
echo "debian"
|
||||
;;
|
||||
ubuntu)
|
||||
echo "ubuntu"
|
||||
;;
|
||||
fedora)
|
||||
echo "fedora"
|
||||
;;
|
||||
alpine)
|
||||
echo "alpine"
|
||||
;;
|
||||
opensuse)
|
||||
echo "opensuse"
|
||||
cloneAndBuild
|
||||
;;
|
||||
*)
|
||||
echo "$distro is not supported by this script!"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue