π₯ ZSHAND Installer Development GuideΒΆ
π This guide covers how installers work, how to add a new platform, and package management conventions.
π§ Philosophy
Installers should be idempotent, non-destructive, and informative. Running an installer twice should produce the same result. Always check before installing and report what was done.
ποΈ ArchitectureΒΆ
π Directory StructureΒΆ
installers/
βββ π README.md This guide (overview)
βββ π₯ setup.zsh Bootstrap script (source β edit this)
βββ π₯ debian.sh Debian installer (bash)
βββ π₯ ubuntu.sh Ubuntu installer (bash)
βββ π₯ wsl.sh WSL installer (bash)
βββ π₯ manjaro.zsh Manjaro/Arch installer (zsh)
βββ π₯ osx.zsh macOS installer (zsh)
βββ π₯ manjaro-optional-installer.zsh Optional packages for Manjaro
βββ π₯ Install-zshand.ps1 PowerShell installer (Windows/WSL)
βββ π¦ general/ Cross-platform utilities
β βββ gum_helpers.sh Shared gum TUI helpers (bash/zsh)
β βββ environment.zsh Environment setup
β βββ links.zsh Symlink management
β βββ logger.zsh Installer logging
β βββ permissions.zsh File permissions
β βββ required_dirs.zsh Required directory creation
βββ π¦ packages/ Package lists by platform
β βββ debian-packages.zsh Debian required packages
β βββ debian-optional.zsh Debian optional packages
β βββ manjaro-packages.zsh Manjaro required packages
β βββ manjaro-optional.zsh Manjaro optional packages
βββ π§ utilities/ Tool-specific installers
βββ atuin-setup.zsh Atuin history sync setup
βββ powershell-linux.zsh PowerShell Core on Linux
Note: The top-level
setup.zshis a compiled single-file version (auto-generated byjust setup). Editinstallers/setup.zshinstead.
π How Installers Are CalledΒΆ
setup.zsh (compiled) β built from installers/setup.zsh + gum_helpers.sh
β
βββ Detects OS (from /etc/os-release or user selection)
β
βββ Looks for: installers/${os_id}.sh OR installers/${os_id}.zsh
β
βββ Runs the matching installer via bash or zsh
π Writing a New InstallerΒΆ
π§± TemplateΒΆ
#!/usr/bin/env bash
# ββ ${os_id}.sh β ZSHAND system installer for ${OS_NAME} βββββββββββββββββββ
#
# Called by setup.zsh during first-time framework installation.
# Installs system dependencies required by the ZSHAND framework.
#
# USAGE:
# bash installers/${os_id}.sh
#
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
set -euo pipefail
echo "π¦ Installing ZSHAND dependencies for ${OS_NAME}..."
# ββ Required Packages βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
REQUIRED=(
zsh
git
curl
jq
fzf
ripgrep
fd-find
bat
eza
)
echo "π Installing required packages..."
for pkg in "${REQUIRED[@]}"; do
if command -v "$pkg" &>/dev/null || dpkg -l "$pkg" &>/dev/null 2>&1; then
echo " β $pkg (already installed)"
else
echo " π₯ Installing $pkg..."
sudo apt install -y "$pkg" 2>/dev/null || echo " β οΈ Failed: $pkg"
fi
done
# ββ Optional Packages ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
OPTIONAL=(
htop
duf
tree
micro
)
echo ""
echo "π Installing optional packages..."
for pkg in "${OPTIONAL[@]}"; do
if command -v "$pkg" &>/dev/null; then
echo " β $pkg (already installed)"
else
echo " π₯ Installing $pkg..."
sudo apt install -y "$pkg" 2>/dev/null || echo " β οΈ Skipped: $pkg"
fi
done
echo ""
echo "β ${OS_NAME} system dependencies installed."
π RulesΒΆ
- Idempotent β safe to run multiple times
- Check before install β skip if already present
- Report status β show β for existing, π₯ for installing, β οΈ for failures
- Non-fatal failures β optional packages can fail silently
- No interactive prompts β use
-yflags for package managers - Separate required/optional β clearly distinguish must-have from nice-to-have
π¦ Package ListsΒΆ
Package lists live in installers/packages/ as zsh arrays:
# packages/debian-packages.zsh
# Required packages for Debian/Ubuntu
typeset -ga ZSHAND_REQUIRED_PACKAGES=(
zsh
git
curl
jq
fzf
ripgrep # provides rg
fd-find # provides fd (may need alias)
bat # may be batcat on Debian
eza
)
π Package Name MappingΒΆ
Some tools have different package names across distros:
| Tool | Debian/Ubuntu | Arch/Manjaro | Homebrew |
|---|---|---|---|
fd | fd-find | fd | fd |
bat | bat (or batcat) | bat | bat |
rg | ripgrep | ripgrep | ripgrep |
eza | eza (PPA) | eza | eza |
wl-copy | wl-clipboard | wl-clipboard | N/A |
π§ͺ Testing InstallersΒΆ
β Manual TestingΒΆ
# Test in a fresh container
docker run -it debian:latest bash
apt update && apt install -y curl git zsh
# Clone and run
git clone <repo> ~/zshand && cd ~/zshand
bash installers/debian.sh
β VerificationΒΆ
After installation, run auditenv to verify:
The minimum versions are defined in dependency-version-reqs.toml.
π Adding a New PlatformΒΆ
- Create the installer:
installers/<os_id>.shor.zsh - Create package lists:
installers/packages/<os_id>-packages.zsh - Update OS detection in
installers/setup.zsh(if the OS isn't auto-detected), then runjust setup - Test in a fresh environment (container or VM)
- Update
dependency-version-reqs.tomlif minimum versions differ - Document any platform-specific quirks
π Related DocumentsΒΆ
| Document | Purpose |
|---|---|
| ποΈ ARCHITECTURE.md | Framework structure and setup flow |
| π€ CONTRIBUTING.md | Contribution workflow |
| π€ USER_CONFIG.md | Post-install configuration |