install script optimizations

This commit is contained in:
pika 2025-05-04 21:19:52 +02:00
parent b039be8052
commit 80eb2617ea

View file

@ -62,6 +62,7 @@ get_packager() {
"apt") "apt")
$_sudo apt-get update $_sudo apt-get update
_install() { $_sudo apt-get install --assume-yes "$@"; } _install() { $_sudo apt-get install --assume-yes "$@"; }
arch="false"
;; ;;
"pacman") "pacman")
$_sudo pacman -Syy $_sudo pacman -Syy
@ -75,17 +76,21 @@ get_packager() {
echo_info "Using no aur helper!" echo_info "Using no aur helper!"
_install() { $_sudo pacman -S --noconfirm "$@"; } _install() { $_sudo pacman -S --noconfirm "$@"; }
fi fi
arch="true"
;; ;;
"dnf") "dnf")
$_sudo dnf update $_sudo dnf update
_install() { $_sudo dnf install -y "$@"; } _install() { $_sudo dnf install -y "$@"; }
arch="false"
;; ;;
"apk") "apk")
_install() { $_sudo apk add "$@"; } _install() { $_sudo apk add "$@"; }
arch="false"
;; ;;
"zypper") "zypper")
$_sudo zypper ref $_sudo zypper ref
_install() { $_sudo zypper in -y "$@"; } _install() { $_sudo zypper in -y "$@"; }
arch="false"
;; ;;
esac esac
fi fi
@ -113,6 +118,7 @@ __pre_stow__() {
"waybar" "waybar"
"wlogout" "wlogout"
"wob" "wob"
"zellij"
) )
if [ ! -d "$bak_dir" ]; then if [ ! -d "$bak_dir" ]; then
@ -141,7 +147,7 @@ __pre_stow__() {
fi fi
done done
for _d in ".zsh .tmux"; do for _d in ".zsh .tmux .fzf"; do
if [ -d "$HOME/$_d" ]; then if [ -d "$HOME/$_d" ]; then
mv -f "$HOME/$_d" "$bak_dir" && echo_info "Moved $_d to $bak_dir" mv -f "$HOME/$_d" "$bak_dir" && echo_info "Moved $_d to $bak_dir"
fi fi
@ -149,6 +155,11 @@ __pre_stow__() {
} }
askThings() { askThings() {
if [ ! -d ./dotfiles/.config/tmux/ ] && [ ! -d ./dotfiles/.config/zellij/ ]; then
echo_info "Choose a menu - [t]mux || [z]ellij || [n]one"
read -r askMultiPlexer </dev/tty
fi
if [ ! -d ./dotfiles/.config/rofi/ ] && [ ! -d ./dotfiles/.config/tofi/ ]; then if [ ! -d ./dotfiles/.config/rofi/ ] && [ ! -d ./dotfiles/.config/tofi/ ]; then
echo_info "Choose a menu - [r]ofi || [t]ofi" echo_info "Choose a menu - [r]ofi || [t]ofi"
read -r askMenu </dev/tty read -r askMenu </dev/tty
@ -204,10 +215,21 @@ ask_Neovide() {
case "$askNeovide" in case "$askNeovide" in
[yY]) [yY])
cloneDots "neovide" cloneDots "neovide"
neovide="true"
;; ;;
esac esac
} }
instPika() {
if ! command_exists "$1"; then
if command_exists curl; then
curl -fsSL "https://git.k4li.de/scripts/installs/raw/branch/main/${1}.sh" | bash
else
echo_warning "curl was not found, could not install $1!"
fi
fi
}
cloneDots() { cloneDots() {
choise="$1" choise="$1"
cloneName="${2:-$1}" cloneName="${2:-$1}"
@ -224,21 +246,56 @@ cloneDots() {
__validate__() { __validate__() {
if askThings; then if askThings; then
case "$askMultiPlexer" in
[tT] | tmux)
cloneDots "tmux"
plexer="tmux"
;;
[zZ] | zellij)
cloneDots "zellij"
plexer="zellij"
;;
esac
case "$askMenu" in case "$askMenu" in
[rR] | rofi) cloneDots "rofi" ;; [rR] | rofi)
[tT] | tofi) cloneDots "tofi" ;; cloneDots "rofi"
menu="rofi"
;;
[tT] | tofi)
cloneDots "tofi"
menu="tofi"
;;
esac esac
case "$askFilemgr" in case "$askFilemgr" in
[yY] | yazi) cloneDots "yazi" ;; [yY] | yazi)
[rR] | ranger) cloneDots "ranger" ;; cloneDots "yazi"
[lL] | lf) cloneDots "lf" ;; filemgr="yazi"
;;
[rR] | ranger)
cloneDots "ranger"
filemgr="ranger"
;;
[lL] | lf)
cloneDots "lf"
filemgr="lf"
;;
esac esac
case "$askBar" in case "$askBar" in
[wW] | waybar) cloneDots "waybar" ;; [wW] | waybar)
[gG] | gBar | gbar) cloneDots "gBar" ;; cloneDots "waybar"
[hH] | hyprpanel) cloneDots "hyprpanel" ;; bar="waybar"
;;
[gG] | gBar | gbar)
cloneDots "gBar"
bar="gBar"
;;
[hH] | hyprpanel)
cloneDots "hyprpanel"
bar="hyprpanel"
;;
esac esac
case "$askTerminal" in case "$askTerminal" in
@ -249,10 +306,22 @@ __validate__() {
esac esac
case "$askNvim" in case "$askNvim" in
[sS] | standard) cloneDots "nvim" && initNvim && ask_Neovide ;; [sS] | standard)
[mM] | minimal) cloneDots "nvim-mini" "nvim" && initNvim && ask_Neovide ;; neovim="true"
[aA] | astro) cloneDots "nvim-astro" "nvim" && initNvim && ask_Neovide ;; cloneDots "nvim"
[nN] | no) return 0 ;; ;;
[mM] | minimal)
neovim="true"
cloneDots "nvim-mini" "nvim"
;;
[aA] | astro)
neovim="true"
cloneDots "nvim-astro" "nvim"
;;
[nN] | no)
neovim="false"
return 0
;;
esac esac
else else
@ -263,13 +332,17 @@ __validate__() {
__dep__() { __dep__() {
_depss=( _depss=(
"$bar"
"$menu"
"$filemgr"
"$plexer"
"neovim"
"stow" "stow"
"btop" "btop"
"entr" "entr"
"unzip" "unzip"
"zip" "zip"
"fzf" "fzf"
"tmux"
"copyq" "copyq"
"rsync" "rsync"
"wezterm" "wezterm"
@ -278,12 +351,45 @@ __dep__() {
) )
for hyprdots_dependency in "${_depss[@]}"; do for hyprdots_dependency in "${_depss[@]}"; do
if ! command_exists "$hyprdots_dependency"; then case "$hyprdots_dependency" in
echo_note "--- installing $hyprdots_dependency ---" zellij)
_install "$hyprdots_dependency" instPika zellij
else ;;
echo_info "$hyprdots_dependency is already installed" yazi)
fi instPika yazi
;;
hyprpanel)
if ! command_exists hyprpanel; then
if arch; then
_install hyprpanel-ags-git
else
echo_warning "not on arch, cannot install hyprpanel.. yet.."
fi
else
echo_info "hyprpanel - already installed!"
fi
;;
neovim)
if $neovim; then
instPika neovim
initNvim
ask_Neovide
if $neovide; then
instPika neovide
fi
fi
;;
*)
if ! command_exists "$hyprdots_dependency"; then
echo_note "--- installing $hyprdots_dependency ---"
_install "$hyprdots_dependency"
else
echo_info "$hyprdots_dependency - already installed"
fi
;;
esac
done done
} }
@ -291,7 +397,7 @@ __monitors__() {
if [ ! -e "$HOME/.monitors.conf" ]; then if [ ! -e "$HOME/.monitors.conf" ]; then
res="$(hyprctl monitors | grep -oP '\d+x\d+@\d+\.\d+' | head -n 1)" res="$(hyprctl monitors | grep -oP '\d+x\d+@\d+\.\d+' | head -n 1)"
touch "$HOME/.monitors.conf" touch "$HOME/.monitors.conf"
echo "monitor = eDP-1, ${res}, 0x0, 1" >"$HOME/.monitors.conf" echo "monitor = eDP-1, ${res}, 0x0, 1" >>"$HOME/.monitors.conf"
fi fi
} }