fixed installation script. like.. hopefully..
This commit is contained in:
parent
b35287e645
commit
563ce9f013
1 changed files with 74 additions and 68 deletions
142
install.sh
142
install.sh
|
@ -1,9 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
# defaults
|
||||
menu="tofi"
|
||||
ls="eza"
|
||||
files="nautilus"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ANSI color codes
|
||||
RED='\033[0;31m'
|
||||
|
@ -29,10 +24,6 @@ echo_note() {
|
|||
printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1"
|
||||
}
|
||||
|
||||
command_exists() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
|
@ -96,12 +87,11 @@ silentexec() {
|
|||
"$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
pre_stow() {
|
||||
echo_note "pre_stow"
|
||||
__pre_stow__() {
|
||||
echo_note "__pre_stow__"
|
||||
conf="$HOME/.config"
|
||||
bak_dir="$HOME/.bak"
|
||||
dirs="
|
||||
alacritty
|
||||
btop
|
||||
zsh
|
||||
gBar
|
||||
|
@ -133,14 +123,12 @@ pre_stow() {
|
|||
done
|
||||
|
||||
h_files="
|
||||
.bashrc
|
||||
.zshrc
|
||||
.tmux.conf
|
||||
.wezterm.lua
|
||||
"
|
||||
|
||||
h_dirs="
|
||||
.qfc
|
||||
.tmux
|
||||
.zsh
|
||||
.icons
|
||||
|
@ -165,52 +153,80 @@ pre_stow() {
|
|||
}
|
||||
|
||||
askThings() {
|
||||
menu=""
|
||||
ls=""
|
||||
files=""
|
||||
|
||||
echo_info "Choose a menu - [r]ofi || [t]ofi"
|
||||
read -r askMenu </dev/tty
|
||||
|
||||
echo_info "Choose an ls helper - e[z]a || e[x]a || [l]sd"
|
||||
read -r askLs </dev/tty
|
||||
echo_info "Choose a cli filemanager - [y]azi || [r]anger || [l]f"
|
||||
read -r askFilemgr </dev/tty
|
||||
|
||||
echo_info "Choose a filemanager - [n]autilus || [t]hunar || [d]olphin || [c]aja"
|
||||
read -r askFiles </dev/tty
|
||||
echo_info "Choose a bar provider - [w]aybar || [g]Bar || [h]yprpanel"
|
||||
read -r askBar </dev/tty
|
||||
|
||||
case "$askMenu" in
|
||||
[rR] | rofi) menu="rofi" ;;
|
||||
[tT] | tofi) menu="tofi" ;;
|
||||
esac
|
||||
echo_info "Choose a Terminal config (.)(.)"
|
||||
echo_note "[G]hostty, [K]itty, [A]lacritty"
|
||||
read -r askTerminal </dev/tty
|
||||
|
||||
case "$askLs" in
|
||||
[zZ] | eza) ls="eza" ;;
|
||||
[xX] | exa) ls="exa" ;;
|
||||
[lL] | lsd) ls="lsd" ;;
|
||||
esac
|
||||
echo_info "Do you also want to install optional packages? (y/n)"
|
||||
read -r askOptional </dev/tty
|
||||
|
||||
case "$askFiles" in
|
||||
[Nn] | nautilus) files="nautilus" ;;
|
||||
[Tt] | thunar) files="thunar" ;;
|
||||
[Dd] | dolphin) files="dolphin" ;;
|
||||
case "$askOptional" in
|
||||
[yY]) __optional__="true" ;;
|
||||
[nN]) __optional__="false" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
_dep() {
|
||||
cloneDots() {
|
||||
choise="$1"
|
||||
|
||||
if command_exists git; then
|
||||
[ -d ./dotfiles ] &&
|
||||
[ ! -d "./dotfiles/${choise}" ] &&
|
||||
git clone --depth=1 "https://git.k4li.de/dotfiles/${choise}.git" "./dotfiles/.config/${choise}"
|
||||
|
||||
else
|
||||
echo_error "Git was not found"
|
||||
fi
|
||||
}
|
||||
|
||||
__validate__() {
|
||||
if askThings; then
|
||||
case "$askMenu" in
|
||||
[rR] | rofi) cloneDots "rofi" ;;
|
||||
[tT] | tofi) cloneDots "tofi" ;;
|
||||
esac
|
||||
|
||||
case "$askFilemgr" in
|
||||
[yY] | yazi) cloneDots "yazi" ;;
|
||||
[rR] | ranger) cloneDots "ranger" ;;
|
||||
[lL] | lf) cloneDots "lf" ;;
|
||||
esac
|
||||
|
||||
case "$askBar" in
|
||||
[wW] | waybar) cloneDots "waybar" ;;
|
||||
[gG] | gBar | gbar) cloneDots "gBar" ;;
|
||||
[hH] | hyprpanel) cloneDots "hyprpanel" ;;
|
||||
esac
|
||||
|
||||
case "$askTerminal" in
|
||||
[gG] | ghostty) cloneDots "ghostty" ;;
|
||||
[kK] | kitty) cloneDots "kitty" ;;
|
||||
[aA] | alacritty) cloneDots "alacritty" ;;
|
||||
esac
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
__dep__() {
|
||||
_depss="
|
||||
wezterm
|
||||
btop
|
||||
$menu
|
||||
$files
|
||||
$ls
|
||||
entr
|
||||
yazi
|
||||
unzip
|
||||
zip
|
||||
fzf
|
||||
zoxide
|
||||
tmux
|
||||
thunar
|
||||
grimshot
|
||||
copyq
|
||||
wlogout
|
||||
|
@ -227,21 +243,19 @@ _dep() {
|
|||
|
||||
_monitors() {
|
||||
if [ ! -e "$HOME/.monitors.conf" ]; then
|
||||
local res="$(hyprctl monitors | grep -oP '\d+x\d+@\d+\.\d+' | head -n 1)"
|
||||
touch "$HOME/.monitors.conf"
|
||||
echo "monitor = eDP-1, primary, 0x0, 1" >"$HOME/.monitors.conf"
|
||||
echo "monitor = eDP-1, ${res}, 0x0, 1" >"$HOME/.monitors.conf"
|
||||
fi
|
||||
}
|
||||
|
||||
_optional() {
|
||||
echo_info "Do you also want to install optional packages? (y/n)"
|
||||
read -r optional_ </dev/tty
|
||||
|
||||
pkg_optional() {
|
||||
_ops="
|
||||
cowsay
|
||||
cmatrix
|
||||
trash-cli
|
||||
"
|
||||
case "$optional_" in
|
||||
case "$_ops" in
|
||||
Y | y)
|
||||
for _o_ in $_ops; do
|
||||
if command_exists "$_o_"; then
|
||||
|
@ -271,29 +285,15 @@ _optional() {
|
|||
fi
|
||||
}
|
||||
|
||||
_stow() {
|
||||
__stow__() {
|
||||
stow --verbose --target="$HOME" --defer=.gitmodules --restow */
|
||||
}
|
||||
|
||||
main() {
|
||||
check_root
|
||||
get_packager
|
||||
# askThings
|
||||
|
||||
terminal="wezterm"
|
||||
|
||||
if ! command_exists "$terminal"; then
|
||||
echo_warning "$terminal was not found on the system. It's crucial, as the default terminal for this config is $terminal. Would you like to install $terminal and some other dependencies? (y/n): "
|
||||
read -r _deps
|
||||
case "$_deps" in
|
||||
Y | y)
|
||||
_dep
|
||||
;;
|
||||
*)
|
||||
echo default
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
__validate__
|
||||
|
||||
if ! command_exists stow; then
|
||||
echo_error "we couldn't find stow on the machine, do you want us to install it? (y/n): "
|
||||
|
@ -303,17 +303,23 @@ main() {
|
|||
_install stow
|
||||
;;
|
||||
*)
|
||||
echo default
|
||||
echo_error "You cannot proceed without installing stow! Please install manually"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo_info "stow was found, going on to prepare to stow your config"
|
||||
sleep 0.3
|
||||
pre_stow
|
||||
_stow
|
||||
fi
|
||||
|
||||
_optional
|
||||
__pre_stow__
|
||||
__stow__
|
||||
|
||||
sleep 2
|
||||
|
||||
[ "$__optional__" -eq "true" ] &&
|
||||
pkg_optional
|
||||
|
||||
_monitors
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue