Skip to content

Add cain vps and an install menu (Full / Light / Dotfiles / Keybindings / Server / Custom) - #1

Merged
v3ai merged 1 commit into
masterfrom
claude/sharp-fermat-ii6gyk
Nov 11, 2026
Merged

v3ai merged 1 commit into
masterfrom
claude/sharp-fermat-ii6gyk

Conversation

@v3ai

@v3ai v3ai commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

What

Two changes:

  1. cain vps: a server version of cain that installs only what's used in the terminal, on any mainline Linux distro.
  2. An install menu: cain -i no longer installs everything by default. It asks what you want.

Install menu

What should cain install?
up/down move   enter pick   q quit

 > Full         programs, dotfiles, keybindings and desktop settings
   Light        dotfiles and keybindings; no programs, no desktop changes
   Dotfiles     just configs, shell aliases and git settings
   Keybindings  just key remaps and shortcuts
   Server       terminal programs and dotfiles, nothing graphical
   Custom       tick each part yourself
  • Custom opens a checklist of the install steps: Space ticks one, a toggles all, Enter starts.
  • Server only shows on Linux and is the same as cain vps.
  • Controls: arrow keys or j/k, Enter, q or Esc to quit.
  • Plain cain uses the same kind of menu to ask Install or Collect.
  • Skipping the menu:
    • cain install light (or full, dotfiles, keybindings, server) picks a preset directly
    • cain -i -y installs everything
    • with no terminal attached (scripts, CI), cain installs everything as before
  • src/tui.c is plain C with no dependencies: termios on Linux/macOS, conio on Windows. It clips lines to the terminal width so redraws don't break, and falls back to a numbered prompt if the output isn't a terminal.

Server / VPS

On a fresh server:

curl -fsSL https://raw.githubusercontent.com/v3ai/cain/master/vps.sh | sh

(That URL works once this is merged.)

  • vps.sh installs git and a C compiler, clones cain to ~/cain, builds it and runs cain vps. Works with apt, dnf/yum, pacman, zypper, apk and xbps: Debian, Ubuntu, Fedora, Rocky/Alma/CentOS/RHEL, Arch, openSUSE, Alpine, Void.
  • cain vps [steps] runs packages git files bin shell only, installs packages marked "terminal": true, and skips keys, desktop settings, GUI apps and the reboot prompt.
  • cain.json adds the programs cain.sh uses (python3, pip, venv, tree, nnn, fzf, nmap, ffmpeg, yt-dlp, ssh, iproute2, bash, sudo, curl, …) with each distro's package name.
  • Package entries can now:
    • set null for a package manager to skip it there
    • give a "fallback" shell command, used for micro and yt-dlp, which install into ~/.local/bin
    • name a "bin" to check for when the command isn't the same as name
  • Package installs:
    • apt runs non-interactively
    • apk and zypper refresh their package lists first
    • pacman does a full -Syu
    • EPEL (and CRB) are turned on for Rocky/Alma/CentOS/RHEL
    • CAIN_PM forces a package manager, for testing
  • Shell: SSH login shells now load ~/.bashrc. A login shell that isn't bash or zsh (e.g. Alpine's ash) is switched to bash.
  • cain.sh:
    • install, update and the other package aliases now cover apk, xbps and yum
    • ip works without hostname -I
    • open prints links when there's no desktop
    • a sudo shim for root when sudo isn't installed

Things to know

  • Desktop installs change too. The Full install (and the Custom programs step) on Linux now also installs the new terminal packages.
  • Arch does a full system upgrade. Installs on Arch now run pacman -Syu first.

Testing

  • make test: 18 checks pass. The new ones cover each preset's steps and the package names for apt, dnf, pacman, apk and zypper.
  • Builds with -Werror under gcc and clang, and cross-compiles for Windows with MinGW under -Werror.
  • Menu: driven through a pseudo-terminal. Checked picking a preset, the Custom checklist (ticking and unticking), q and Esc to cancel, and the Install/Collect menu.
  • Not tested: the Windows console menu was only compiled, never run.
  • Ubuntu 24.04, full run of vps.sh in a container:
    • every package installed
    • aliases and functions load in a login shell
    • running it a second time is safe
    • the yt-dlp fallback works
  • Other distros: checked with dry runs only. The test sandbox could only reach Ubuntu's mirrors.

🤖 Generated with Claude Code

https://claude.ai/code/session_012UFcA7u8gWu2RPdtQjpqhW

- vps.sh bootstraps a fresh server (Debian/Ubuntu, Fedora, RHEL family,
  Arch, openSUSE, Alpine, Void): installs git + a C compiler, clones and
  builds cain, then runs `cain vps`.
- `cain vps [steps]` runs packages, git, files, bin and shell only; it
  installs packages marked "terminal": true and skips keys/desktop/GUI.
- cain.json: add the programs cain.sh actually uses (python3/pip/venv,
  tree, nnn, fzf, nmap, ffmpeg, yt-dlp, ssh, iproute2, ...) with
  per-distro names. Packages accept null per package manager, a
  "fallback" shell command and a "bin" name.
- Package installs: apt is non-interactive, apk/zypper refresh first,
  pacman does a full -Syu, EPEL (+CRB) is enabled on Rocky/Alma/CentOS/RHEL.
  CAIN_PM forces a package manager.
- Shell: SSH login shells now load ~/.bashrc, and a non-bash login shell
  is switched to bash. cain.sh gains apk/xbps/yum, a headless `open`, an
  `ip` that works without `hostname -I`, and a sudo shim for root.
- Tests for each distro's package names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012UFcA7u8gWu2RPdtQjpqhW
@v3ai
v3ai merged commit 46063bf into master Nov 11, 2026
6 of 8 checks passed
@v3ai v3ai changed the title Add cain vps: set up any Linux server with just the terminal tools Add cain vps and an install menu (Full / Light / Dotfiles / Keybindings / Server / Custom) Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants