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