Install basic CLI tools (git curl wget + nslookup/kubectl) and document chmod

- ESSENTIAL now includes wget.
- Add best-effort CLI tools: htop, fzf, nslookup (dnsutils on Debian,
  bind-tools on Alpine).
- Attempt kubectl only when its package is available in the repos
  (not in default Debian/Alpine repos; install manually otherwise).
- README: add 'chmod +x install.sh' and a single-line
  clone+install+remove one-liner.
This commit is contained in:
2026-07-20 09:26:50 -03:00
parent 7747781623
commit a78ce3591a
2 changed files with 49 additions and 20 deletions

View File

@@ -37,12 +37,20 @@ These are intentionally excluded from the repo:
```sh ```sh
git clone git@git.ivanch.me:ivanch/dotfiles.git git clone git@git.ivanch.me:ivanch/dotfiles.git
cd dotfiles cd dotfiles
chmod +x install.sh
./install.sh # detects Debian/Alpine, installs pkgs + oh-my-zsh, ./install.sh # detects Debian/Alpine, installs pkgs + oh-my-zsh,
# deploys servers/ and installs Vim plugins # deploys servers/ and installs Vim plugins
# optional: ./install.sh --chsh (set login shell to zsh) # optional: ./install.sh --chsh (set login shell to zsh)
# ./install.sh --dry-run (preview only) # ./install.sh --dry-run (preview only)
``` ```
Or as a single line (clone, install, then remove the folder):
```sh
git clone git@git.ivanch.me:ivanch/dotfiles.git /tmp/dotfiles && \
cd /tmp/dotfiles && chmod +x install.sh && ./install.sh; cd /tmp && rm -rf /tmp/dotfiles
```
The installer: The installer:
1. Detects the OS / package manager (`apt` on Debian, `apk` on Alpine) and 1. Detects the OS / package manager (`apt` on Debian, `apk` on Alpine) and

View File

@@ -3,7 +3,8 @@
# #
# What it does: # What it does:
# 1. Detects the OS and package manager (apt on Debian, apk on Alpine). # 1. Detects the OS and package manager (apt on Debian, apk on Alpine).
# 2. Installs base tooling (git, curl, zsh, vim) + extras (htop, fzf). # 2. Installs base tooling (git, curl, wget, zsh, vim) + CLI tools
# (htop, fzf, nslookup, kubectl when available) for both distros.
# 3. Installs oh-my-zsh (unattended) and the zsh-autosuggestions plugin. # 3. Installs oh-my-zsh (unattended) and the zsh-autosuggestions plugin.
# 4. Deploys the generic server/ dotfiles. # 4. Deploys the generic server/ dotfiles.
# 5. Installs Vim plugins (clones each plugin declared in .vimrc). # 5. Installs Vim plugins (clones each plugin declared in .vimrc).
@@ -98,18 +99,21 @@ detect_os() {
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
install_packages() { install_packages() {
info "Installing base packages" info "Installing base packages"
ESSENTIAL="git curl zsh vim" # Always-present on both Debian and Alpine main/community repos.
# Extras kept lean + cross-distro safe: ESSENTIAL="git curl wget zsh vim"
# htop - process monitor (in main repos on both Debian & Alpine) # Cross-distro CLI tools. Package names differ between distros:
# fzf - fuzzy finder (community repo on Alpine, main on Debian) # nslookup -> dnsutils (Debian) / bind-tools (Alpine)
# neofetch is intentionally NOT in the default set: it was removed from # fzf -> community repo on Alpine, main on Debian
# Alpine 3.20+, and on armbian/Debian it conflicts with the armbian-config # htop -> main on both
# package's own /usr/bin/neofetch (dpkg abort). Add it manually if wanted. if [ "$PKG" = "apk" ]; then
EXTRA="htop fzf" CLI_TOOLS="htop fzf bind-tools"
else
CLI_TOOLS="htop fzf dnsutils"
fi
if [ "$PKG" = "apk" ]; then if [ "$PKG" = "apk" ]; then
# On Alpine, vim/fzf live in the 'community' repo, which is commented # On Alpine, vim/fzf/kubectl live in the 'community' repo, which is
# out by default in /etc/apk/repositories. Enable it (idempotent). # commented out by default in /etc/apk/repositories. Enable it (idempotent).
info "Ensuring Alpine community repository is enabled" info "Ensuring Alpine community repository is enabled"
run sed -i -E "s|^#(.*/community)$|\1|" /etc/apk/repositories run sed -i -E "s|^#(.*/community)$|\1|" /etc/apk/repositories
run $MGR_UPDATE run $MGR_UPDATE
@@ -118,16 +122,33 @@ install_packages() {
fi fi
info "Installing essential packages" info "Installing essential packages"
run $MGR_ADD $ESSENTIAL if run $MGR_ADD $ESSENTIAL; then
ok "Essential packages installed"
# Extras (htop, neofetch, fzf) are best-effort: a missing one must not
# abort the whole bootstrap (e.g. neofetch was dropped from Alpine 3.20+,
# and Debian/Ubuntu increasingly ship it as 'neofetch' but sometimes omit it).
info "Installing extra packages (best-effort)"
if run $MGR_ADD $EXTRA; then
ok "Extra packages installed"
else else
warn "Some extra packages failed to install (non-fatal)." die "Failed to install essential packages ($ESSENTIAL)."
fi
# CLI tools are best-effort: a missing one must not abort the whole
# bootstrap (e.g. some tools simply aren't in the default repos).
info "Installing CLI tools (best-effort): $CLI_TOOLS"
if run $MGR_ADD $CLI_TOOLS; then
ok "CLI tools installed"
else
warn "Some CLI tools failed to install (non-fatal)."
fi
# kubectl is NOT in the default Debian/Alpine repos (it needs the
# Kubernetes apt repo / a manual install). Install it only if the package
# is actually available, so the script stays generic and repo-agnostic.
if command -v kubectl >/dev/null 2>&1; then
ok "kubectl already present, skipping"
else
info "Attempting to install kubectl (if available in repos)"
if run $MGR_ADD kubectl 2>/dev/null; then
ok "kubectl installed"
else
warn "kubectl not available in default repos; skipping (install manually if needed)."
fi
fi fi
} }