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