Updated dotfiles
This commit is contained in:
parent
bca1293df3
commit
b13376dc1b
5 changed files with 181 additions and 103 deletions
111
fancy-fre.sh
Executable file
111
fancy-fre.sh
Executable file
|
|
@ -0,0 +1,111 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
TOOLS_FILE="$(dirname "$0")/tools.yaml"
|
||||||
|
LOGFILE="$(dirname "$0")/quick-install.log"
|
||||||
|
|
||||||
|
log() { echo "[INFO] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
||||||
|
log_warn() { echo "[WARN] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
||||||
|
log_err() { echo "[ERROR] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
||||||
|
|
||||||
|
require_tools() {
|
||||||
|
for tool in yq gum; do
|
||||||
|
if ! command -v "$tool" &>/dev/null; then
|
||||||
|
log_err "This script requires '$tool'. Please install it first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
get_tools_for_category() {
|
||||||
|
local category="$1"
|
||||||
|
yq e ".${category}[]" "$TOOLS_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_and_prepare_install_list() {
|
||||||
|
local category="$1"
|
||||||
|
local install_list=()
|
||||||
|
local ppas_to_add=()
|
||||||
|
|
||||||
|
# Read each item (YAML block) in the category
|
||||||
|
local length
|
||||||
|
length=$(yq e "length(.${category})" "$TOOLS_FILE")
|
||||||
|
for i in $(seq 0 $((length - 1))); do
|
||||||
|
local name ppa
|
||||||
|
name=$(yq e ".${category}[$i].name" "$TOOLS_FILE")
|
||||||
|
ppa=$(yq e ".${category}[$i].ppa // \"\"" "$TOOLS_FILE")
|
||||||
|
|
||||||
|
if ! command -v "$name" &>/dev/null; then
|
||||||
|
install_list+=("$name")
|
||||||
|
if [[ -n "$ppa" ]]; then
|
||||||
|
ppas_to_add+=("$ppa")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove duplicate PPAs
|
||||||
|
mapfile -t ppas_to_add < <(printf '%s\n' "${ppas_to_add[@]}" | sort -u)
|
||||||
|
|
||||||
|
echo "${install_list[*]}"
|
||||||
|
echo "${ppas_to_add[*]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_category() {
|
||||||
|
local category="$1"
|
||||||
|
|
||||||
|
log "Processing category: $category"
|
||||||
|
|
||||||
|
read -r -a to_install ppas < <(check_and_prepare_install_list "$category")
|
||||||
|
|
||||||
|
if [[ ${#to_install[@]} -eq 0 ]]; then
|
||||||
|
log "All tools in '$category' are already installed."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show the user what will be installed
|
||||||
|
gum style --foreground 212 --bold "Category: $category"
|
||||||
|
gum style --foreground 99 "The following tools will be installed:"
|
||||||
|
printf '%s\n' "${to_install[@]}" | gum format
|
||||||
|
|
||||||
|
if ! gum confirm "Proceed with installing these tools?"; then
|
||||||
|
log_warn "User declined installation for category: $category"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add PPAs if any
|
||||||
|
if [[ ${#ppas[@]} -gt 0 ]]; then
|
||||||
|
for ppa in "${ppas[@]}"; do
|
||||||
|
log "Adding PPA: $ppa"
|
||||||
|
sudo add-apt-repository -y "$ppa"
|
||||||
|
done
|
||||||
|
sudo apt update
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Installing packages for category: $category"
|
||||||
|
sudo apt install -y "${to_install[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
require_tools
|
||||||
|
log "Starting tool installation from $TOOLS_FILE"
|
||||||
|
|
||||||
|
# Read all top-level categories from tools.yaml
|
||||||
|
mapfile -t categories < <(yq e 'keys | .[]' "$TOOLS_FILE")
|
||||||
|
|
||||||
|
# Let user select categories to install
|
||||||
|
selected_categories=$(gum choose --no-limit --header "Select categories to install:" "${categories[@]}")
|
||||||
|
|
||||||
|
if [[ -z "$selected_categories" ]]; then
|
||||||
|
log_warn "No categories selected. Exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Loop through selected categories and install
|
||||||
|
while IFS= read -r category; do
|
||||||
|
install_category "$category"
|
||||||
|
done <<< "$selected_categories"
|
||||||
|
|
||||||
|
log "✅ All done."
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
115
fre.sh
115
fre.sh
|
|
@ -2,108 +2,63 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
TOOLS_FILE="$(dirname "$0")/tools.yaml"
|
TOOLS_FILE="$(dirname "$0")/tools.yaml"
|
||||||
LOGFILE="$(dirname "$0")/quick-install.log"
|
LOGFILE="$(dirname "$0")/install.log"
|
||||||
|
|
||||||
log() { echo "[INFO] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
log() { echo "[INFO] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
||||||
log_warn() { echo "[WARN] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
log_warn() { echo "[WARN] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
||||||
log_err() { echo "[ERROR] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
log_err() { echo "[ERROR] $(date '+%F %T') $*" | tee -a "$LOGFILE"; }
|
||||||
|
|
||||||
require_tools() {
|
require_yq() {
|
||||||
for tool in yq gum; do
|
if ! command -v yq &>/dev/null; then
|
||||||
if ! command -v "$tool" &>/dev/null; then
|
log_err "This script requires 'yq'. Install it via 'sudo apt install yq'."
|
||||||
log_err "This script requires '$tool'. Please install it first."
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
get_tools_for_category() {
|
|
||||||
local category="$1"
|
|
||||||
yq e ".${category}[]" "$TOOLS_FILE"
|
|
||||||
}
|
|
||||||
|
|
||||||
check_and_prepare_install_list() {
|
|
||||||
local category="$1"
|
|
||||||
local install_list=()
|
|
||||||
local ppas_to_add=()
|
|
||||||
|
|
||||||
# Read each item (YAML block) in the category
|
|
||||||
local length
|
|
||||||
length=$(yq e "length(.${category})" "$TOOLS_FILE")
|
|
||||||
for i in $(seq 0 $((length - 1))); do
|
|
||||||
local name ppa
|
|
||||||
name=$(yq e ".${category}[$i].name" "$TOOLS_FILE")
|
|
||||||
ppa=$(yq e ".${category}[$i].ppa // \"\"" "$TOOLS_FILE")
|
|
||||||
|
|
||||||
if ! command -v "$name" &>/dev/null; then
|
|
||||||
install_list+=("$name")
|
|
||||||
if [[ -n "$ppa" ]]; then
|
|
||||||
ppas_to_add+=("$ppa")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Remove duplicate PPAs
|
|
||||||
mapfile -t ppas_to_add < <(printf '%s\n' "${ppas_to_add[@]}" | sort -u)
|
|
||||||
|
|
||||||
echo "${install_list[*]}"
|
|
||||||
echo "${ppas_to_add[*]}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_category() {
|
install_category() {
|
||||||
local category="$1"
|
local category="$1"
|
||||||
|
|
||||||
log "Processing category: $category"
|
log "Processing category: $category"
|
||||||
|
|
||||||
read -r -a to_install ppas < <(check_and_prepare_install_list "$category")
|
# Loop over all items under the category
|
||||||
|
local tools
|
||||||
|
tools=$(yq e ".${category}[]" "$TOOLS_FILE" | sed 's/^- //')
|
||||||
|
|
||||||
if [[ ${#to_install[@]} -eq 0 ]]; then
|
local install_list=()
|
||||||
log "All tools in '$category' are already installed."
|
while IFS= read -r item; do
|
||||||
return
|
local tool
|
||||||
fi
|
tool=$(yq e ".${category}[] | select(.name == \"$item\") | .name // \"$item\"" "$TOOLS_FILE")
|
||||||
|
local ppa
|
||||||
|
ppa=$(yq e ".${category}[] | select(.name == \"$item\") | .ppa // \"\"" "$TOOLS_FILE")
|
||||||
|
|
||||||
# Show the user what will be installed
|
if command -v "$tool" &>/dev/null; then
|
||||||
gum style --foreground 212 --bold "Category: $category"
|
log "$tool already installed, skipping."
|
||||||
gum style --foreground 99 "The following tools will be installed:"
|
else
|
||||||
printf '%s\n' "${to_install[@]}" | gum format
|
if [[ -n "$ppa" ]]; then
|
||||||
|
log "Adding PPA: $ppa for $tool"
|
||||||
|
sudo add-apt-repository -y "$ppa"
|
||||||
|
fi
|
||||||
|
install_list+=("$tool")
|
||||||
|
fi
|
||||||
|
done <<< "$tools"
|
||||||
|
|
||||||
if ! gum confirm "Proceed with installing these tools?"; then
|
if [[ ${#install_list[@]} -gt 0 ]]; then
|
||||||
log_warn "User declined installation for category: $category"
|
log "Installing: ${install_list[*]}"
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add PPAs if any
|
|
||||||
if [[ ${#ppas[@]} -gt 0 ]]; then
|
|
||||||
for ppa in "${ppas[@]}"; do
|
|
||||||
log "Adding PPA: $ppa"
|
|
||||||
sudo add-apt-repository -y "$ppa"
|
|
||||||
done
|
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
sudo apt install -y "${install_list[@]}"
|
||||||
|
else
|
||||||
|
log "All tools in $category already installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Installing packages for category: $category"
|
|
||||||
sudo apt install -y "${to_install[@]}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
require_tools
|
require_yq
|
||||||
log "Starting tool installation from $TOOLS_FILE"
|
log "Starting tool installation from $TOOLS_FILE"
|
||||||
|
|
||||||
# Read all top-level categories from tools.yaml
|
# Define which categories to process
|
||||||
mapfile -t categories < <(yq e 'keys | .[]' "$TOOLS_FILE")
|
local categories=("necessities" "modern" "privacy")
|
||||||
|
for category in "${categories[@]}"; do
|
||||||
# Let user select categories to install
|
|
||||||
selected_categories=$(gum choose --no-limit --header "Select categories to install:" "${categories[@]}")
|
|
||||||
|
|
||||||
if [[ -z "$selected_categories" ]]; then
|
|
||||||
log_warn "No categories selected. Exiting."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Loop through selected categories and install
|
|
||||||
while IFS= read -r category; do
|
|
||||||
install_category "$category"
|
install_category "$category"
|
||||||
done <<< "$selected_categories"
|
done
|
||||||
|
|
||||||
log "✅ All done."
|
log "✅ All done."
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
tools.yaml
19
tools.yaml
|
|
@ -3,25 +3,27 @@
|
||||||
necessities:
|
necessities:
|
||||||
- apt
|
- apt
|
||||||
- apt-utils
|
- apt-utils
|
||||||
|
- btop
|
||||||
- curl
|
- curl
|
||||||
- fd-find
|
- fd-find
|
||||||
- fzf
|
- fzf
|
||||||
- git
|
- git
|
||||||
- gnupg
|
- gnupg
|
||||||
- gzip
|
- gzip
|
||||||
|
- helix
|
||||||
- jq
|
- jq
|
||||||
- less
|
- less
|
||||||
- lsb-release
|
- mtr
|
||||||
- nala
|
- nala
|
||||||
- ncdu
|
- ncdu
|
||||||
- net-tools
|
# - net-tools
|
||||||
|
- parallel
|
||||||
- ripgrep
|
- ripgrep
|
||||||
- sed
|
- sed
|
||||||
- sudo
|
- stow
|
||||||
- tar
|
- tar
|
||||||
|
- tldr
|
||||||
- tmux
|
- tmux
|
||||||
- tree
|
|
||||||
- unzip
|
|
||||||
- util-linux
|
- util-linux
|
||||||
- vim
|
- vim
|
||||||
- wget
|
- wget
|
||||||
|
|
@ -41,12 +43,10 @@ privacy:
|
||||||
- mat2
|
- mat2
|
||||||
- mullvad-browser
|
- mullvad-browser
|
||||||
- protonvpn-cli
|
- protonvpn-cli
|
||||||
- protonvpn-stable-release
|
|
||||||
- veracrypt
|
- veracrypt
|
||||||
|
|
||||||
modern_cli:
|
modern_cli:
|
||||||
- bat
|
- bat
|
||||||
- btop
|
|
||||||
- delta
|
- delta
|
||||||
- duf
|
- duf
|
||||||
- dust
|
- dust
|
||||||
|
|
@ -54,14 +54,12 @@ modern_cli:
|
||||||
- exa
|
- exa
|
||||||
- fd-find
|
- fd-find
|
||||||
- gitui
|
- gitui
|
||||||
- helix
|
|
||||||
- micro
|
- micro
|
||||||
- most
|
- most
|
||||||
- nnn
|
- nnn
|
||||||
- procs
|
- procs
|
||||||
- silversearcher-ag
|
- silversearcher-ag
|
||||||
- taskwarrior
|
- taskwarrior
|
||||||
- tldr
|
|
||||||
- tig
|
- tig
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
|
|
@ -72,6 +70,8 @@ dev:
|
||||||
- docker-compose
|
- docker-compose
|
||||||
- gcc-12-base
|
- gcc-12-base
|
||||||
- jq
|
- jq
|
||||||
|
- lazydocker
|
||||||
|
- lazygit
|
||||||
- libclang-dev
|
- libclang-dev
|
||||||
- npm
|
- npm
|
||||||
- openjdk-17-jre
|
- openjdk-17-jre
|
||||||
|
|
@ -86,7 +86,6 @@ desktop:
|
||||||
- cmatrix
|
- cmatrix
|
||||||
- feh
|
- feh
|
||||||
- flameshot
|
- flameshot
|
||||||
- kitty
|
|
||||||
- neofetch
|
- neofetch
|
||||||
- onlyoffice-desktopeditors
|
- onlyoffice-desktopeditors
|
||||||
- pdfsam
|
- pdfsam
|
||||||
|
|
|
||||||
17
zsh/.aliases
17
zsh/.aliases
|
|
@ -47,9 +47,10 @@ fi
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
|
|
||||||
alias a='~/arsenal/run -t'
|
alias a='~/arsenal/run -t'
|
||||||
|
alias any='~/AnythingLLMDesktop/start'
|
||||||
alias c='clear'
|
alias c='clear'
|
||||||
alias d=docker
|
alias d='docker'
|
||||||
alias dc=docker-compose
|
alias dc='docker-compose'
|
||||||
# alias h='history'
|
# alias h='history'
|
||||||
f() {
|
f() {
|
||||||
fd $1 -exec bat {} +
|
fd $1 -exec bat {} +
|
||||||
|
|
@ -148,6 +149,18 @@ fi
|
||||||
# alias allcmds='compgen -c | sort -u | fzf'
|
# alias allcmds='compgen -c | sort -u | fzf'
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# Taskwarrior
|
||||||
|
# ----------------------------
|
||||||
|
|
||||||
|
alias t='task'
|
||||||
|
alias tl='task list'
|
||||||
|
alias twa='task add'
|
||||||
|
tm() {
|
||||||
|
task modify
|
||||||
|
}
|
||||||
|
alias tb='task burndown.daily'
|
||||||
|
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
|
|
|
||||||
22
zsh/.zshrc
22
zsh/.zshrc
|
|
@ -95,17 +95,17 @@ source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||||
|
|
||||||
# >>> conda initialize >>>
|
# >>> conda initialize >>>
|
||||||
# !! Contents within this block are managed by 'conda init' !!
|
# !! Contents within this block are managed by 'conda init' !!
|
||||||
__conda_setup="$('/home/e/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
# __conda_setup="$('/home/e/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
||||||
if [ $? -eq 0 ]; then
|
# if [ $? -eq 0 ]; then
|
||||||
eval "$__conda_setup"
|
# eval "$__conda_setup"
|
||||||
else
|
# else
|
||||||
if [ -f "/home/e/miniconda3/etc/profile.d/conda.sh" ]; then
|
# if [ -f "/home/e/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||||
. "/home/e/miniconda3/etc/profile.d/conda.sh"
|
# . "/home/e/miniconda3/etc/profile.d/conda.sh"
|
||||||
else
|
# else
|
||||||
export PATH="/home/e/miniconda3/bin:$PATH"
|
# export PATH="/home/e/miniconda3/bin:$PATH"
|
||||||
fi
|
# fi
|
||||||
fi
|
# fi
|
||||||
unset __conda_setup
|
# unset __conda_setup
|
||||||
# <<< conda initialize <<<
|
# <<< conda initialize <<<
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue