testing new style

This commit is contained in:
pika 2025-05-24 11:26:09 +02:00
parent 7e4f33689c
commit 7d3b35eafe

View file

@ -21,8 +21,8 @@ command_exists() {
# CAUTION:
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
# not every package packagemanager has the same packagenames for their packages..
getImports() {
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
source-script() {
i="https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh"
import="$(mktemp)"
if command_exists curl; then
curl -fsSL $i -o $import
@ -36,29 +36,6 @@ getImports() {
rm "$import"
}
checkEnv() {
if $debian; then
echo_info "Using debian.. checking for compatibility.."
if ! $trixie; then
echo_error "You are not using trixie, this script can currently only run on trixie (13)!"
echo_error "trixie: $trixie"
echo_error "bookworm: $bookworm"
echo_error "bullseye: $bullseye"
echo_error "buster: $buster"
return 69
else
echo_info "Using trixie.. good choice"
return 0
fi
elif $arch; then
echo_info "Using arch linux.. You really shouldn't get any errors :)"
return 0
else
echo_error "Cannot install $PACKAGE for $distro"
return 69
fi
}
askThings() {
# if ! command_exists waybar && ! command_exists hyprpanel && ! command_exists gBar; then
case "$distro" in
@ -69,65 +46,16 @@ askThings() {
esac
[[ $bar == hyprpanel ]] && [[ $distro == arch ]] && bar=ags-hyprpanel-git
# read -r askBar </dev/tty
# case "$askBar" in
# [Ww] | waybar)
# bar="waybar"
# ;;
# [Hh] | hyprpanel)
# if $debian; then
# echo_warning "hyprpanel is not available for $distro"
# echo_warning "the script automatically chose gBar for you instead.."
# bar="gBar"
# else
# bar="hyprpanel"
# fi
# ;;
# [Gg] | gBar | gbar)
# bar="gBar"
# ;;
# esac
# echo_info "Set bar to $bar"
# fi
pen grey "$bar was picked"
# if ! command_exists rofi && ! command_exists tofi; then
choose menu "Choose a menu.." rofi tofi </dev/tty
# read -r askRofi </dev/tty
# case "$askRofi" in
# [tT] | tofi)
# menu="tofi"
# ;;
# [rR] | rofi)
# menu="rofi"
# ;;
# *)
# menu="rofi"
# ;;
# esac
# echo_info "Set menu to $menu"
# fi
pen grey "$menu was picked"
line
# echo_note "What terminal to you want to install? [a]lacritty, [f]oot, [k]itty, [w]ezterm"
choose terminal "Choose a menu.." alacritty foot kitty wezterm </dev/tty
# read -r askTerminal </dev/tty
# case "$askTerminal" in
# [aA] | alacritty)
# terminal="alacritty"
# ;;
# [fF] | foot)
# terminal="foot"
# ;;
# [kK] | kitty)
# terminal="kitty"
# ;;
# [wW] | wezterm)
# terminal="wezterm"
# ;;
# *)
# terminal="foot"
# ;;
# esac
# echo_info "Set terminal to $terminal"
pen grey "$terminal was picked"
line
advDeps=(
"${menu:-rofi}"
@ -142,59 +70,72 @@ askThings() {
instCustom() {
for _d in "${advDeps[@]}"; do
case "$_d" in
hyprpanel)
hyprpanel | hyprlock | hyprshot | gBar | rofi | swww)
# eval "$(curl -fsSL https://git.k4li.de/scripts/installs/raw/branch/main/hyprpanel.sh)"
source_script https://git.k4li.de/scripts/installs/raw/branch/main/hyprpanel.sh
source_script https://git.k4li.de/scripts/installs/raw/branch/main/$_d.sh
;;
hyprlock)
source_script https://git.k4li.de/scripts/installs/raw/branch/main/hyprlock.sh
;;
hyprshot)
source_script https://git.k4li.de/scripts/installs/raw/branch/main/hyprshot.sh
;;
gBar)
source_script https://git.k4li.de/scripts/installs/raw/branch/main/gBar.sh
;;
rofi)
source_script https://git.k4li.de/scripts/installs/raw/branch/main/rofi.sh
;;
swww)
source_script https://git.k4li.de/scripts/installs/raw/branch/main/swww.sh
# hyprlock)
# source_script https://git.k4li.de/scripts/installs/raw/branch/main/hyprlock.sh
# ;;
# hyprshot)
# source_script https://git.k4li.de/scripts/installs/raw/branch/main/hyprshot.sh
# ;;
# gBar)
# source_script https://git.k4li.de/scripts/installs/raw/branch/main/gBar.sh
# ;;
# rofi)
# source_script https://git.k4li.de/scripts/installs/raw/branch/main/rofi.sh
# ;;
# swww)
# source_script https://git.k4li.de/scripts/installs/raw/branch/main/swww.sh
# ;;
none)
return
;;
*)
checkAndInstall "$_d"
check-and-install "$_d"
;;
esac
done
}
cloneDotfiles() {
echo_info "Which dotfiles do you want to clone? ([p]ika's config, or just type the link to your own repo)"
pen blue bold "Which dotfiles do you want to clone? (if you choose 'own' you will be asked to put in a url for your neovim config repo)"
choose askDotfiles2 "What dotfiles do you want to choose?" "pika's" own none </dev/tty
# read -r askDotfiles2 </dev/tty
case "$askDotfiles2" in
"pika's")
echo_info "Cloning pika's config..."
run git clone --recursive --depth=1 https://git.k4li.de/dotfiles/hyprdots.git "$HOME/dotfiles" || { echo_error "Failed to clone dotfiles!" && exit 1; }
spin blue bold "Cloning pika's config..."
if run git clone --recursive --depth=1 https://git.k4li.de/dotfiles/hyprdots.git "$HOME/dotfiles"; then
upclear
check "Cloned dotfiles"
else
upclear
throw bold red "Failed to clone dotfiles!"
return 69
fi
cd $HOME/git/hyprdots || { echo_error "Failed to clone dotfiles!" && exit 1; }
cd $HOME/dotfiles || { echo-error "Failed to change dir into dotfiles.." && exit 1; }
echo_info "Installing dotfiles..."
make </dev/tty || { echo_error "Failed to install dotfiles!" && exit 1; }
pen blue bold "Installing dotfiles..."
line
echo_info "Dotfiles installed successfully!"
make </dev/tty || { echo-error "Failed to install dotfiles!" && exit 1; }
pen blue bold "Dotfiles installed successfully!"
;;
own)
request customDots "Type in the url of your hyprland dotfiles:"
git clone --recursive --depth=1 $customDots "$HOME/dotfiles" || { echo_error "Failed to clone dotfiles!" && exit 1; }
# *)
# echo_info "Cloning dotfiles from $askDotfiles2..."
# git clone --recursive --depth=1 $askDotfiles2 $HOME/git/hyprdots
#
# cd $HOME/git/hyprdots || { echo_error "Failed to clone dotfiles!" && exit 1; }
#
# echo_info "Your dotfiles have been saved to $HOME/git/hyprdots"
# echo_info "You can now install your dotfiles how you want to!"
request customDots "Type in the url of your hyprland dotfiles:" </dev/tty
sleep 1
spin blue bold "Getting your dotfiles from $customDots"
if run git clone --recursive --depth=1 "$customDots" "$HOME/dotfiles"; then
upclear
check "Cloned dotfiles"
else
upclear
throw bold red "Failed to clone dotfiles!"
return 69
fi
;;
none)
return
@ -206,24 +147,20 @@ checkConfig() {
dirs="hypr $menu $bar"
for i in $dirs; do
if [ ! -d "$HOME/.config/$i" ]; then
echo_warning "Config directory $i not found!"
echo_note "Do you want to clone some dotfiles? (y/N)"
read -r askDotfiles </dev/tty
case "$askDotfiles" in
[yY])
echo_info "Cloning dotfiles..."
pen bold yellow "Config directory $i not found!"
if confirm "Do you want to clone some dotfiles?" </dev/tty; then
pen blue bold "Cloning dotfiles..."
cloneDotfiles
;;
[nN])
echo_note "Skipping dotfiles installation..."
;;
esac
fi
# breaking out of the loop, so that it doesn't get called for every missing dir
break
fi
done
}
getDependencies() {
echo_info "Checking build dependencies.."
pen blue bold "Checking build dependencies.."
# INFO:
# ╭─────────────────────────────────────────────────────────────────────────╮
@ -274,15 +211,15 @@ getDependencies() {
case "$distro" in
arch)
checkAndInstall "${generalDeps[@]}"
checkAndInstall "${pkgArray[@]}"
checkAndInstall ${generalDeps[@]}
checkAndInstall ${pkgArray[@]}
;;
debian)
if $trixie; then
checkAndInstall "${generalDeps[@]}"
checkAndInstall "${pkgArray[@]}"
checkAndInstall ${generalDeps[@]}
checkAndInstall ${pkgArray[@]}
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 "bookworm: $bookworm"
echo "bullseye: $bullseye"
@ -298,6 +235,37 @@ getDependencies() {
esac
}
setup-env() {
# local beddu=https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh
# local pika=https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh
local dream=https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh
if ! command_exists pkg-install && ! command_exists check-and-install && ! command_exists spin; then
source-script $dream
fi
if $debian; then
pen blue bold "Using debian.. checking for compatibility.."
if ! $trixie; then
echo-error "You are not using trixie, this script can currently only run on trixie (13)!"
echo-error "trixie: $trixie"
echo-error "bookworm: $bookworm"
echo-error "bullseye: $bullseye"
echo-error "buster: $buster"
return 69
else
pen blue bold "Using trixie.. good choice"
return 0
fi
elif $arch; then
pen blue bold "Using arch linux.. You really shouldn't get any errors :)"
return 0
else
echo-error "Cannot install $PACKAGE for $distro"
return 69
fi
}
main() {
askThings
@ -307,8 +275,6 @@ main() {
silent=false
fi
checkEnv
getDependencies
instCustom
if [[ ! -d "$HOME/dotfiles" ]]; then
@ -318,8 +284,7 @@ main() {
# checkConfig
}
if getImports; then
source-script "https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh"
if setup-env; then
# ─< package variable >───────────────────────────────────────────────────────────────────
unset PACKAGE