From a78ce3591a2dd47262f8e9ea7d2eb14d673ebbd0 Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Mon, 20 Jul 2026 09:26:50 -0300 Subject: [PATCH] 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. --- README.md | 8 +++++++ install.sh | 61 ++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 39bc9bc..f46e432 100644 --- a/README.md +++ b/README.md @@ -37,12 +37,20 @@ These are intentionally excluded from the repo: ```sh git clone git@git.ivanch.me:ivanch/dotfiles.git cd dotfiles +chmod +x install.sh ./install.sh # detects Debian/Alpine, installs pkgs + oh-my-zsh, # deploys servers/ and installs Vim plugins # optional: ./install.sh --chsh (set login shell to zsh) # ./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: 1. Detects the OS / package manager (`apt` on Debian, `apk` on Alpine) and diff --git a/install.sh b/install.sh index f07eb6e..4828b83 100644 --- a/install.sh +++ b/install.sh @@ -3,7 +3,8 @@ # # What it does: # 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. # 4. Deploys the generic server/ dotfiles. # 5. Installs Vim plugins (clones each plugin declared in .vimrc). @@ -98,18 +99,21 @@ detect_os() { # ---------------------------------------------------------------------------- install_packages() { info "Installing base packages" - ESSENTIAL="git curl zsh vim" - # Extras kept lean + cross-distro safe: - # htop - process monitor (in main repos on both Debian & Alpine) - # fzf - fuzzy finder (community repo on Alpine, main on Debian) - # neofetch is intentionally NOT in the default set: it was removed from - # Alpine 3.20+, and on armbian/Debian it conflicts with the armbian-config - # package's own /usr/bin/neofetch (dpkg abort). Add it manually if wanted. - EXTRA="htop fzf" + # Always-present on both Debian and Alpine main/community repos. + ESSENTIAL="git curl wget zsh vim" + # Cross-distro CLI tools. Package names differ between distros: + # nslookup -> dnsutils (Debian) / bind-tools (Alpine) + # fzf -> community repo on Alpine, main on Debian + # htop -> main on both + if [ "$PKG" = "apk" ]; then + CLI_TOOLS="htop fzf bind-tools" + else + CLI_TOOLS="htop fzf dnsutils" + fi if [ "$PKG" = "apk" ]; then - # On Alpine, vim/fzf live in the 'community' repo, which is commented - # out by default in /etc/apk/repositories. Enable it (idempotent). + # On Alpine, vim/fzf/kubectl live in the 'community' repo, which is + # commented out by default in /etc/apk/repositories. Enable it (idempotent). info "Ensuring Alpine community repository is enabled" run sed -i -E "s|^#(.*/community)$|\1|" /etc/apk/repositories run $MGR_UPDATE @@ -118,16 +122,33 @@ install_packages() { fi info "Installing essential packages" - run $MGR_ADD $ESSENTIAL - - # 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" + if run $MGR_ADD $ESSENTIAL; then + ok "Essential packages installed" 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 }