Fixed the install.sh?

This commit is contained in:
pika 2025-05-29 09:20:15 +02:00
parent d739193681
commit f0452e060b

View file

@ -33,6 +33,15 @@ source-script() {
fi
}
get-dependencies() {
depends=(
stow
git
)
check-and-install ${depends[@]}
}
__pre_stow__() {
pen blue "Getting things ready.."
sleep 2
@ -193,7 +202,7 @@ __validate__() {
else
echo-error "Something went terribly wrong"
exit 1
exit 69
fi
}
@ -228,11 +237,7 @@ __dep__() {
instPika yazi
;;
hyprland)
# if ! $arch; then
instPika hyprland
# else
# pkg-install hyprland hypridle hyprshot
# fi
;;
hyprpanel)
instPika hyprpanel
@ -240,17 +245,24 @@ __dep__() {
neovim)
if $neovim; then
instPika neovim
if confirm "Do you also want to install a neovide config?"; then
if confirm "Do you also want to install a neovide config?" </dev/tty; then
instPika neovide
fi
fi
;;
*)
spin bold yellow "Installing $hyprdots_dependency.."
if ! command_exists "$hyprdots_dependency"; then
# echo_note "--- installing $hyprdots_dependency ---"
spin bold yellow "Installing $hyprdots_dependency.."
run --err err pkg-install "$hyprdots_dependency" && check "$hyprdots_dependency installed" || throw "$hyprdots_dependency could not get installed" && echo-error "${err:-}"
if run --err err pkg-install "$hyprdots_dependency"; then
upclear
check "$hyprdots_dependency installed"
else
upclear
throw bold yellow "$hyprdots_dependency could not get installed"
echo-error "${err:-}"
fi
else
upclear
check bold green "$hyprdots_dependency - $(pen yellow bold already installed)"
fi
;;
@ -286,36 +298,53 @@ pkg_optional() {
}
__stow__() {
local err
spin grey "Linking dotfiles.."
local err out
spin grey bold "Linking dotfiles.."
run --err err stow --verbose --target="$HOME" --defer=.gitmodules --restow */ && check "Linked dotfiles!" ||
throw "Could not use stow to link dofiles.." &&
if run --err err stow --verbose --target="$HOME" --defer=.gitmodules --restow */; then
upclear
check "Linked dotfiles!"
else
upclear
throw bold red "Could not use stow to link dofiles.."
pen bold yellow "OUT: ${out:-}"
echo-error "${err:-}"
fi
}
c_fonts() {
local err
local err out
local dirFonts="$HOME/.local/share/fonts/"
local fontsRepo="https://git.k4li.de/pika/fonts.git"
if [[ ! -d "$dirFonts" ]]; then
if choose "Seems like you may miss some fonts.. Do you want to clone them now into $(pen blue bold $HOME/.local/share/fonts)" </dev/tty; then
if confirm "Seems like you may miss some fonts.. Do you want to clone them now into $(pen blue bold $HOME/.local/share/fonts)" </dev/tty; then
if ! command_exists git; then
spin "Installing dependencies.."
run pkg-install git && check "Installed git!" || throw "Couldn't install git!" && return 69
if run --err err --out out pkg-install git; then
upclear
check "Installed git!"
else
upclear
throw "Couldn't install git!"
pen bold yellow "OUT: ${out:-}"
echo-error "${err:-}"
fi
else
git clone --depth=1 https://git.k4li.de/pika/fonts.git "$dirFonts"
spin bold yellow "Cloning fonts from $fontsRepo"
if run --err err --out out git clone --depth=1 https://git.k4li.de/pika/fonts.git "$dirFonts"; then
upclear
check "Cloned fonts correctly!"
else
upclear
throw "Error cloning fonts!"
pen bold yellow "OUT: ${out:-}"
echo-error "${err:-}"
fi
fi
spin "Cloning fonts now.. This might take a while.."
run --err err git clone --depth=1 https://git.k4li.de/pika/fonts.git "$dirFonts" && check "Cloned fonts correctly!" || throw "Error cloning fonts!" && echo-error "${err:-}"
# ;;
# [Nn])
else
pen bold red "You might have some font issues, but that's your business now!"
return
fi
else
pen bold yellow "Fonts are already present at $dirFonts"
fi
}
@ -371,25 +400,28 @@ main() {
mkdirs
if ! command_exists stow; then
if confirm "We couldn't find stow on the machine, do you want us to install it?"; then
line
spin grey "Installing stow now.."
if run --err err pkg-install stow; then
upclear
check "Stow was installed correctly!"
else
upclear
throw-err
fi
else
pen red bold "You cannot proceed without installing stow! Please install manually"
exit 1
fi
else
pen blue "Stow was found, going on to prepare to stow your config"
sleep 0.3
fi
# obsolete becouse of __dep__() function..
# if ! command_exists stow; then
# if confirm "We couldn't find stow on the machine, do you want us to install it?"; then
# line
# spin grey "Installing stow now.."
# if run --err err pkg-install stow; then
# upclear
# check "Stow was installed correctly!"
# else
# upclear
# throw bold red "Error installing stow.."
# pen bold yellow "OUT: ${out:-}"
# echo-error "${err:-}"
# fi
# else
# pen red bold "You cannot proceed without installing stow! Please install manually"
# exit 69
# fi
# else
# pen blue bold "Stow was found, going on to prepare to stow your config"
# sleep 0.3
# fi
__pre_stow__
__stow__