- New mc package: seasons-winter16M skin (fixes washed-out file colors under the old default skin), arrow-key panel navigation, and Backspace bound as an alt key for CdParent (Double Commander-style parent-dir navigation). - setup.sh: install_lazygit and install_nerd_font helpers, since neither ships as an apt/PPA package on this distro anymore. - bash/.bashrc.omb: wire up fzf key-bindings and zoxide, drop the now- redundant bashmarks plugin, enable globstar, and widen history.
138 lines
3.5 KiB
Bash
Executable File
138 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
echo "Setting up dotfiles from $DOTFILES_DIR"
|
|
|
|
stow_pkg() {
|
|
local pkg="$1"
|
|
stow -v -d "$DOTFILES_DIR" -t "$HOME" "$pkg"
|
|
}
|
|
|
|
install_nerd_font() {
|
|
local font_dir="$HOME/.local/share/fonts"
|
|
|
|
if fc-list 2>/dev/null | grep -qi "MesloLGS Nerd Font"; then
|
|
echo "OK: MesloLGS Nerd Font already installed"
|
|
return
|
|
fi
|
|
|
|
if ! command -v curl &>/dev/null || ! command -v unzip &>/dev/null; then
|
|
echo "SKIP: MesloLGS Nerd Font (curl and/or unzip not available)"
|
|
return
|
|
fi
|
|
|
|
echo "Installing MesloLGS Nerd Font..."
|
|
local tmp_zip
|
|
tmp_zip="$(mktemp --suffix=.zip)"
|
|
if curl -fsSL -o "$tmp_zip" \
|
|
"https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.zip"; then
|
|
mkdir -p "$font_dir"
|
|
unzip -oq "$tmp_zip" -d "$font_dir" "*.ttf"
|
|
fc-cache -f "$font_dir" >/dev/null
|
|
echo "ADDED: MesloLGS Nerd Font to $font_dir"
|
|
else
|
|
echo "WARNING: failed to download Nerd Font, skipping"
|
|
fi
|
|
rm -f "$tmp_zip"
|
|
}
|
|
|
|
install_lazygit() {
|
|
local bin_dir="$HOME/.local/bin"
|
|
|
|
if command -v lazygit &>/dev/null; then
|
|
echo "OK: lazygit already installed"
|
|
return
|
|
fi
|
|
|
|
if ! command -v curl &>/dev/null || ! command -v tar &>/dev/null; then
|
|
echo "SKIP: lazygit (curl and/or tar not available)"
|
|
return
|
|
fi
|
|
|
|
echo "Installing lazygit..."
|
|
local version
|
|
version="$(curl -fsSL https://api.github.com/repos/jesseduffield/lazygit/releases/latest \
|
|
| grep -Po '"tag_name": "v\K[^"]*')"
|
|
|
|
if [ -z "$version" ]; then
|
|
echo "WARNING: could not determine latest lazygit version, skipping"
|
|
return
|
|
fi
|
|
|
|
local tmp_tar
|
|
tmp_tar="$(mktemp --suffix=.tar.gz)"
|
|
if curl -fsSL -o "$tmp_tar" \
|
|
"https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${version}_Linux_x86_64.tar.gz"; then
|
|
mkdir -p "$bin_dir"
|
|
tar -xzf "$tmp_tar" -C "$(dirname "$tmp_tar")" lazygit
|
|
install -m 755 "$(dirname "$tmp_tar")/lazygit" "$bin_dir/lazygit"
|
|
rm -f "$(dirname "$tmp_tar")/lazygit"
|
|
echo "ADDED: lazygit $version to $bin_dir"
|
|
else
|
|
echo "WARNING: failed to download lazygit, skipping"
|
|
fi
|
|
rm -f "$tmp_tar"
|
|
}
|
|
|
|
ensure_sourced() {
|
|
local file="$1"
|
|
local bashrc="$HOME/.bashrc"
|
|
local source_line="[ -f \"$file\" ] && source \"$file\""
|
|
|
|
if [ ! -f "$bashrc" ]; then
|
|
echo "WARNING: ~/.bashrc not found, skipping source injection for $file"
|
|
return
|
|
fi
|
|
|
|
if grep -qF "$file" "$bashrc"; then
|
|
echo "OK: $file already sourced in ~/.bashrc"
|
|
else
|
|
echo "" >> "$bashrc"
|
|
echo "# Added by dotfiles setup" >> "$bashrc"
|
|
echo "$source_line" >> "$bashrc"
|
|
echo "ADDED: source $file to ~/.bashrc"
|
|
fi
|
|
}
|
|
|
|
# ssh — always available
|
|
stow_pkg ssh
|
|
|
|
# claude
|
|
if [ -d "$HOME/.claude" ]; then
|
|
stow_pkg claude
|
|
else
|
|
echo "SKIP: claude (~/.claude not found)"
|
|
fi
|
|
|
|
# bash — stow dotfiles, then ensure ~/.bashrc sources them
|
|
stow_pkg bash
|
|
ensure_sourced "$HOME/.bashrc.omb"
|
|
install_lazygit
|
|
|
|
# kitty
|
|
if command -v kitty &>/dev/null; then
|
|
stow_pkg kitty
|
|
install_nerd_font
|
|
else
|
|
echo "SKIP: kitty (not installed)"
|
|
fi
|
|
|
|
# fastfetch
|
|
if command -v fastfetch &>/dev/null; then
|
|
stow_pkg fastfetch
|
|
else
|
|
echo "SKIP: fastfetch (not installed)"
|
|
fi
|
|
|
|
# mc
|
|
if command -v mc &>/dev/null; then
|
|
stow_pkg mc
|
|
else
|
|
echo "SKIP: mc (not installed)"
|
|
fi
|
|
|
|
echo "Done!"
|